add JSX components v2
This commit is contained in:
parent
b5dd0ed413
commit
4b1227149f
25 changed files with 1080 additions and 3 deletions
16
components-jsx/Button.tsx
Normal file
16
components-jsx/Button.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { ButtonComponent, ComponentTypes, TextButton, URLButton } from "oceanic.js";
|
||||
|
||||
import { childrenToString } from "./utils";
|
||||
|
||||
export { ButtonStyles } from "oceanic.js";
|
||||
|
||||
type Button = Omit<TextButton, "type" | "label"> | Omit<URLButton, "type" | "label">;
|
||||
export type ButtonProps = Button & { children?: any; };
|
||||
|
||||
export function Button({ children, ...props }: ButtonProps): ButtonComponent {
|
||||
return {
|
||||
type: ComponentTypes.BUTTON,
|
||||
label: childrenToString("Button", children) ?? undefined,
|
||||
...props
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue