Updated Navbar storybook to include an Image

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-04-01 23:34:37 +02:00
parent 031971b859
commit d2fbe42db8
Signed by: Florian Bouillon
GPG Key ID: 50BD648F12C86AB6
6 changed files with 1055 additions and 989 deletions

View File

@ -1,4 +1,5 @@
const path = require("path");
const webpack = require('webpack')
module.exports = {
"stories": [
@ -16,5 +17,18 @@ module.exports = {
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
},
},
presets: [path.resolve(__dirname, "./next.js")]
presets: [path.resolve(__dirname, "./next.js")],
// Allow to use Next/Image
webpackFinal: (config) => {
config.plugins.push(new webpack.DefinePlugin({
'process.env.__NEXT_IMAGE_OPTS': JSON.stringify({
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
domains: [],
path: '/',
loader: 'default',
})
}))
return config
}
}

View File

@ -0,0 +1,17 @@
// https://stackoverflow.com/a/64765638/7335674
import * as nextImage from 'next/image'
Object.defineProperty(nextImage, 'default', {
configurable: true,
value: (props) => {
return (
<div style={{display: 'inline-block', maxWidth: '100%', overflow: 'hidden', position: 'relative', boxSizing: 'border-box', margin: 0}}>
<div style={{boxSizing: 'border-box', display: 'block', maxWidth: '100%'}}>
<img {...props} alt="" aria-hidden="true" role="presentation" style={{maxWidth: '100%', display: 'block', margin: 0, border: 'none', padding: 0}} />
</div>
<img {...props} style={{position: 'absolute', inset: 0, boxSizing: 'border-box', padding: 0, border: 'none', margin: 'auto', display: 'block', width: 0, height: 0, minWidth: '100%', maxWidth: '100%', minHeight: '100%', maxHeight: '100%'}} />
</div>
)
},
})

View File

@ -1,5 +1,6 @@
import '../src/dzeio/general.styl'
import './mockNextRouter'
import './mockNextImage'
export const parameters = {
layout: 'centered'

View File

@ -0,0 +1,3 @@
<svg width="90" height="38" viewBox="0 0 90 38" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="90" height="38" fill="#C4C4C4"/>
</svg>

After

Width:  |  Height:  |  Size: 150 B

View File

@ -26,5 +26,5 @@ Basic.args = {
}]
}
},
logo: {src: '/assets/logo.svg', width: 90, height: 38}
logo: {src: '/90-38.svg', width: 90, height: 38}
}

2005
yarn.lock

File diff suppressed because it is too large Load Diff