@@ -2,35 +2,58 @@ 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' ;
56
67// Adds 'webp' class to html element if the browser supports webp.
7- import '../src/utils/webpDetector'
8+ import '../src/utils/webpDetector' ;
89
910const oneImageForAllBreakpoints = require . context ( './images/oneImageForAllBreakpoints' ) ;
1011const differentBreakpoints = require . context ( './images/differentBreakpoints' ) ;
1112
13+ const imageWithoutResize = require . context ( './images/oneImageForAllBreakpoints?dontresize' ) ;
14+
15+ const myImageData = require ( './images/oneImageForAllBreakpoints/all.png' ) ;
16+ const myImageWithoutResizeData = require ( './images/oneImageForAllBreakpoints/all.png?dontresize' ) ;
17+
18+ // Usage example getOriginal ()
19+ console . log ( getOriginal ( myImageData ) ) ;
20+ console . log ( getOriginal ( myImageWithoutResizeData ) ) ;
21+
1222ReactDOM . render (
1323 < div >
1424 < h1 > Example usage of csssr.images</ h1 >
1525
1626 < h2 > As picture tag</ h2 >
27+
1728 < h3 > One image for all resolutions</ h3 >
1829 < PictureSmart requireImages = { oneImageForAllBreakpoints } alt = "One image for all resolutions" />
30+
1931 < h3 > Image with different breakpoints</ h3 >
2032 < PictureSmart requireImages = { differentBreakpoints } alt = "Image with different breakpoints" />
2133
34+ < h3 > Image without resize</ h3 >
35+ < PictureSmart requireImages = { imageWithoutResize } alt = "Image without resize" />
2236
2337 < h2 > As background css</ h2 >
38+
2439 < h3 > One image for all resolutions</ h3 >
2540 < div className = "one-image-for-all-resolutions" style = { { width : '100%' , height : '100%' } } >
2641 One image for all resolutions on background
2742 </ div >
2843 < style > { backgroundCssSmart ( '.one-image-for-all-resolutions' , oneImageForAllBreakpoints ) } </ style >
44+
2945 < h3 > Different breakpoints</ h3 >
3046 < div className = "different-breakpoints" style = { { width : '100%' , height : '100%' } } >
3147 Image with different breakpoints on background
3248 </ div >
3349 < style > { backgroundCssSmart ( '.different-breakpoints' , differentBreakpoints ) } </ style >
50+
51+ < h3 > Image without resize</ h3 >
52+
53+ < div className = "image-without-resize" style = { { width : '100%' , height : '100%' } } >
54+ Image without resize on background
55+ </ div >
56+ < style > { backgroundCssSmart ( '.image-without-resize' , imageWithoutResize ) } </ style >
3457 </ div > ,
3558 document . getElementById ( 'app' ) ,
3659) ;
0 commit comments