Skip to content

Commit

Permalink
Refactor dialoginput (#493)
Browse files Browse the repository at this point in the history
* Fix some stories

* WIP

* WIP

* Fix story+routing

* Fix issues

* Better stories

* Refactor dialog input

* Min rows 3 for all

* Bruker mock in stories

* Use hashrouter for storybook

* Add deplay to chromatic snapshots

* More deplay

* Fix hash nav hack

* Align meldinger til bunnen

* fix alignment dialog

* clean up

---------

Co-authored-by: johannetronstad <[email protected]>
  • Loading branch information
tu55eladd and johatr authored Sep 29, 2023
1 parent 2c9e8e6 commit 82885a9
Show file tree
Hide file tree
Showing 35 changed files with 750 additions and 12,703 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ yarn-error.log*
.idea/
*.iml

mockServiceWorker.js
build-storybook.log
mockServiceWorker.js
/storybook-static/
57 changes: 55 additions & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,58 @@
import type { Preview } from '@storybook/react';
import { initialize, mswLoader } from 'msw-storybook-addon';
import { handlers } from '../src/mock/handlers';
import { rest } from 'msw';
import { FeatureToggle } from '../src/featureToggle/const';
import bruker from '../src/mock/Bruker';

// Initialize MSW
initialize();

const viewports = {
mobile: {
name: 'Mobil',
styles: {
width: '350px',
height: '600px'
}
},
tablet: {
name: 'Tablet',
styles: {
width: '900px',
height: '700px'
}
},
laptop: {
name: 'Laptop (lg)',
styles: {
width: '1024px',
height: '720px'
}
},
laptop2: {
name: 'Laptop (xl)',
styles: {
width: '1280px',
height: '720px'
}
},
desktop: {
name: 'Desktop (2xl)',
styles: {
width: '1920px',
height: '1080px'
}
}
};

const configurableMocks = ['/veilarbaktivitet/api/feature', '/veilarboppfolging/api/oppfolging/me'];

const preview: Preview = {
parameters: {
viewport: {
viewports
},
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
Expand All @@ -15,11 +61,18 @@ const preview: Preview = {
}
},
msw: {
handlers: [handlers]
handlers: {
default: handlers.filter((it) => !configurableMocks.includes(it.info.path)),
brukerMock: [rest.get('/veilarboppfolging/api/oppfolging/me', (_, res, ctx) => res(ctx.json(bruker)))],
featureToggle: [
rest.get('/veilarbaktivitet/api/feature', (_, res, ctx) =>
res(ctx.json({ [FeatureToggle.VIS_SKJUL_AKTIVITET_KNAPP]: false }))
)
]
}
}
},
loaders: [mswLoader]
// loaders: []
};

export default preview;
Loading

0 comments on commit 82885a9

Please sign in to comment.