@@ -2,44 +2,61 @@ import React from 'react';
22import ReactDOM from 'react-dom' ;
33import { PictureSmart } from '../src/react' ;
44import { backgroundCssSmart } from '../src/utils/backgroundCss' ;
5- import { getOriginal } from '../src/utils'
5+ import { getOriginal } from '../src/utils' ;
66
77// Adds 'webp' class to html element if the browser supports webp.
8- import '../src/utils/webpDetector'
8+ import '../src/utils/webpDetector' ;
99
1010const oneImageForAllBreakpoints = require . context ( './images/oneImageForAllBreakpoints' ) ;
1111const differentBreakpoints = require . context ( './images/differentBreakpoints' ) ;
1212
13- const oneImageForAllBreakpointsWithoutResize = require . context ( './images/oneImageForAllBreakpoints?dontresize' ) ;
13+ const imageWithoutResize = require . context ( './images/oneImageForAllBreakpoints?dontresize' ) ;
1414
15- // Usage example getOriginal ()
16- const myImageDataDontresize = require ( './images/oneImageForAllBreakpoints/all.png?dontresize' )
17- const myImageData = require ( './images/oneImageForAllBreakpoints/all.png' )
15+ const myImageData = require ( './images/oneImageForAllBreakpoints/all.png' ) ;
16+ const myImageWithoutResizeData = require ( './images/oneImageForAllBreakpoints/all.png?dontresize' ) ;
1817
19- console . log ( getOriginal ( myImageData ) )
20- console . log ( getOriginal ( myImageDataDontresize ) )
18+ // Usage example getOriginal ()
19+ console . log ( getOriginal ( myImageData ) ) ;
20+ console . log ( getOriginal ( myImageWithoutResizeData ) ) ;
2121
2222ReactDOM . render (
2323 < div >
2424 < h1 > Example usage of csssr.images</ h1 >
2525
2626 < h2 > As picture tag</ h2 >
27+
2728 < h3 > One image for all resolutions</ h3 >
28- < PictureSmart requireImages = { oneImageForAllBreakpointsWithoutResize } alt = "One image for all resolutions" />
2929 < PictureSmart requireImages = { oneImageForAllBreakpoints } alt = "One image for all resolutions" />
30+
3031 < h3 > Image with different breakpoints</ h3 >
3132 < PictureSmart requireImages = { differentBreakpoints } alt = "Image with different breakpoints" />
33+
34+ < h3 > Image without resize</ h3 >
35+ < PictureSmart
36+ requireImages = { imageWithoutResize }
37+ alt = "Image without resize"
38+ />
39+
3240 < h2 > As background css</ h2 >
41+
3342 < h3 > One image for all resolutions</ h3 >
3443 < div className = "one-image-for-all-resolutions" style = { { width : '100%' , height : '100%' } } >
3544 One image for all resolutions on background
3645 </ div >
3746 < style > { backgroundCssSmart ( '.one-image-for-all-resolutions' , oneImageForAllBreakpoints ) } </ style >
47+
3848 < h3 > Different breakpoints</ h3 >
3949 < div className = "different-breakpoints" style = { { width : '100%' , height : '100%' } } >
4050 Image with different breakpoints on background
4151 </ div >
4252 < style > { backgroundCssSmart ( '.different-breakpoints' , differentBreakpoints ) } </ style >
53+
54+ < h3 > Image without resize</ h3 >
55+
56+ < div className = ".image-without-resize" style = { { width : '100%' , height : '100%' } } >
57+ Image without resize on background
58+ </ div >
59+ < style > { backgroundCssSmart ( '.image-without-resize' , imageWithoutResize ) } </ style >
4360 </ div > ,
4461 document . getElementById ( 'app' ) ,
4562) ;
0 commit comments