-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
624 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@premieroctet/next-admin": minor | ||
--- | ||
|
||
feat: add client actions (#401) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import OptionsTable from "../../../components/OptionsTable"; | ||
|
||
# Components | ||
|
||
Next-Admin exports a set of UI components which are, for most of those, extending [Radix UI primitives](https://www.radix-ui.com/primitives). These components are available through the `@premieroctet/next-admin/components` import. | ||
|
||
## `Button` | ||
|
||
The button element accepts all the base `button` tag attributes and extends it with the following: | ||
|
||
<OptionsTable | ||
options={[ | ||
{ | ||
name: "variant", | ||
description: | ||
"The button variant. Possible values are `default`, `destructive`, `destructiveOutline`, `outline`, `secondary`, `ghost`, `link`", | ||
defaultValue: "default", | ||
}, | ||
{ | ||
name: "size", | ||
description: "The button size. Possible values are `default`, `sm`, `lg`", | ||
}, | ||
{ | ||
name: "icon", | ||
description: "A boolean indicating the presence of an icon", | ||
}, | ||
{ | ||
name: "asChild", | ||
description: ( | ||
<> | ||
A boolean to render a{" "} | ||
<a href="https://www.radix-ui.com/primitives/docs/utilities/slot"> | ||
Radix Slot component | ||
</a> | ||
</> | ||
), | ||
}, | ||
{ | ||
name: "loading", | ||
description: "A boolean to render a spinner", | ||
}, | ||
]} | ||
/> | ||
|
||
## `BaseInput` | ||
|
||
The input component rendered in the Form component. It accepts all the base `input` tag attributes. | ||
|
||
## `Switch` | ||
|
||
The [Radix Switch](https://www.radix-ui.com/primitives/docs/components/switch) component. | ||
|
||
## `Select` | ||
|
||
The [Radix Select](https://www.radix-ui.com/primitives/docs/components/select) component. | ||
|
||
## `Checkbox` | ||
|
||
An implementation of the [Radix Checkbox](https://www.radix-ui.com/primitives/docs/components/checkbox) component. It accepts all the props of the [Checkbox Root](https://www.radix-ui.com/primitives/docs/components/switch#root) component, and the following: | ||
|
||
<OptionsTable | ||
options={[ | ||
{ | ||
name: "indeterminate", | ||
description: "A boolean to render the checkbox in an indeterminate state", | ||
}, | ||
]} | ||
/> | ||
|
||
## `Dropdown` | ||
|
||
The [Radix Dropdown](https://www.radix-ui.com/primitives/docs/components/dropdown) component. | ||
|
||
## `Table` | ||
|
||
The [Radix Table](https://www.radix-ui.com/primitives/docs/components/table) component. | ||
|
||
## `Tooltip` | ||
|
||
The [Radix Tooltip](https://www.radix-ui.com/primitives/docs/components/tooltip) component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
import { ClientActionDialogContentProps } from "@premieroctet/next-admin"; | ||
import { Button } from "@premieroctet/next-admin/components"; | ||
|
||
type Props = ClientActionDialogContentProps<"User">; | ||
|
||
const UserDetailsDialog = ({ data, onClose }: Props) => { | ||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<div className="flex flex-col gap-2"> | ||
<h2 className="text-nextadmin-content-default dark:text-dark-nextadmin-content-default text-2xl font-semibold"> | ||
{data?.email.value as string} | ||
</h2> | ||
<p className="text-nextadmin-content-subtle dark:text-dark-nextadmin-content-subtle"> | ||
{data?.name.value as string} | ||
</p> | ||
<p className="text-nextadmin-content-subtle dark:text-dark-nextadmin-content-subtle"> | ||
{data?.role.value as string} | ||
</p> | ||
</div> | ||
<div className="flex"> | ||
<Button variant="default" onClick={onClose}> | ||
Close | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default UserDetailsDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.