1
- import React from 'react' ;
2
- import { storiesOf , action , linkTo } from '@kadira/storybook' ;
3
- import { Code , Result } from '../components' ;
4
- import MobileBreakpoint from '../components/MobileBreakpoint' ;
5
- import withSizes from '../../src/withSizes' ;
1
+ import React from 'react'
2
+ import { storiesOf , action , linkTo } from '@kadira/storybook'
3
+ import { Code , Result } from '../components'
4
+ import MobileBreakpoint from '../components/MobileBreakpoint'
5
+ import withSizes from '../../src/withSizes'
6
6
7
7
const mapSizesToProps = sizes => ( {
8
8
backgroundColor : sizes . width > 800 ? 'green' : 'blue' ,
9
9
isMobile : withSizes . isMobile ( sizes ) ,
10
10
isTablet : withSizes . isTablet ( sizes ) ,
11
11
isDesktop : withSizes . isDesktop ( sizes ) ,
12
- } ) ;
12
+ } )
13
13
14
14
const ExampleSizedComponent = withSizes ( mapSizesToProps ) (
15
15
( { isMobile, isTablet, isDesktop, backgroundColor } ) => (
16
16
< div style = { { backgroundColor, color : 'white' , padding : '30px' } } >
17
- < div > < strong > Resize your window</ strong > </ div >
17
+ < div >
18
+ < strong > Resize your window</ strong >
19
+ </ div >
18
20
{ isMobile && 'isMobile ' }
19
21
{ isTablet && 'isTablet ' }
20
22
{ isDesktop && 'isDesktop ' }
21
23
</ div >
22
24
)
23
- ) ;
25
+ )
24
26
25
27
storiesOf ( 'Sizes' , module )
26
28
. add ( 'default behavior' , ( ) => (
@@ -29,7 +31,7 @@ storiesOf('Sizes', module)
29
31
< ExampleSizedComponent />
30
32
</ Result >
31
33
< Code >
32
- { `import React from 'react';
34
+ { `import React from 'react';
33
35
import withSizes from 'react-sizes';
34
36
35
37
const mapSizesToProps = sizes => ({
@@ -60,4 +62,3 @@ const ExampleSizedComponent = withSizes(mapSizesToProps)(
60
62
< MobileBreakpoint breakpoint = { 700 } />
61
63
</ div >
62
64
) )
63
- ;
0 commit comments