Skip to content

Commit 91a8859

Browse files
add ThemeProvider to broken stories
1 parent 53ab7e0 commit 91a8859

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

src/components/Button.stories.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
import React from 'react';
22
import Button from './Button';
3+
import { ThemeProvider } from 'styled-components';
4+
import themes from '../themes';
35

46
export default {
57
title: 'Controls/Button',
68
component: Button,
79
};
810

9-
export const button = () => <Button>I'm just a regular button</Button>;
11+
export const button = () => (
12+
<ThemeProvider theme={themes.default}>
13+
<Button>I'm just a regular button</Button>
14+
</ThemeProvider>
15+
);
1016

1117
export const withOnClickHandler = () => (
12-
<Button
13-
onClick={() =>
14-
alert(
15-
"I'm just a regular button. Use me like you would any other button."
16-
)
17-
}
18-
>
19-
Click me for an alert
20-
</Button>
18+
<ThemeProvider theme={themes.default}>
19+
<Button
20+
onClick={() =>
21+
alert(
22+
"I'm just a regular button. Use me like you would any other button."
23+
)
24+
}
25+
>
26+
Click me for an alert
27+
</Button>
28+
</ThemeProvider>
2129
);
2230

2331
withOnClickHandler.story = {
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
import React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import ImageAtom from './ImageAtom';
4+
import themes from '../../themes';
45
import jellyfish from '../../../demo/images/jellyfish.jpg';
6+
import { ThemeProvider } from 'styled-components';
57

68
storiesOf('Atoms/ImageAtom', module)
79
.addParameters({ component: ImageAtom })
810
.add('remote URL', () => (
9-
<ImageAtom
10-
src="https://images.unsplash.com/photo-1540968221243-29f5d70540bf?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=882&q=80"
11-
alt="yellow jellyfish"
12-
/>
11+
<ThemeProvider theme={themes.default}>
12+
<ImageAtom
13+
src="https://images.unsplash.com/photo-1540968221243-29f5d70540bf?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=882&q=80"
14+
alt="yellow jellyfish"
15+
/>
16+
</ThemeProvider>
1317
))
1418
.add('local image', () => (
15-
<ImageAtom src={jellyfish} alt="swimming jellyfish" />
19+
<ThemeProvider theme={themes.default}>
20+
<ImageAtom src={jellyfish} alt="swimming jellyfish" />
21+
</ThemeProvider>
1622
));

0 commit comments

Comments
 (0)