-
Notifications
You must be signed in to change notification settings - Fork 12
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
49 changed files
with
1,436 additions
and
576 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { createTheme } from '@vanilla-extract/css'; | ||
import { recipe } from '@vanilla-extract/recipes'; | ||
|
||
export const [themeClass, vars] = createTheme({ | ||
color: { | ||
blue: { | ||
'100': '#c9e8ff', | ||
'200': '#8dd5f8', | ||
'300': '#5db8fe', | ||
'400': '#37a6ed', | ||
'500': '#0588cb', | ||
test: '#0588cb', | ||
'600': '#0f77b8', | ||
'700': '#056aa6', | ||
'800': '#005f9c', | ||
'900': '#005a99', | ||
} | ||
}, | ||
// font: { | ||
// body: 'arial' | ||
// } | ||
}); | ||
|
||
export const button = recipe({ | ||
base: { | ||
borderRadius: 999 | ||
}, | ||
|
||
variants: { | ||
variant: { | ||
primary: { background: vars.color.blue.test }, | ||
dark: { background: 'black' }, | ||
}, | ||
size: { | ||
s: { padding: 12 }, | ||
m: { padding: 16 }, | ||
l: { padding: 24 }, | ||
xl: { padding: 24 }, | ||
}, | ||
hollow: { | ||
true: { background: 'transparent' } | ||
} | ||
}, | ||
|
||
// Applied when multiple variants are set at once | ||
compoundVariants: [ | ||
{ | ||
variants: { | ||
size: 'l' | ||
}, | ||
style: { | ||
background: 'ghostwhite' | ||
} | ||
} | ||
], | ||
|
||
defaultVariants: { | ||
size: 'm' | ||
} | ||
}); | ||
|
||
// export const storybookButton = style({ | ||
// fontFamily: 'Nunito Sans , Helvetica Neue , Helvetica , Arial , sans-serif', | ||
// fontWeight: '700', | ||
// border: '0', | ||
// borderRadius: '3em', | ||
// cursor: 'pointer', | ||
// display: 'inline-block', | ||
// lineHeight: '1', | ||
// }); | ||
|
||
// export const storybookButtonLarge = style({ | ||
// fontSize: '16px', | ||
// padding: '12px 24px', | ||
// }); | ||
|
||
// export const storybookButtonMedium = style({ | ||
// fontSize: '14px', | ||
// padding: '11px 20px', | ||
// }); | ||
|
||
// export const storybookButtonPrimary = style({ | ||
// color: 'white', | ||
// backgroundColor: '#1ea7fd', | ||
// }); | ||
|
||
// export const storybookButtonSecondary = style({ | ||
// color: '#333', | ||
// backgroundColor: 'transparent', | ||
// boxShadow: 'rgba(0,0,0,0.15) 0px 0px 0px 1px inset', | ||
// }); | ||
|
||
// export const storybookButtonSmall = style({ | ||
// fontSize: '12px', | ||
// padding: '10px 16px', | ||
// }); |
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,65 @@ | ||
// import { recipe } from '@vanilla-extract/recipes'; | ||
import React, { forwardRef } from 'react'; | ||
|
||
import { | ||
button | ||
} from './ButtonVanillaExtract.css'; | ||
|
||
type Size = 's' | 'm' | 'l' | 'xl' | ||
type Variant = 'primary' | 'dark' | ||
|
||
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { | ||
disabled?: boolean | ||
inverted?: boolean | ||
hollow?: boolean | ||
variant?: Variant | ||
size?: Size | ||
startIcon?: React.ReactNode | ||
endIcon?: React.ReactNode | ||
} | ||
|
||
const Button = forwardRef( | ||
( | ||
{ | ||
hollow = false, | ||
inverted = false, | ||
disabled = false, | ||
variant = 'primary', | ||
size = 'm', | ||
type = 'button', | ||
children, | ||
startIcon, | ||
endIcon, | ||
...rest | ||
}: ButtonProps, | ||
ref, | ||
) => { | ||
return ( | ||
<button | ||
className={ | ||
button({ | ||
variant, | ||
size, | ||
hollow | ||
}) | ||
} | ||
type={type} | ||
{...rest} | ||
> | ||
{startIcon && ( | ||
<span className="icon"> | ||
{startIcon} | ||
</span> | ||
)} | ||
{children} | ||
{endIcon && ( | ||
<span className="icon"> | ||
{endIcon} | ||
</span> | ||
)} | ||
</button> | ||
) | ||
}, | ||
) | ||
|
||
export default Button |
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
File renamed without changes.
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,57 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import React from 'react' | ||
import { BsTwitter } from 'react-icons/bs' | ||
import Box from '../components/Box' | ||
import Button from '../components/ButtonVanillaExtract' | ||
|
||
const meta = { | ||
title: 'Components/ButtonVanillaExtract', | ||
component: Button, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
onClick: { action: 'clicked' }, | ||
hollow: { control: 'boolean' }, | ||
disabled: { control: 'boolean' }, | ||
inverted: { control: 'boolean' }, | ||
}, | ||
} satisfies Meta<typeof Button> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Primary: Story = { | ||
args: { | ||
children: 'Button', | ||
}, | ||
} | ||
|
||
export const ColorVariant: Story = { | ||
args: { | ||
color: 'dark', | ||
children: 'Button', | ||
size: 's', | ||
endIcon: <BsTwitter />, | ||
}, | ||
} | ||
|
||
export const Inverted: Story = { | ||
args: { | ||
inverted: true, | ||
children: 'Button', | ||
}, | ||
} | ||
|
||
export const Hollow: Story = { | ||
args: { | ||
hollow: true, | ||
children: 'Button', | ||
}, | ||
} | ||
|
||
export const LongButton = () => { | ||
return ( | ||
<Box width="300px"> | ||
<Button>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Button> | ||
</Box> | ||
) | ||
} |
4 changes: 2 additions & 2 deletions
4
stories/Checkbox.stories.tsx → src/stories/Checkbox.stories.tsx
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
3 changes: 1 addition & 2 deletions
3
stories/Container.stories.tsx → src/stories/Container.stories.tsx
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
3 changes: 1 addition & 2 deletions
3
stories/FacebookShareButton.stories.tsx → src/stories/FacebookShareButton.stories.tsx
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
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
stories/Heading.stories.tsx → src/stories/Heading.stories.tsx
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.