-
Notifications
You must be signed in to change notification settings - Fork 35
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
6 changed files
with
97 additions
and
79 deletions.
There are no files selected for viewing
77 changes: 45 additions & 32 deletions
77
packages/components/src/_components/button/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 |
---|---|---|
@@ -1,57 +1,70 @@ | ||
import { PlaceholderIcon } from '@status-im/icons/20' | ||
|
||
import { Button } from './button' | ||
|
||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
const sizes = ['40', '32', '24'] as const | ||
|
||
// eslint-disable-next-line react/display-name | ||
const renderVariant = (variant: string) => (props: any) => ( | ||
<div className="flex items-center gap-4"> | ||
{sizes.map(size => ( | ||
<Button key={size} {...props} variant={variant} size={size} /> | ||
))} | ||
</div> | ||
) | ||
type Story = StoryObj<typeof Button> | ||
|
||
const meta = { | ||
const meta: Meta< | ||
typeof Button & { showIconBefore: boolean; showIconAfter: boolean } | ||
> = { | ||
component: Button, | ||
title: 'Components/Button', | ||
args: { | ||
children: 'Button', | ||
// isDisabled: false, | ||
iconBefore: <PlaceholderIcon />, | ||
iconAfter: <PlaceholderIcon />, | ||
}, | ||
|
||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/IBmFKgGL1B4GzqD8LQTw6n/Design-System-for-Desktop%2FWeb?node-id=4%3A32&mode=dev', | ||
}, | ||
}, | ||
argTypes: { | ||
children: { | ||
control: 'text', | ||
}, | ||
disabled: { | ||
control: 'boolean', | ||
}, | ||
iconBefore: { | ||
control: 'boolean', | ||
}, | ||
iconAfter: { | ||
control: 'boolean', | ||
}, | ||
}, | ||
|
||
render: props => ( | ||
args: { | ||
children: 'Button', | ||
disabled: false, | ||
// variant: 'primary', | ||
// size: '40', | ||
}, | ||
render: args => ( | ||
<div className="grid gap-4"> | ||
{renderVariant('primary')(props)} | ||
{renderVariant('positive')(props)} | ||
{renderVariant('grey')(props)} | ||
{renderVariant('darkGrey')(props)} | ||
{renderVariant('outline')(props)} | ||
{renderVariant('ghost')(props)} | ||
{renderVariant('danger')(props)} | ||
{( | ||
[ | ||
'primary', | ||
'positive', | ||
'grey', | ||
'darkGrey', | ||
'outline', | ||
'ghost', | ||
'danger', | ||
] as const | ||
).map(variant => ( | ||
<div key={variant} className="flex items-center gap-4"> | ||
{(['40', '32', '24'] as const).map(size => ( | ||
<Button key={size} {...args} variant={variant} size={size} /> | ||
))} | ||
</div> | ||
))} | ||
</div> | ||
), | ||
} satisfies Meta<typeof Button> | ||
} | ||
|
||
type Story = StoryObj<typeof Button> | ||
export default meta | ||
|
||
export const Light: Story = {} | ||
|
||
export const Dark: Story = { | ||
parameters: { | ||
backgrounds: { default: 'dark' }, | ||
}, | ||
} | ||
|
||
export default meta |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
export type { ButtonProps } from './button' | ||
export { Button, buttonStyles } from './button' | ||
export { Button } from './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
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export type IconElement = React.ReactElement< | ||
React.ComponentPropsWithoutRef<'svg'> | ||
> | ||
|
||
export type Prettify<T> = { | ||
[K in keyof T]: T[K] | ||
} & {} // eslint-disable-line @typescript-eslint/ban-types |