-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Showing
10 changed files
with
49 additions
and
56 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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import React from 'react' | ||
import { View } from 'react-native' | ||
import { StyleSheet, View } from 'react-native' | ||
import { storiesOf } from '@storybook/react-native' | ||
|
||
import DrawerButton from '../../../app/navigation/drawer/drawer-button' | ||
|
||
storiesOf('DrawerButton', module) | ||
.add('Default', () => ( | ||
<View style={{ backgroundColor: 'black' }}> | ||
<DrawerButton | ||
text='Drawer Button' | ||
onPress={() => { }} | ||
/> | ||
</View> | ||
)) | ||
const styles = StyleSheet.create({ | ||
container: { backgroundColor: 'black' }, | ||
}) | ||
|
||
storiesOf('DrawerButton', module).add('Default', () => ( | ||
<View style={styles.container}> | ||
<DrawerButton text="Drawer Button" onPress={() => {}} /> | ||
</View> | ||
)) |
25 changes: 8 additions & 17 deletions
25
boilerplate/app/shared/components/alert-message/alert-message.story.js
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,23 +1,14 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react-native' | ||
import { StyleSheet } from 'react-native' | ||
|
||
import AlertMessage from './alert-message' | ||
|
||
const styles = StyleSheet.create({ | ||
container: { backgroundColor: 'red' }, | ||
}) | ||
|
||
storiesOf('AlertMessage', module) | ||
.add('Default', () => ( | ||
<AlertMessage | ||
title='ALERT ALERT' | ||
/> | ||
)) | ||
.add('Hidden', () => ( | ||
<AlertMessage | ||
title='ALERT ALERT' | ||
show={false} | ||
/> | ||
)) | ||
.add('Custom Style', () => ( | ||
<AlertMessage | ||
title='ALERT ALERT' | ||
style={{ backgroundColor: 'red' }} | ||
/> | ||
)) | ||
.add('Default', () => <AlertMessage title="ALERT ALERT" />) | ||
.add('Hidden', () => <AlertMessage title="ALERT ALERT" show={false} />) | ||
.add('Custom Style', () => <AlertMessage title="ALERT ALERT" style={styles.container} />) |
17 changes: 6 additions & 11 deletions
17
boilerplate/app/shared/components/full-button/full-button.story.js
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,17 +1,12 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react-native' | ||
import { StyleSheet } from 'react-native' | ||
|
||
import FullButton from './full-button' | ||
|
||
const styles = StyleSheet.create({ | ||
container: { backgroundColor: 'blue' }, | ||
}) | ||
storiesOf('FullButton', module) | ||
.add('Default', () => ( | ||
<FullButton | ||
text='A simple button' | ||
/> | ||
)) | ||
.add('Custom Style', () => ( | ||
<FullButton | ||
text='Style Me Up!' | ||
styles={{ backgroundColor: 'blue' }} | ||
/> | ||
)) | ||
.add('Default', () => <FullButton text="A simple button" />) | ||
.add('Custom Style', () => <FullButton text="Style Me Up!" styles={styles.container} />) |
21 changes: 9 additions & 12 deletions
21
boilerplate/app/shared/components/search-bar/search-bar.story.js
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,24 +1,21 @@ | ||
import React from 'react' | ||
import { View } from 'react-native' | ||
import { StyleSheet, View } from 'react-native' | ||
import { storiesOf } from '@storybook/react-native' | ||
|
||
import SearchBar from './search-bar' | ||
|
||
const styles = StyleSheet.create({ | ||
container: { backgroundColor: 'black', height: 50 }, | ||
}) | ||
|
||
storiesOf('SearchBar', module) | ||
.add('Default', () => ( | ||
<View style={{ backgroundColor: 'black', height: 50 }}> | ||
<SearchBar | ||
onSearch={() => {}} | ||
onCancel={() => {}} | ||
/> | ||
<View style={styles.container}> | ||
<SearchBar onSearch={() => {}} onCancel={() => {}} /> | ||
</View> | ||
)) | ||
.add('With Search Term', () => ( | ||
<View style={{ backgroundColor: 'black', height: 50 }}> | ||
<SearchBar | ||
onSearch={() => {}} | ||
onCancel={() => {}} | ||
searchTerm='HELLO!!' | ||
/> | ||
<View style={styles.container}> | ||
<SearchBar onSearch={() => {}} onCancel={() => {}} searchTerm="HELLO!!" /> | ||
</View> | ||
)) |
11 changes: 8 additions & 3 deletions
11
boilerplate/test/spec/shared/components/alert-message/alert-message.spec.js
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,20 +1,25 @@ | ||
import 'react-native' | ||
import React from 'react' | ||
import renderer from 'react-test-renderer' | ||
import { StyleSheet } from 'react-native' | ||
|
||
const styles = StyleSheet.create({ | ||
container: { backgroundColor: 'red' }, | ||
}) | ||
|
||
import AlertMessage from '../../../../../app/shared/components/alert-message/alert-message' | ||
|
||
test('AlertMessage component renders correctly if show is true', () => { | ||
const tree = renderer.create(<AlertMessage title='howdy' />).toJSON() | ||
const tree = renderer.create(<AlertMessage title="howdy" />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
test('AlertMessage component does not render if show is false', () => { | ||
const tree = renderer.create(<AlertMessage title='howdy' show={false} />).toJSON() | ||
const tree = renderer.create(<AlertMessage title="howdy" show={false} />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
test('AlertMessage component renders correctly if backgroundColor prop is set', () => { | ||
const tree = renderer.create(<AlertMessage title='howdy' style={{ backgroundColor: 'red' }} />).toJSON() | ||
const tree = renderer.create(<AlertMessage title="howdy" style={styles.container} />).toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) |