11import React from 'react' ;
2- import { storiesOf , action , linkTo } from '@kadira/storybook' ;
2+ import { storiesOf , action , linkTo } from '@kadira/storybook' ;
33import Image from '../src/components/Image' ;
44import Video from '../src/components/Video' ;
55import Transformation from '../src/components/Transformation' ;
66import CloudinaryContext from '../src/components/CloudinaryContext' ;
77import cloudinary from 'cloudinary-core' ;
88
9- storiesOf ( 'Image' , module )
10- . addWithInfo ( 'image' , "Basic tag" , ( ) => {
11- let t = { width : 0.5 , crop : "scale" } ;
9+ storiesOf ( 'Image' , module ) . addWithInfo ( 'image' , "Basic tag" , ( ) => {
10+ let t = { width : 0.5 , crop : "scale" } ;
11+ return (
12+ < Image cloudName = "demo" publicId = "sample" transformation = { t } />
13+ )
14+ }
15+ ) . addWithInfo ( 'image with alt' , "Demostrate using an img tag attribute" , ( ) => {
16+ let t = { width : 0.5 , crop : "scale" } ;
1217 return (
13- < Image cloudName = "demo" publicId = "sample" transformation = { t } />
14- ) } )
15- . addWithInfo ( 'image with alt' , "Demostrate using an img tag attribute" , ( ) => {
16- let t = { width : 0.5 , crop : "scale" } ;
17- return (
1818 < Image cloudName = "demo" publicId = "does-not-exist" alt = "This image is intentionally missing" transformation = { t } />
1919 )
20- } )
21- . addWithInfo ( 'image with html attributes' , 'image with html attributes' , ( ) => {
22- return (
23- < Image cloudName = "demo" publicId = "sample" html_width = "100" />
20+ }
21+ ) . addWithInfo ( 'image with html attributes' , 'image with html attributes' , ( ) => {
22+ return (
23+ < Image cloudName = "demo" publicId = "sample" html_width = "100" />
2424 )
25- } )
26- . addWithInfo ( 'image with style' , 'image with style' , ( ) => {
27- let t = { width : 0.5 , crop : "scale" } ;
28- return (
29- < Image cloudName = "demo" publicId = "sample" style = { { border : "20px solid" } } />
25+ }
26+ ) . addWithInfo ( 'image with style' , 'image with style' , ( ) => {
27+ let t = { width : 0.5 , crop : "scale" } ;
28+ return (
29+ < Image cloudName = "demo" publicId = "sample" style = { { border : "20px solid" } } />
3030 )
31- } ) . addWithInfo ( 'image with chained transformation' , 'image with chained transformation' , ( ) => {
32- let t = { width : 0.5 , crop : "scale" } ;
33- return ( < div >
34- < Image cloudName = "demo" publicId = "sample" width = "100" crop = "scale" angle = "10" transformation = { [ { width :100 , crop :"crop" } , { width :100 , angle : - 10 , crop : "scale" } ] } />
35- < Image cloudName = "demo" publicId = "sample" width = "100" crop = "scale" angle = "10" />
31+ }
32+ ) . addWithInfo ( 'image with chained transformation' , 'image with chained transformation' , ( ) => {
33+ let t = { width : 0.5 , crop : "scale" } ;
34+ return (
35+ < div >
36+ < Image cloudName = "demo" publicId = "sample" width = "100" crop = "scale" angle = "10"
37+ transformation = { [ { width : 100 , crop : "crop" } , { width : 100 , angle : - 10 , crop : "scale" } ] } />
38+ < Image cloudName = "demo" publicId = "sample" width = "100" crop = "scale" angle = "10" />
3639 </ div >
3740 )
38- } ) . addWithInfo ( 'image with chained transformation' , 'image with chained transformation' , ( ) => {
39- let t = { width : 0.5 , crop : "scale" } ;
40- return ( < div >
41- < Image cloudName = "demo" publicId = "sample" >
42- < Transformation width = "200" crop = "scale" angle = "10" />
43- < Transformation width = "100" crop = "crop" />
41+ }
42+ ) . addWithInfo ( 'image with chained transformation' , 'image with chained transformation' , ( ) => {
43+ let t = { width : 0.5 , crop : "scale" } ;
44+ return (
45+ < div >
46+ < Image cloudName = "demo" publicId = "sample" >
47+ < Transformation width = "200" crop = "scale" angle = "10" />
48+ < Transformation width = "100" crop = "crop" />
4449 < Transformation width = "100" crop = "scale" angle = "-10" />
4550 </ Image >
46- < Image cloudName = "demo" publicId = "sample" width = "100" crop = "scale" />
47- </ div >
48- )
49- } ) ;
50- storiesOf ( 'Video' , module )
51- . addWithInfo ( 'Simple tag' , 'Simple tag' , ( ) => {
51+ < Image cloudName = "demo" publicId = "sample" width = "100" crop = "scale" />
52+ </ div >
53+ )
54+ } ) ;
55+ storiesOf ( 'Video' , module ) . addWithInfo ( 'Simple tag' , 'Simple tag' , ( ) => {
5256 return (
5357 < Video cloudName = "demo" controls publicId = "dog" />
5458 )
55- } ) . addWithInfo ( 'With fallback' , 'With fallback' , ( ) => {
59+ }
60+ ) . addWithInfo ( 'With fallback' , 'With fallback' , ( ) => {
5661 return (
5762 < Video cloudName = "demo" controls = "controls" publicId = "dog" fallback = "Cannot display video" />
5863 )
59- } ) . addWithInfo ( 'With inline fallback' , 'With inline fallback' , ( ) => {
64+ }
65+ ) . addWithInfo ( 'With inline fallback' , 'With inline fallback' , ( ) => {
6066 return (
61- < Video cloudName = "demo" controls = "controls" publicId = "dog" >
67+ < Video cloudName = "demo" controls = "controls" publicId = "dog" >
6268 Cannot display < b > video</ b > .
6369 </ Video >
6470 )
65- } ) . addWithInfo ( 'With source types' , 'With source types' , ( ) => {
71+ }
72+ ) . addWithInfo ( 'With source types' , 'With source types' , ( ) => {
6673 return (
6774 < Video cloudName = "demo" controls = "controls" publicId = "dog" sourceTypes = { [ 'webm' , 'ogv' , 'mp4' ] } >
6875 Cannot display video.
6976 </ Video >
7077 )
71- } ) . addWithInfo ( 'Simple tag with width' , 'Simple tag with width' , ( ) => {
78+ }
79+ ) . addWithInfo ( 'Simple tag with width' , 'Simple tag with width' , ( ) => {
7280 return (
7381 < Video cloudName = "demo" controls publicId = "dog" width = "300" crop = "scale" />
7482 )
75- } ) . addWithInfo ( 'Simple tag with poster url' , 'Simple tag with poster url' , ( ) => {
76- let url = cloudinary . Cloudinary . new ( { cloud_name : "demo" } ) . url ( "sample" , { width :300 , crop : "scale" } ) ;
83+ }
84+ ) . addWithInfo ( 'Simple tag with poster url' , 'Simple tag with poster url' , ( ) => {
85+ let url = cloudinary . Cloudinary . new ( { cloud_name : "demo" } ) . url ( "sample" , { width : 300 , crop : "scale" } ) ;
7786 return (
7887 < Video cloudName = "demo" controls publicId = "dog" width = "300" crop = "scale" poster = { url } />
7988 )
80- } ) . addWithInfo ( 'Simple tag with poster object' , 'Simple tag with poster object' , ( ) => {
81- return (
82- < Video cloudName = "demo" controls publicId = "dog" width = "300" crop = "scale" poster = { { publicId : "sample" } } />
83- )
84- } ) ;
85- storiesOf ( 'CloudinaryContext' , module )
86- . addWithInfo ( 'CloudinaryContext' , 'CloudinaryContext' , ( ) => {
87- let t = { width : 0.5 , crop : "scale" } ;
89+ }
90+ ) . addWithInfo ( 'Simple tag with poster object' , 'Simple tag with poster object' , ( ) => {
91+ return (
92+ < Video cloudName = "demo" controls publicId = "dog" width = "300" crop = "scale" poster = { { publicId : "sample" } } />
93+ )
94+ } ) ;
95+
96+ storiesOf ( 'CloudinaryContext' , module ) . addWithInfo ( 'CloudinaryContext' , 'CloudinaryContext' , ( ) => {
97+ let t = { width : 0.5 , crop : "scale" } ;
8898 return (
89- < CloudinaryContext cloudName = "demo" >
99+ < CloudinaryContext cloudName = "demo" >
90100 < div > < span > Inside a div: </ span >
91101 < Image publicId = "sample" transformation = { t } width = "50" />
92- </ div >
102+ </ div >
93103
94- < Image publicId = "sample" transformation = { t } />
104+ < Image publicId = "sample" transformation = { t } />
95105 </ CloudinaryContext >
96- ) } )
97- . addWithInfo ( 'Nested Context' , 'Nested Context' , ( ) => {
106+ ) ;
107+ }
108+ ) . addWithInfo ( 'Nested Context' , 'Nested Context' , ( ) => {
98109 return (
99110 < CloudinaryContext cloudName = "demo" width = "50" crop = "scale" >
100111 < Image publicId = "sample" />
@@ -107,5 +118,6 @@ storiesOf('CloudinaryContext', module)
107118 < Image publicId = "sample" angle = "0" />
108119 </ CloudinaryContext >
109120 </ CloudinaryContext >
110- ) } )
111- ;
121+ )
122+ }
123+ ) ;
0 commit comments