1
+ import type { Decorator } from '@storybook/react' ;
2
+ import { Document } from '@utrecht/component-library-react' ;
3
+
1
4
/**
2
5
* Storybook does not have a before/after cleanup cycle, and localStorage would in
3
6
* these situations break story/test isolation.
4
7
*
5
8
* This decorator is applied to every story to reset the storage state.
6
9
*/
7
- export const withClearSessionStorage = Story => {
10
+ export const withClearSessionStorage : Decorator = Story => {
8
11
window . sessionStorage . clear ( ) ;
9
12
return < Story /> ;
10
13
} ;
@@ -17,7 +20,7 @@ export const withClearSessionStorage = Story => {
17
20
* 'e450890a-4166-410e-8d64-0a54ad30ba01'. You can specify another key via parameters
18
21
* or args.
19
22
*/
20
- export const withClearSubmissionLocalStorage = ( Story , { args, parameters} ) => {
23
+ export const withClearSubmissionLocalStorage : Decorator = ( Story , { args, parameters} ) => {
21
24
const formId =
22
25
args ?. formId ?? parameters ?. localStorage ?. formId ?? 'e450890a-4166-410e-8d64-0a54ad30ba01' ;
23
26
window . localStorage . removeItem ( formId ) ;
@@ -28,10 +31,13 @@ export const withClearSubmissionLocalStorage = (Story, {args, parameters}) => {
28
31
* This decorator wraps stories so that they are inside a container with the class name "utrecht-document". This is
29
32
* needed so that components inherit the right font.
30
33
*/
31
- export const utrechtDocumentDecorator = Story => {
32
- return (
33
- < div className = "utrecht-document utrecht-document--surface" >
34
- < Story />
35
- </ div >
36
- ) ;
37
- } ;
34
+ export const withUtrechtDocument : Decorator = ( Story , { parameters} ) => (
35
+ < Document
36
+ className = "utrecht-document--surface"
37
+ style = { {
38
+ '--utrecht-space-around' : parameters ?. utrechtDocument ?. spaceAround ?? 0 ,
39
+ } }
40
+ >
41
+ < Story />
42
+ </ Document >
43
+ ) ;
0 commit comments