-
Notifications
You must be signed in to change notification settings - Fork 0
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
17 changed files
with
274 additions
and
76 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 was deleted.
Oops, something went wrong.
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,58 @@ | ||
import React, { useEffect } from 'react' | ||
import { ChakraProvider, useColorMode } from '@chakra-ui/react' | ||
import { Story } from '@storybook/react' | ||
import { customTheme } from '../app/theme' | ||
|
||
type ColorModeProps = { | ||
colorMode: 'light' | 'dark' | ||
children: JSX.Element | ||
} | ||
|
||
function ColorMode(props: ColorModeProps) { | ||
const { setColorMode } = useColorMode() | ||
|
||
useEffect(() => { | ||
setColorMode(props.colorMode) | ||
}, [props.colorMode]) | ||
|
||
return props.children | ||
} | ||
|
||
const withChakra = (Story: Story, context) => { | ||
return ( | ||
<ChakraProvider theme={customTheme}> | ||
<ColorMode colorMode={context.globals.colorMode}> | ||
<Story /> | ||
</ColorMode> | ||
</ChakraProvider> | ||
) | ||
} | ||
|
||
export const decorators = [withChakra] | ||
|
||
export const globalTypes = { | ||
colorMode: { | ||
name: 'Color Mode', | ||
defaultValue: 'light', | ||
toolbar: { | ||
items: [ | ||
{ title: 'Light', value: 'light' }, | ||
{ title: 'Dark', value: 'dark' } | ||
], | ||
dynamicTitle: true | ||
} | ||
} | ||
} | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i | ||
} | ||
}, | ||
chakra: { | ||
theme: customTheme | ||
} | ||
} |
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,16 @@ | ||
import { | ||
Button as ChakraButton, | ||
ButtonProps as ChakraButtonProps | ||
} from '@chakra-ui/react' | ||
|
||
type ButtonProps = ChakraButtonProps & { | ||
children: React.ReactNode | ||
} | ||
|
||
export const AlertButton = ({ children, ...props }: ButtonProps) => { | ||
return ( | ||
<ChakraButton colorScheme="red" px="28px" {...props}> | ||
{children} | ||
</ChakraButton> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
export { AlertButton } from './alert-button' | ||
export { PrimaryButton } from './primary-button' | ||
export { SecondaryButton } from './secondary-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
Button as ChakraButton, | ||
ButtonProps as ChakraButtonProps | ||
} from '@chakra-ui/react' | ||
|
||
type ButtonProps = ChakraButtonProps & { | ||
children: React.ReactNode | ||
} | ||
|
||
export const PrimaryButton = ({ children, ...props }: ButtonProps) => { | ||
return ( | ||
<ChakraButton colorScheme="primary" px="28px" {...props}> | ||
{children} | ||
</ChakraButton> | ||
) | ||
} |
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,16 @@ | ||
import { | ||
Button as ChakraButton, | ||
ButtonProps as ChakraButtonProps | ||
} from '@chakra-ui/react' | ||
|
||
type ButtonProps = ChakraButtonProps & { | ||
children: React.ReactNode | ||
} | ||
|
||
export const SecondaryButton = ({ children, ...props }: ButtonProps) => { | ||
return ( | ||
<ChakraButton colorScheme="gray" px="28px" {...props}> | ||
{children} | ||
</ChakraButton> | ||
) | ||
} |
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,30 @@ | ||
import { AlertButton } from '@/components/button' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
const meta: Meta<typeof AlertButton> = { | ||
title: 'Button/AlertButton', | ||
component: AlertButton | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof AlertButton> | ||
|
||
export const Solid: Story = { | ||
args: { | ||
children: 'Button', | ||
variant: 'solid', | ||
isDisabled: false, | ||
isActive: false, | ||
isLoading: false | ||
} | ||
} | ||
|
||
export const Outline: Story = { | ||
args: { | ||
children: 'Button', | ||
variant: 'outline', | ||
isDisabled: false, | ||
isActive: false, | ||
isLoading: false | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
import { PrimaryButton } from '@/components/button' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
const meta: Meta<typeof PrimaryButton> = { | ||
title: 'Button/PrimaryButton', | ||
component: PrimaryButton | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof PrimaryButton> | ||
|
||
export const Solid: Story = { | ||
args: { | ||
children: 'Button', | ||
variant: 'solid', | ||
isDisabled: false, | ||
isActive: false, | ||
isLoading: false | ||
} | ||
} | ||
|
||
export const Outline: Story = { | ||
args: { | ||
children: 'Button', | ||
variant: 'outline', | ||
isDisabled: false, | ||
isActive: false, | ||
isLoading: false | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/components/button/stories/secondary-button.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { SecondaryButton } from '@/components/button' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
const meta: Meta<typeof SecondaryButton> = { | ||
title: 'Button/SecondaryButton', | ||
component: SecondaryButton | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof SecondaryButton> | ||
|
||
export const Solid: Story = { | ||
args: { | ||
children: 'Button', | ||
variant: 'solid', | ||
isDisabled: false, | ||
isActive: false, | ||
isLoading: false | ||
} | ||
} | ||
|
||
export const Outline: Story = { | ||
args: { | ||
children: 'Button', | ||
variant: 'outline', | ||
isDisabled: false, | ||
isActive: false, | ||
isLoading: false | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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.