Skip to content

Commit 0974e3f

Browse files
Refine SkyNav component code examples (#1424)
1 parent a74f616 commit 0974e3f

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/components/sky-nav/sky-nav.stories.mdx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks';
22
import { useEffect } from '@storybook/client-api';
3+
import { makeTwigInclude } from '../../make-twig-include';
34
import menu from './demo/menu.json';
45
import template from './sky-nav.twig';
56
import { initSkyNav } from './sky-nav.ts';
7+
const basicStoryArgs = {
8+
include_main_demo: true,
9+
menu,
10+
};
611

712
<!--
813
Inline stories disabled so media queries will behave as expected within
@@ -34,6 +39,14 @@ The Sky Nav is intended for use with our [our dark theme](/docs/design-themes--d
3439
layout: 'fullscreen',
3540
paddings: { disable: true },
3641
themes: { disable: true },
42+
docs: {
43+
source: {
44+
code: makeTwigInclude('@cloudfour/components/sky-nav/sky-nav.twig', {
45+
class: 't-dark',
46+
...basicStoryArgs,
47+
}),
48+
},
49+
},
3750
}}
3851
>
3952
{() => {
@@ -43,7 +56,10 @@ The Sky Nav is intended for use with our [our dark theme](/docs/design-themes--d
4356
);
4457
return destroy;
4558
}, []);
46-
return template({ class: 't-dark', include_main_demo: true, menu });
59+
return template({
60+
class: 't-dark',
61+
...basicStoryArgs,
62+
});
4763
}}
4864
</Story>
4965
</Canvas>
@@ -58,6 +74,14 @@ But it works without a theme, too, just in case:
5874
layout: 'fullscreen',
5975
paddings: { disable: true },
6076
themes: { disable: true },
77+
docs: {
78+
source: {
79+
code: makeTwigInclude(
80+
'@cloudfour/components/sky-nav/sky-nav.twig',
81+
basicStoryArgs
82+
),
83+
},
84+
},
6185
}}
6286
>
6387
{() => {
@@ -67,7 +91,7 @@ But it works without a theme, too, just in case:
6791
);
6892
return destroy;
6993
}, []);
70-
return template({ include_main_demo: true, menu });
94+
return template(basicStoryArgs);
7195
}}
7296
</Story>
7397
</Canvas>

0 commit comments

Comments
 (0)