Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Feb 20, 2024
1 parent 2de9689 commit 7a5f7a1
Show file tree
Hide file tree
Showing 49 changed files with 1,436 additions and 576 deletions.
10 changes: 6 additions & 4 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
const config = {
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: ['../src/fonts/'],
import type { StorybookConfig } from '@storybook/react-vite'

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
'@storybook/addon-mdx-gfm'
],
framework: {
name: '@storybook/react-webpack5',
name: '@storybook/react-vite',
options: {},
},
docs: {
Expand Down
4 changes: 2 additions & 2 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import type { Preview } from '@storybook/react'
import React from 'react'
import { ThemeProvider } from 'styled-components'
import theme from '../src/theme'

Expand All @@ -9,7 +9,7 @@ const preview: Preview = {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
date: /Date$/i,
},
},
},
Expand Down
25 changes: 17 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"dependencies": {
"@styled-system/css": "^5.1.5",
"@styled-system/should-forward-prop": "^5.1.5",
"@vanilla-extract/css": "^1.14.1",
"@vanilla-extract/recipes": "^0.5.1",
"react-select": "^5.8.0",
"styled-system": "^5.1.5"
},
Expand All @@ -25,13 +27,17 @@
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.2",
"@rollup/plugin-url": "^8.0.1",
"@storybook/addon-essentials": "^7.6.15",
"@storybook/addon-interactions": "^7.6.15",
"@storybook/addon-links": "^7.6.15",
"@storybook/addon-mdx-gfm": "^7.6.15",
"@storybook/blocks": "^7.6.15",
"@storybook/react": "^7.6.15",
"@storybook/react-webpack5": "^7.6.15",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
"@storybook/addon-links": "^7.6.17",
"@storybook/addon-mdx-gfm": "^7.6.17",
"@storybook/addon-onboarding": "^1.0.11",
"@storybook/addon-styling-webpack": "^0.0.6",
"@storybook/blocks": "^7.6.17",
"@storybook/react": "^7.6.17",
"@storybook/react-vite": "^7.6.17",
"@storybook/react-webpack5": "^7.6.17",
"@storybook/test": "^7.6.17",
"@storybook/testing-library": "^0.2.2",
"@svgr/rollup": "^8.0.1",
"@testing-library/dom": "^9.3.1",
Expand All @@ -45,9 +51,11 @@
"@types/styled-system__css": "^5.0.21",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@vanilla-extract/vite-plugin": "^4.0.4",
"babel-plugin-inline-react-svg": "^2.0.2",
"babel-plugin-styled-components": "^2.1.4",
"cheerio": "^1.0.0-rc.12",
"css-loader": "^6.10.0",
"eslint": "^8.46.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.9.0",
Expand Down Expand Up @@ -76,7 +84,8 @@
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-typescript2": "^0.35.0",
"rollup-plugin-visualizer": "^5.9.2",
"storybook": "^7.6.15",
"storybook": "^7.6.17",
"style-loader": "^3.3.4",
"styled-components": "^6.1.8",
"ts-jest": "^29.1.1",
"tslib": "^2.6.2",
Expand Down
96 changes: 96 additions & 0 deletions src/components/ButtonVanillaExtract.css.ts
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',
// });
65 changes: 65 additions & 0 deletions src/components/ButtonVanillaExtract.tsx
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
2 changes: 1 addition & 1 deletion stories/Box.stories.tsx → src/stories/Box.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react'
import React from 'react'
import Box from '../src/components/Box'
import Box from '../components/Box'

const meta = {
title: 'Components/Box',
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions stories/Button.stories.tsx → src/stories/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Meta, StoryObj } from '@storybook/react'
import React from 'react'
import { BsTwitter } from 'react-icons/bs'
import Box from '../src/components/Box'
import Button from '../src/components/Button'
import Box from '../components/Box'
import Button from '../components/Button'

const meta = {
title: 'Components/Button',
Expand Down
57 changes: 57 additions & 0 deletions src/stories/ButtonVanillaExtract.stories.tsx
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>
)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meta, StoryObj } from '@storybook/react'
import React from 'react'
import Box from '../src/components/Box'
import Checkbox from '../src/components/Checkbox'
import Box from '../components/Box'
import Checkbox from '../components/Checkbox'

const meta = {
title: 'Components/Checkbox',
Expand Down
2 changes: 1 addition & 1 deletion stories/Colors.mdx → src/stories/Colors.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ColorPalette from './components/ColorPalette'
import { theme, Flex, Box } from '../src'
import { theme, Flex, Box } from '../index'

# Colors

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import { Meta, StoryObj } from '@storybook/react'
import Container from '../src/components/Container'
import Container from '../components/Container'

const meta = {
title: 'Components/Container',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import { Meta, StoryObj } from '@storybook/react'
import FacebookShareButton from '../src/components/FacebookShareButton'
import FacebookShareButton from '../components/FacebookShareButton'

const meta = {
title: 'Components/FacebookShareButton',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Meta, StoryObj } from '@storybook/react'
import Heading from '../src/components/Heading'
import colors from '../src/theme/colors'
import React from 'react'
import Heading from '../components/Heading'
import colors from '../theme/colors'

const meta: Meta = {
title: 'Components/Heading',
Expand Down
12 changes: 6 additions & 6 deletions stories/Hero.stories.tsx → src/stories/Hero.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import { Meta } from '@storybook/react'
import Hero from '../src/components/Hero'
import HeroLead from '../src/components/HeroLead'
import LogoOONIRun from '../src/components/LogoOONIRun'
import Heading from '../src/components/Heading'
import Text from '../src/components/Text'
import React from 'react'
import Heading from '../components/Heading'
import Hero from '../components/Hero'
import HeroLead from '../components/HeroLead'
import LogoOONIRun from '../components/LogoOONIRun'
import Text from '../components/Text'

const meta: Meta = {
title: 'Components/Hero',
Expand Down
Loading

0 comments on commit 7a5f7a1

Please sign in to comment.