Skip to content

Commit

Permalink
feat(storybook): add storybook docs (#197)
Browse files Browse the repository at this point in the history
* feat(storybook): add storybook docs

* fix(scripts): modify buildPrepare.js

* fix(Form): add eslint disable to validation.js
  • Loading branch information
kamleshchandnani authored Aug 22, 2019
1 parent 28d4a84 commit a060172
Show file tree
Hide file tree
Showing 320 changed files with 2,159 additions and 2,625 deletions.
14 changes: 14 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
"node": true,
"jest": true
},
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".web.js",
".amp.js",
".native.js",
".ios.js",
".android.js"
]
}
}
},
"rules": {
"arrow-parens": ["error", "always"],
"function-paren-newline": ["error", "consistent"],
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Wrap your App component with ThemeProvider and pass it the leaf-ui theme (or ove
import React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider } from 'styled-components';
import leafUiTheme, { BaseStyles } from 'leaf-ui/theme/web';
import leafUiTheme, { BaseStyles } from 'leaf-ui/theme';
import App from './App';

ReactDOM.render(
Expand All @@ -36,10 +36,10 @@ Import and use the components in your App.js
```js
// App.js
import React from 'react';
import Button from 'leaf-ui/Button/web';
import Button from 'leaf-ui/Button';

// for commonjs use,
// import Button from 'leaf-ui/cjs/Button/web';
// import Button from 'leaf-ui/cjs/Button';

const App = () => (
<Button>
Expand All @@ -51,9 +51,9 @@ export default App;
```

Supported Platforms
* /web
* /native
* /amp
* web
* native
* amp


# Contribute
Expand Down
61 changes: 51 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"semantic-release": "semantic-release",
"build": "run-s build:clean && run-p build:es build:cjs",
"build:clean": "rimraf es cjs",
"build:es": "babel src -d es --ignore *.test.js,*.story.js,makeStories.js",
"build:cjs": "NODE_ENV=cjs babel src -d cjs --ignore *.test.js,*.story.js,makeStories.js",
"build:es": "babel src -d es --ignore *.test.js,*.story.js",
"build:cjs": "NODE_ENV=cjs babel src -d cjs --ignore *.test.js,*.story.js",
"build:prepare": "node ./src/scripts/buildPrepare.js",
"precommit": "lint-staged",
"commit": "git-cz",
Expand Down Expand Up @@ -43,7 +43,7 @@
"yup": "0.26.6"
},
"devDependencies": {
"@applitools/eyes-storybook": "2.6.3",
"@applitools/eyes-storybook": "2.7.32",
"@babel/cli": "7.2.3",
"@babel/core": "7.2.2",
"@babel/plugin-external-helpers": "7.2.0",
Expand All @@ -55,13 +55,15 @@
"@babel/preset-env": "7.3.1",
"@babel/preset-flow": "7.0.0",
"@babel/preset-react": "7.0.0",
"@storybook/addon-actions": "5.0.5",
"@storybook/addon-knobs": "5.0.5",
"@storybook/react": "5.0.5",
"@storybook/react-native": "4.1.11",
"@storybook/theming": "5.0.5",
"@storybook/addon-actions": "5.2.0-beta.39",
"@storybook/addon-docs": "5.2.0-beta.39",
"@storybook/addon-knobs": "5.2.0-beta.39",
"@storybook/react": "5.2.0-beta.39",
"@storybook/react-native": "5.2.0-beta.39",
"@storybook/theming": "5.2.0-beta.39",
"babel-eslint": "9.0.0",
"babel-jest": "24.0.0",
"babel-loader": "8.0.6",
"babel-plugin-styled-components": "1.10.0",
"babel-plugin-syntax-trailing-function-commas": "6.22.0",
"commitizen": "2.10.1",
Expand Down Expand Up @@ -120,5 +122,44 @@
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
},
"files": [
"cjs/**/*",
"es/**/*",
"Accordion/**/*",
"Button/**/*",
"Card/**/*",
"Checkbox/**/*",
"DatePickerInput/**/*",
"DateRangePickerInput/**/*",
"Divider/**/*",
"Dropdown/**/*",
"Flex/**/*",
"Form/**/*",
"Gallery/**/*",
"Icon/**/*",
"Image/**/*",
"Link/**/*",
"List/**/*",
"Modal/**/*",
"MoreOrLess/**/*",
"Notification/**/*",
"Position/**/*",
"Price/**/*",
"RadioButton/**/*",
"Select/**/*",
"Size/**/*",
"Space/**/*",
"Table/**/*",
"Tabs/**/*",
"Tag/**/*",
"Text/**/*",
"TextArea/**/*",
"TextInput/**/*",
"Toggle/**/*",
"Tooltip/**/*",
"View/**/*",
"theme/**/*",
"theme.js"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import AccordionSection from './AccordionSection';
import AccordionSectionTrigger from './AccordionSectionTrigger';
import AccordionSectionContent from './AccordionSectionContent';
import reactChildrenGroupByType from '../../utils/reactChildrenGroupByType';
import reactChildrenGroupByType from '../utils/reactChildrenGroupByType';

let groupIndex = 0;

Expand Down
159 changes: 159 additions & 0 deletions src/Accordion/Accordion.story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import View from '../View';
import Space from '../Space';
import Icon from '../Icon';
import Divider from '../Divider';
import Text from '../Text';
import Flex from '../Flex';
import Image from '../Image';
import Accordion from './Accordion';

const sampleText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas at elit eget diam convallis ultricies in a ligula.
Nunc rutrum est ut risus laoreet laoreet.
Donec convallis massa at pretium tincidunt.
Quisque quis tellus quis odio venenatis bibendum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas at elit eget diam convallis ultricies in a ligula.
Nunc rutrum est ut risus laoreet laoreet.
Donec convallis massa at pretium tincidunt.
Quisque quis tellus quis odio venenatis bibendum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas at elit eget diam convallis ultricies in a ligula.
Nunc rutrum est ut risus laoreet laoreet.
Donec convallis massa at pretium tincidunt.
Quisque quis tellus quis odio venenatis bibendum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas at elit eget diam convallis ultricies in a ligula.
Nunc rutrum est ut risus laoreet laoreet.
Donec convallis massa at pretium tincidunt.
Quisque quis tellus quis odio venenatis bibendum`;

storiesOf('Accordion', module).addParameters({
component: Accordion,
})
.add('Simple Accordion', () => (
<React.Fragment>
<Space padding={[2]}>
<Text size="xl" color="greyDarker">Simple Accordion</Text>
</Space>
<Accordion>
<Accordion.Section>
<Accordion.Section.Trigger>
<Space padding={[2]}>
<Flex
flexDirection="row"
alignItems="center"
justifyContent="space-between"
>
<View>
<Text size="s" weight="medium" color="greyDarker">
This is title1
</Text>
<Icon name="keyboard_arrow_down" right />
</View>
</Flex>
</Space>
</Accordion.Section.Trigger>
<Accordion.Section.Content>
<Space padding={[2]}>
<View>
<Image
alt="img-1"
src="https://images.treebohotels.com/files/Treebo_The_Galaxy/Oak/OAk_(4).jpg"
height="200px"
width="200px"
/>
{sampleText}
</View>
</Space>
</Accordion.Section.Content>
</Accordion.Section>
<Divider />
<Accordion.Section>
<Accordion.Section.Trigger>
<Space padding={[2]}>
<Flex
flexDirection="row"
alignItems="center"
justifyContent="space-between"
>
<View>
<Text size="s" weight="medium" color="greyDarker">
This is title2
</Text>
<Icon name="keyboard_arrow_down" right />
</View>
</Flex>
</Space>
</Accordion.Section.Trigger>
<Accordion.Section.Content>
<Space padding={[2]}>
<View>{sampleText}</View>
</Space>
</Accordion.Section.Content>
</Accordion.Section>
</Accordion>
</React.Fragment>
))
.add('Multiple Accordions', () => (
<React.Fragment>
<Space padding={[2]}>
<Text size="xl" color="greyDarker">Accordion 1</Text>
</Space>
<Accordion>
<Accordion.Section>
<Accordion.Section.Trigger>
<Space padding={[2]}>
<Flex
flexDirection="row"
alignItems="center"
justifyContent="space-between"
>
<View>
<Text size="s" weight="medium" color="greyDarker">
This is title
</Text>
<Icon name="keyboard_arrow_down" right />
</View>
</Flex>
</Space>
</Accordion.Section.Trigger>
<Accordion.Section.Content>
<Space padding={[2]}>
<View>{sampleText}</View>
</Space>
</Accordion.Section.Content>
</Accordion.Section>
</Accordion>
<Space padding={[2]}>
<Text size="xl" color="greyDarker">Accordion 2</Text>
</Space>
<Accordion>
<Accordion.Section>
<Accordion.Section.Trigger>
<Space padding={[2]}>
<Flex
flexDirection="row"
alignItems="center"
justifyContent="space-between"
>
<View>
<Text size="s" weight="medium" color="greyDarker">
This is title
</Text>
<Icon name="keyboard_arrow_down" right />
</View>
</Flex>
</Space>
</Accordion.Section.Trigger>
<Accordion.Section.Content>
<Space padding={[2]}>
<View>{sampleText}</View>
</Space>
</Accordion.Section.Content>
</Accordion.Section>
</Accordion>
</React.Fragment>
));
1 change: 1 addition & 0 deletions src/Accordion/Accordion.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => null;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import styled from 'styled-components';
import AccordionSectionTrigger from './AccordionSectionTrigger';
import AccordionSectionContent from './AccordionSectionContent';
import { I } from '../../Icon/amp';
import { I } from '../Icon';

let inputIndex = 0;

Expand Down
21 changes: 0 additions & 21 deletions src/Accordion/amp/Accordion.story.js

This file was deleted.

File renamed without changes.
Loading

0 comments on commit a060172

Please sign in to comment.