Skip to content

Commit 3d4e47a

Browse files
committed
docs(swingset): toggle showSearch from the profile playgrounds
1 parent 0d3efb3 commit 3d4e47a

4 files changed

Lines changed: 52 additions & 2 deletions

File tree

‎packages/swingset/src/stories/organization-profile.mdx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,15 @@ navigation dismisses it in place of the corner close button.
3939
name='Fullscreen'
4040
storyModule={Stories}
4141
/>
42+
43+
## Playground
44+
45+
`showSearch` adds a search field above the navigation that finds pages, and the sections on them.
46+
Only the column layout shows it.
47+
48+
<Preview
49+
name='Default'
50+
storyModule={Stories}
51+
/>
52+
53+
<PropTable meta={Stories.meta} />

‎packages/swingset/src/stories/organization-profile.stories.tsx‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,29 @@ export const meta: StoryMeta = {
1616
label: 'Organization profile',
1717
layout: 'wide',
1818
source: 'packages/mosaic/src/features/organization-profile/organization-profile.view.tsx',
19+
styles: {
20+
_variants: {
21+
showSearch: { true: {}, false: {} },
22+
},
23+
_defaultVariants: {
24+
showSearch: 'false',
25+
},
26+
},
1927
};
2028

21-
export function Default() {
29+
function knobsAsProps(props: Record<string, unknown>) {
30+
return { showSearch: props.showSearch === true || props.showSearch === 'true' };
31+
}
32+
33+
export function Default(props: Record<string, unknown>) {
2234
const { activePage, setActivePage, pages } = useOrganizationProfileFixture();
2335
return (
2436
<OrganizationProfileView
2537
activePage={activePage}
2638
pages={pages}
2739
onPageChange={setActivePage}
2840
elevation='flush'
41+
{...knobsAsProps(props)}
2942
/>
3043
);
3144
}

‎packages/swingset/src/stories/user-profile.mdx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,15 @@ navigation dismisses it in place of the corner close button.
4141
name='Fullscreen'
4242
storyModule={Stories}
4343
/>
44+
45+
## Playground
46+
47+
`showSearch` adds a search field above the navigation that finds pages, and the sections on them.
48+
Only the column layout shows it.
49+
50+
<Preview
51+
name='Default'
52+
storyModule={Stories}
53+
/>
54+
55+
<PropTable meta={Stories.meta} />

‎packages/swingset/src/stories/user-profile.stories.tsx‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,34 @@ export const meta: StoryMeta = {
1515
label: 'User profile',
1616
layout: 'wide',
1717
source: 'packages/mosaic/src/features/user-profile/user-profile.view.tsx',
18+
styles: {
19+
_variants: {
20+
showSearch: { true: {}, false: {} },
21+
},
22+
_defaultVariants: {
23+
showSearch: 'false',
24+
},
25+
},
1826
};
1927

28+
function knobsAsProps(props: Record<string, unknown>) {
29+
return { showSearch: props.showSearch === true || props.showSearch === 'true' };
30+
}
31+
2032
/**
2133
* The profile as a page's content — `elevation='flush'`, the way a `Card` chooses its elevation:
2234
* unframed, flush with its host, scrolling with the page. The fixture stands in for the model and
2335
* controller: every page's data, and actions that update it, so the surface behaves.
2436
*/
25-
export function Default() {
37+
export function Default(props: Record<string, unknown>) {
2638
const { activePage, setActivePage, pages } = useUserProfileFixture();
2739
return (
2840
<UserProfileView
2941
activePage={activePage}
3042
pages={pages}
3143
onPageChange={setActivePage}
3244
elevation='flush'
45+
{...knobsAsProps(props)}
3346
/>
3447
);
3548
}

0 commit comments

Comments
 (0)