-
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.
Co-authored-by: Inge Fossland <inge@fosslandfoss.no>
- Loading branch information
1 parent
2309be2
commit cc908e0
Showing
176 changed files
with
4,034 additions
and
823 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
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,16 @@ | ||
import { Icon, type IconName } from '../Icon'; | ||
import type { ButtonSize } from './ButtonBase'; | ||
import styles from './buttonIcon.module.css'; | ||
|
||
export interface ButtonIconProps { | ||
icon: IconName; | ||
size: ButtonSize; | ||
} | ||
|
||
export const ButtonIcon = ({ size, icon }: ButtonIconProps) => { | ||
return ( | ||
<span className={styles.icon} data-size={size}> | ||
<Icon name={icon} /> | ||
</span> | ||
); | ||
}; |
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 type { ReactNode } from 'react'; | ||
import type { ButtonSize } from './ButtonBase'; | ||
import styles from './buttonLabel.module.css'; | ||
|
||
export interface ButtonLabelProps { | ||
size: ButtonSize; | ||
children: ReactNode; | ||
} | ||
|
||
export const ButtonLabel = ({ size, children }: ButtonLabelProps) => { | ||
return ( | ||
<span className={styles.label} data-size={size}> | ||
{children} | ||
</span> | ||
); | ||
}; |
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,64 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Button, ComboButton, IconButton, MetaItem } from '../'; | ||
|
||
const meta = { | ||
title: 'Atoms/Button/Buttons', | ||
tags: ['autodocs'], | ||
parameters: {}, | ||
args: { | ||
color: 'primary', | ||
}, | ||
argTypes: { | ||
color: { | ||
control: 'radio', | ||
options: ['primary', 'secondary'], | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
const sizes = ['sm', 'md', 'lg']; | ||
const variants = ['solid', 'outline', 'dotted', 'text']; | ||
|
||
export const VariantsAndSizes = (args: Story) => { | ||
return ( | ||
<div style={{ display: 'flex', flexDirection: 'column', rowGap: '1rem' }}> | ||
{variants?.map((variant) => { | ||
return ( | ||
<div | ||
key={variant} | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
rowGap: '1rem', | ||
alignItems: 'start', | ||
justifyContent: 'space-between', | ||
width: '100%', | ||
}} | ||
> | ||
<MetaItem>{variant}</MetaItem> | ||
{sizes?.map((size) => { | ||
return ( | ||
<div key={size} style={{ display: 'flex', alignItems: 'center', columnGap: '1rem' }}> | ||
<IconButton {...args} icon="x-mark" variant={variant} size={size} /> | ||
<Button {...args} reverse variant={variant} icon="arrow-left" size={size}> | ||
Button | ||
</Button> | ||
<Button {...args} variant={variant} icon="arrow-right" size={size}> | ||
Button | ||
</Button> | ||
<ComboButton {...args} variant={variant} icon="chevron-down" size={size}> | ||
ComboButton | ||
</ComboButton> | ||
<MetaItem>{size}</MetaItem> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
}; |
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,47 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { MetaItem } from '../Meta'; | ||
import { IconButton } from './IconButton'; | ||
|
||
const meta = { | ||
title: 'Atoms/Button/IconButton', | ||
component: IconButton, | ||
tags: ['autodocs'], | ||
parameters: {}, | ||
args: { | ||
children: 'IconButton', | ||
icon: 'x-mark', | ||
size: 'sm', | ||
}, | ||
} satisfies Meta<typeof IconButton>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; | ||
|
||
const sizes = ['sm', 'md', 'lg']; | ||
const variants = ['outline', 'solid', 'dotted', 'text']; | ||
|
||
export const Sizes = (args) => { | ||
return ( | ||
<div style={{ display: 'flex', columnGap: '1rem', justifyContent: 'space-between', width: '100%' }}> | ||
{variants?.map((variant) => { | ||
return ( | ||
<div key={variant} style={{ display: 'flex', flexDirection: 'column', columnGap: '1rem' }}> | ||
<MetaItem>{variant}</MetaItem> | ||
{sizes?.map((size) => { | ||
return ( | ||
<div key={size}> | ||
<IconButton {...args} variant={variant} size={size} /> | ||
<MetaItem>{size}</MetaItem> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
})} | ||
</div> | ||
); | ||
}; |
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,63 +1,22 @@ | ||
.button { | ||
display: inline-flex; | ||
align-items: center; | ||
column-gap: 0.125em; | ||
border-radius: 2px; | ||
} | ||
|
||
.reverse { | ||
flex-direction: row-reverse; | ||
} | ||
|
||
.label { | ||
line-height: 1rem; | ||
font-weight: 600; | ||
} | ||
|
||
.icon { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
/* sm 36 */ | ||
|
||
.button[data-size="sm"] { | ||
border-radius: 2px; | ||
padding: 0 6px; | ||
} | ||
|
||
.label[data-size="sm"] { | ||
font-size: 0.875rem; | ||
padding: 9px 4px; | ||
} | ||
|
||
.icon[data-size="sm"] { | ||
font-size: 1.25rem; | ||
padding: 0 0.375rem; | ||
} | ||
|
||
/* md 44 */ | ||
|
||
.button[data-size="md"] { | ||
border-radius: 2px; | ||
padding: 9px 6px; | ||
padding: 0 0.5rem; | ||
} | ||
|
||
.label[data-size="md"] { | ||
font-size: 1rem; | ||
padding: 4px 4px; | ||
} | ||
|
||
.icon[data-size="md"] { | ||
font-size: 1.5rem; | ||
} | ||
|
||
/* lg 56 */ | ||
|
||
.button[data-size="lg"] { | ||
border-radius: 2px; | ||
padding: 9px 6px; | ||
} | ||
|
||
.label[data-size="lg"] { | ||
font-size: 1.125rem; | ||
padding: 10px; | ||
padding: 0 0.625rem; | ||
} |
Oops, something went wrong.