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
Fernando Colom
committed
May 9, 2023
1 parent
aaf65d0
commit 88529a8
Showing
23 changed files
with
1,954 additions
and
156 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,4 +1,3 @@ | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import '@storybook/addon-knobs/register'; | ||
import '@storybook/addon-react-native-web'; |
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,15 @@ | ||
module.exports = { | ||
stories: ['./stories/**/*.stories.js'], | ||
webpackFinal: (config) => { | ||
config.resolve.alias = { | ||
...(config.resolve.alias || {}), | ||
// Transform all direct `react-native` imports to `react-native-web` | ||
'react-native$': 'react-native-web', | ||
'@storybook/react-native': '@storybook/react', | ||
}; | ||
config.resolve.extensions = ['.web.js', '.js', '.json']; | ||
// mutate babel-loader | ||
config.module.rules[0].use[0].options.plugins.push(['react-native-web', {commonjs: true}]); | ||
return config; | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import '@storybook/addon-knobs/register'; |
File renamed without changes.
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,15 @@ | ||
module.exports = { | ||
stories: ['../stories/**/*.stories.js'], | ||
webpackFinal: (config) => { | ||
config.resolve.alias = { | ||
...(config.resolve.alias || {}), | ||
// Transform all direct `react-native` imports to `react-native-web` | ||
'react-native$': 'react-native-web', | ||
'@storybook/react-native': '@storybook/react', | ||
}; | ||
config.resolve.extensions = ['.web.js', '.js', '.json']; | ||
// mutate babel-loader | ||
config.module.rules[0].use[0].options.plugins.push(['react-native-web', {commonjs: true}]); | ||
return config; | ||
}, | ||
}; |
File renamed without changes.
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,27 @@ | ||
import {storiesOf} from '@storybook/react-native'; | ||
import {text, select, number, color} from '@storybook/addon-knobs'; | ||
import Avatar from '../../../src/components/Avatar'; | ||
import CenterView from '../CenterView'; | ||
import React from 'react'; | ||
|
||
storiesOf('Avatar', module) | ||
.addDecorator((getStory) => <CenterView>{getStory()}</CenterView>) | ||
.add('with image', () => ( | ||
<Avatar | ||
size={select('size', ['sm', 'md', 'lg'], 'sm')} | ||
textColor={color('textColor', '#FFFFFF')} | ||
bgColor={color('bgColor', '#E8EAF6')} | ||
imageUrl={text('imageUrl', 'https://avatars.githubusercontent.com/u/49998302?s=200&v=4')} | ||
placeholder={text('placeholder', 'Janis Commerce')} | ||
customSize={number('customSize', '')} | ||
/> | ||
)) | ||
.add('with only placeholder', () => ( | ||
<Avatar | ||
size={select('size', ['sm', 'md', 'lg'], 'sm')} | ||
textColor={color('textColor', '#FFFFFF')} | ||
bgColor={color('bgColor', '#E8EAF6')} | ||
placeholder={text('placeholder', 'Janis Commerce')} | ||
customSize={number('customSize', '')} | ||
/> | ||
)); |
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,20 @@ | ||
import {action} from '@storybook/addon-actions'; | ||
import {text} from '@storybook/addon-knobs'; | ||
import {storiesOf} from '@storybook/react-native'; | ||
import React from 'react'; | ||
import {Text} from 'react-native'; | ||
import Button from '.'; | ||
import CenterView from '../CenterView'; | ||
|
||
storiesOf('Button', module) | ||
.addDecorator((getStory) => <CenterView>{getStory()}</CenterView>) | ||
.add('with text', () => ( | ||
<Button onPress={action('clicked-text')}> | ||
<Text>{text('Button text', 'Hello Button')}</Text> | ||
</Button> | ||
)) | ||
.add('with some emoji', () => ( | ||
<Button onPress={action('clicked-emoji')}> | ||
<Text>😀 😎 👍 💯</Text> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {TouchableHighlight} from 'react-native'; | ||
|
||
export default function Button({onPress, children}) { | ||
return <TouchableHighlight onPress={onPress}>{children}</TouchableHighlight>; | ||
} | ||
|
||
Button.defaultProps = { | ||
children: null, | ||
onPress: () => {}, | ||
}; | ||
|
||
Button.propTypes = { | ||
children: PropTypes.node, | ||
onPress: PropTypes.func, | ||
}; |
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 React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {View} from 'react-native'; | ||
import style from './style'; | ||
|
||
export default function CenterView({children}) { | ||
return <View style={style.main}>{children}</View>; | ||
} | ||
|
||
CenterView.defaultProps = { | ||
children: null, | ||
}; | ||
|
||
CenterView.propTypes = { | ||
children: PropTypes.node, | ||
}; |
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,8 @@ | ||
export default { | ||
main: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
}; |
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,21 @@ | ||
import React from 'react'; | ||
import {storiesOf} from '@storybook/react-native'; | ||
import {boolean, number, color} from '@storybook/addon-knobs'; | ||
import CheckBox from '../../../src/components/CheckBox'; | ||
import CenterView from '../CenterView'; | ||
import {action} from '@storybook/addon-actions'; | ||
|
||
storiesOf('CheckBox', module) | ||
.addDecorator((getStory) => <CenterView>{getStory()}</CenterView>) | ||
.add('default props', () => ( | ||
<CheckBox | ||
checked={boolean('checked', true)} | ||
onValueChange={action('onValueChange')} | ||
customSize={number('customSize', 16)} | ||
checkOnColor={color('checkOnColor', '#2979FF')} | ||
checkOffColor={color('checkOffColor', '#939598')} | ||
iconCheckColor={color('iconCheckColor', '#FFF')} | ||
borderRadius={number('borderRadius', 4)} | ||
disabled={boolean('disabld', false)} | ||
/> | ||
)); |
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,3 @@ | ||
import './Button/Button.stories'; | ||
import './Avatar/Avatar.stories'; | ||
import './CheckBox/CheckBox.stories'; |
File renamed without changes.