-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce storybook for Link and Button
- Loading branch information
Andrei Fidelman
committed
Nov 1, 2020
1 parent
554e41d
commit 1b2c3a5
Showing
22 changed files
with
320 additions
and
240 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { addons } from '@storybook/addons'; | ||
import { create } from '@storybook/theming/create'; | ||
|
||
addons.setConfig({ | ||
theme: create({ | ||
base: 'light', | ||
brandTitle: 'cesko.digital', | ||
brandUrl: 'https://cesko.digital/', | ||
brandImage: 'https://cesko.digital/dist/logo.svg' | ||
}), | ||
}); |
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,75 @@ | ||
<style type="text/css"> | ||
@font-face { | ||
font-family: 'Cesko Digital'; | ||
src: url('../static/fonts/cesko.digital-regular.woff2') format('woff2'), | ||
url('../static/fonts/cesko.digital-regular.woff') format('woff'), | ||
url('../static/fonts/cesko.digital-regular.eot') format('eot'); | ||
font-weight: 400; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'Cesko Digital'; | ||
src: url('../static/fonts/cesko.digital-medium.woff2') format('woff2'), | ||
url('../static/fonts/cesko.digital-medium.woff') format('woff'), | ||
url('../static/fonts/cesko.digital-medium.eot') format('eot'); | ||
font-weight: 500; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'Cesko Digital'; | ||
src: url('../static/fonts/cesko.digital-semibold.woff2') format('woff2'), | ||
url('../static/fonts/cesko.digital-semibold.woff') format('woff'), | ||
url('../static/fonts/cesko.digital-semibold.eot') format('eot'); | ||
font-weight: 600; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'Cesko Digital'; | ||
src: url('../static/fonts/cesko.digital-bold.woff2') format('woff2'), | ||
url('../static/fonts/cesko.digital-bold.woff') format('woff'), | ||
url('../static/fonts/cesko.digital-bold.eot') format('eot'); | ||
font-weight: 700; | ||
font-style: normal; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Cesko Digital Mono'; | ||
src: url('../static/fonts/cesko.digital.mono-regular.woff2') format('woff2'), | ||
url('../static/fonts/cesko.digital.mono-regular.woff') format('woff'), | ||
url('../static/fonts/cesko.digital.mono-regular.eot') format('eot'); | ||
font-weight: 400; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'Cesko Digital Mono'; | ||
src: url('../static/fonts/cesko.digital.mono-medium.woff2') format('woff2'), | ||
url('../static/fonts/cesko.digital.mono-medium.woff') format('woff'), | ||
url('../static/fonts/cesko.digital.mono-medium.eot') format('eot'); | ||
font-weight: 500; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'Cesko Digital Mono'; | ||
src: url('../static/fonts/cesko.digital.mono-semibold.woff2') | ||
format('woff2'), | ||
url('../static/fonts/cesko.digital.mono-semibold.woff') format('woff'), | ||
url('../static/fonts/cesko.digital.mono-semibold.eot') format('eot'); | ||
font-weight: 600; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'Cesko Digital Mono'; | ||
src: url('../static/fonts/cesko.digital.mono-bold.woff2') format('woff2'), | ||
url('../static/fonts/cesko.digital.mono-bold.woff') format('woff'), | ||
url('../static/fonts/cesko.digital.mono-bold.eot') format('eot'); | ||
font-weight: 700; | ||
font-style: normal; | ||
} | ||
|
||
html, | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: '"Cesko Digital", system-ui, sans-serif'; | ||
} | ||
</style> |
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,13 @@ | ||
import { ThemeProvider } from 'styled-components'; | ||
import { defaultTheme } from '../src/theme/default' | ||
import { GlobalStyle } from '../src/theme/global-style' | ||
import React from 'react'; | ||
|
||
|
||
export const decorators = [ | ||
(Story) => ( | ||
<ThemeProvider theme={defaultTheme}> | ||
<Story /> | ||
</ThemeProvider> | ||
), | ||
]; |
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
9 changes: 7 additions & 2 deletions
9
src/components/ButtonAsLink/index.tsx → src/components/button-as-link/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react' | ||
// also exported from '@storybook/react' if you can deal with breaking changes in 6.1 | ||
import { Story, Meta } from '@storybook/react' | ||
|
||
import Button, { ButtonProps, ButtonSize } from '.' | ||
|
||
const story: Meta = { | ||
title: 'Button', | ||
component: Button, | ||
argTypes: { | ||
disabled: { | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
size: { | ||
defaultValue: ButtonSize.Normal, | ||
control: { | ||
type: 'select', | ||
options: [ButtonSize.Normal, ButtonSize.Small], | ||
}, | ||
}, | ||
inverted: { | ||
defaultValue: false, | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
const Template: Story<ButtonProps> = (args: ButtonProps) => <Button {...args} /> | ||
|
||
export const Default = Template.bind({}) | ||
Default.args = { | ||
children: 'Button', | ||
} | ||
|
||
export const Inverted = Template.bind({}) | ||
Inverted.args = { | ||
children: 'Button', | ||
inverted: true, | ||
} | ||
|
||
export const Small = Template.bind({}) | ||
Small.args = { | ||
children: 'Button', | ||
size: ButtonSize.Small, | ||
} | ||
|
||
export const Disabled = Template.bind({}) | ||
Disabled.args = { | ||
children: 'Button', | ||
disabled: true, | ||
} | ||
|
||
export default story |
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.