From 69dd56262c86af1629528062b14253511143e1f9 Mon Sep 17 00:00:00 2001 From: Vass Bence <49574140+vassbence@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:10:39 +0200 Subject: [PATCH] primary button --- src/components/Button/Button.stories.tsx | 12 +++ src/components/Button/index.tsx | 130 +++++++++++++++++++++++ src/index.ts | 1 + 3 files changed, 143 insertions(+) create mode 100644 src/components/Button/Button.stories.tsx create mode 100644 src/components/Button/index.tsx diff --git a/src/components/Button/Button.stories.tsx b/src/components/Button/Button.stories.tsx new file mode 100644 index 0000000..1db28d1 --- /dev/null +++ b/src/components/Button/Button.stories.tsx @@ -0,0 +1,12 @@ +import { Button } from './index.js' + +export default { + title: 'Components/Button', + component: Button, +} + +export const Default = { + args: { + children: 'Button label', + }, +} diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx new file mode 100644 index 0000000..c498e26 --- /dev/null +++ b/src/components/Button/index.tsx @@ -0,0 +1,130 @@ +import { useState } from 'react' +import { borderRadius } from '../../utils/border.js' +import { color, colorSwatch } from '../../utils/colors.js' +import { Icon, IconProps } from '../Icon/index.js' +import { Text } from '../Text/index.js' + +type ButtonProps = { + children: string + onClick?: () => void + disabled?: boolean + variant?: 'primary' | 'secondary' | 'ghost' + color?: 'neutral' | 'destructive' + leadIcon?: IconProps['variant'] + trailIcon?: IconProps['variant'] +} + +function Button({ + children, + onClick, + disabled, + variant = 'primary', + color: colorProp = 'neutral', + leadIcon, + trailIcon, +}: ButtonProps) { + const [hover, setHover] = useState(false) + const [focus, setFocus] = useState(false) + + return ( + + ) +} + +export type { ButtonProps } +export { Button } diff --git a/src/index.ts b/src/index.ts index a0752cc..1e2704f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ export * from './components/Text/index.js' export * from './components/Icon/index.js' +export * from './components/Button/index.js' export * from './utils/colors.js' export * from './utils/border.js'