mirror of
https://github.com/dzeiocom/components.git
synced 2025-06-06 08:09:55 +00:00
Updated Navbar storybook to include an Image
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
031971b859
commit
d2fbe42db8
@ -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
|
||||
}
|
||||
}
|
||||
|
17
.storybook/mockNextImage.js
Normal file
17
.storybook/mockNextImage.js
Normal 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>
|
||||
)
|
||||
},
|
||||
})
|
@ -1,5 +1,6 @@
|
||||
import '../src/dzeio/general.styl'
|
||||
import './mockNextRouter'
|
||||
import './mockNextImage'
|
||||
|
||||
export const parameters = {
|
||||
layout: 'centered'
|
||||
|
3
.storybook/public/90-38.svg
Normal file
3
.storybook/public/90-38.svg
Normal 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 |
@ -26,5 +26,5 @@ Basic.args = {
|
||||
}]
|
||||
}
|
||||
},
|
||||
logo: {src: '/assets/logo.svg', width: 90, height: 38}
|
||||
logo: {src: '/90-38.svg', width: 90, height: 38}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user