From 2d21e3a7d9f5a09953c71c63f2224d9c22bc4fa8 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Tue, 6 Nov 2018 16:01:59 +0100 Subject: [PATCH] feat(storybook): build our storybook cover page --- .storybook/config.js | 12 ++- .storybook/preview-head.html | 29 +++-- stories/_welcome.stories.js | 204 ++++++++++++++++++++++++++++++++++- 3 files changed, 233 insertions(+), 12 deletions(-) diff --git a/.storybook/config.js b/.storybook/config.js index 8f23abf6..dbb67490 100644 --- a/.storybook/config.js +++ b/.storybook/config.js @@ -1,6 +1,7 @@ import React from 'react' import { addDecorator, configure, setAddon } from '@storybook/react' import { withThemes } from 'storybook-styled-components' +import { withTheme } from 'styled-components' import { themes } from '@storybook/components' import { withOptions } from '@storybook/addon-options' import { withInfo } from '@storybook/addon-info' @@ -14,6 +15,12 @@ import { dark, light } from 'themes' import { getDefaultLocale, locales } from 'lib/i18n' import { BackgroundDark, GlobalStyle } from 'components/UI' +const BackgroundDarkWithTheme = withTheme(({ theme, ...rest }) => ( +
+ +
+)) + // Register supported locales. import '../app/lib/i18n/locale' @@ -66,9 +73,7 @@ addDecorator( addDecorator(story => ( - - {story()} - + {story()} )) @@ -77,6 +82,7 @@ addDecorator(withThemes({ Dark: dark, Light: light })) // Chapters setAddon(chaptersAddon) + setDefaults({ sectionOptions: { showSource: false, diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html index da1548cc..d8a3a070 100644 --- a/.storybook/preview-head.html +++ b/.storybook/preview-head.html @@ -1,10 +1,25 @@ diff --git a/stories/_welcome.stories.js b/stories/_welcome.stories.js index e1020429..7d5e7e5e 100644 --- a/stories/_welcome.stories.js +++ b/stories/_welcome.stories.js @@ -1,5 +1,205 @@ +import React from 'react' +import PropTypes from 'prop-types' import { storiesOf } from '@storybook/react' +import { StateDecorator, Store } from '@sambego/storybook-state' +import { Box, Flex } from 'rebass' +import { + Bar, + Button, + Dropdown, + Form, + Heading, + Input, + Label, + LightningInvoiceInput, + Message, + Notification, + Range, + TextArea, + Toggle +} from 'components/UI' -storiesOf('Welcome', module).addWithChapters('Zap Style Guide', { - subtitle: 'Reusable components for Zap Desktop.' +const Column = props => +const Group = ({ title, children }) => ( + + + {title} + + + {children} + +) +Group.propTypes = { + title: PropTypes.string, + children: PropTypes.node +} +const Element = props => + +const store = new Store({ + crypto: 'btc', + fiat: 'usd', + cryptoCurrencies: [ + { + key: 'btc', + name: 'BTC' + }, + { + key: 'bits', + name: 'bits' + }, + { + key: 'sats', + name: 'satoshis' + } + ], + fiatCurrencies: [ + { + key: 'usd', + name: 'USD' + }, + { + key: 'eur', + name: 'EUR' + }, + { + key: 'gbp', + name: 'GBP' + } + ] }) + +storiesOf('Welcome', module) + .addDecorator(StateDecorator(store)) + .addWithChapters('Zap Style Guide', { + subtitle: 'Reusable components for Zap Desktop.', + info: `The Zap style guide showcases and documents our library of reusable React components. Below is a sample of + three components. You can can full details of each component using the navigation on the left. + + Use the Theme Picker in the bottom panel to view components in one of our alternate themes.`, + chapters: [ + { + sections: [ + { + options: { + showSource: false, + allowSourceToggling: false, + showPropTables: false, + allowPropTablesToggling: false + }, + sectionFn: () => ( + + + + + Error message + + + Success message + + + Warning message + + + + + + Error message + + + Success message + + + Warning message + + + + + + +
+ + +
+
+ + +
+ +