diff options
Diffstat (limited to 'src/ui/objects/Button.tsx')
| -rw-r--r-- | src/ui/objects/Button.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ui/objects/Button.tsx b/src/ui/objects/Button.tsx new file mode 100644 index 0000000..68e1776 --- /dev/null +++ b/src/ui/objects/Button.tsx | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | import type { HTMLTag, Polymorphic } from "corvos/plugins/jsx.ts"; | ||
| 2 | |||
| 3 | import type { Props as ActionButtonProps } from "./ActionButton.tsx"; | ||
| 4 | |||
| 5 | import { ActionButton } from "./ActionButton.tsx"; | ||
| 6 | |||
| 7 | export type Props<Tag extends HTMLTag> = Polymorphic<{ | ||
| 8 | as?: Tag; | ||
| 9 | variant?: "primary" | ActionButtonProps<Tag>["variant"]; | ||
| 10 | size?: ActionButtonProps<Tag>["size"]; | ||
| 11 | wide?: boolean; | ||
| 12 | justify?: boolean; | ||
| 13 | children?: JSX.Element; | ||
| 14 | }>; | ||
| 15 | |||
| 16 | export const Button = <T extends HTMLTag = "a">({ as = "a" as T, variant, ...props }: Props<T>) => ( | ||
| 17 | <ActionButton | ||
| 18 | as={as} | ||
| 19 | label-as={variant ? "strong" : "span"} | ||
| 20 | pill | ||
| 21 | selected={!!variant} | ||
| 22 | variant={variant === "primary" ? undefined : variant} | ||
| 23 | // deno-lint-ignore no-explicit-any | ||
| 24 | {...(props as any)} | ||
| 25 | /> | ||
| 26 | ); | ||
