diff --git a/README.md b/README.md index ce7ed8d..d4c69e8 100644 --- a/README.md +++ b/README.md @@ -18,18 +18,16 @@ import Visual from '@react-visual/react' export default function ResponsiveExample() { return ( { - const ext = type?.includes("webp") ? ".webp" : ".jpg"; - const height = media?.includes("landscape") ? width * 0.5 : width; - return `https://placehold.co/${width}x${height}${ext}`; + image='https://placehold.co/200x200' + sourceTypes={['image/webp']} + sourceMedia={['(orientation:landscape)', '(orientation:portrait)']} + imageLoader={({ src, type, media, width }) => { + const height = media?.includes('landscape') ? width * 0.5 : width + const ext = type?.includes('webp') ? '.webp' : '' + return `https://placehold.co/${width}x${height}${ext}` }} - aspect={300 / 150} - sizes="100vw" - alt="Example of responsive images" - /> + width='100%' + alt='Example of responsive images'/> ) } ``` diff --git a/packages/react/README.md b/packages/react/README.md index 253b502..318d795 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -46,7 +46,7 @@ export default function ResponsiveExample() { sourceMedia={['(orientation:landscape)', '(orientation:portrait)']} imageLoader={({ src, type, media, width }) => { const height = media?.includes('landscape') ? width * 0.5 : width - const ext = type?.includes('webp') ? '.webp' : '.jpg' + const ext = type?.includes('webp') ? '.webp' : '' return `https://placehold.co/${width}x${height}${ext}` }} width='100%' @@ -68,11 +68,17 @@ The above would produce: type='image/webp' media='(orientation:portrait)' srcset='https://placehold.co/640x640.webp 640w, https://placehold.co/750x750.webp 750w, https://placehold.co/828x828.webp 828w, https://placehold.co/1080x1080.webp 1080w, https://placehold.co/1200x1200.webp 1200w, https://placehold.co/1920x1920.webp 1920w, https://placehold.co/2048x2048.webp 2048w, https://placehold.co/3840x3840.webp 3840w'> + + Example of responsive images