Skip to content

Commit 198b4f6

Browse files
feat(manager-wiki): display properties on technical informations
ref: #MANAGER-19982 Signed-off-by: Alex Boungnaseng <[email protected]>
1 parent e9a32e0 commit 198b4f6

File tree

37 files changed

+984
-60
lines changed

37 files changed

+984
-60
lines changed

packages/manager-wiki/.storybook/main.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@ const config: StorybookConfig = {
3333
reactDocgenTypescriptOptions: {
3434
shouldExtractLiteralValuesFromEnum: true,
3535
shouldRemoveUndefinedFromOptional: true,
36-
propFilter: () => true, // ← include all props, even from node_modules
36+
compilerOptions: {
37+
allowSyntheticDefaultImports: true,
38+
esModuleInterop: true,
39+
},
40+
propFilter: (prop) => {
41+
// Include all props from our components
42+
if (prop.parent) {
43+
// Exclude props from node_modules except from our components
44+
return !prop.parent.fileName.includes('node_modules');
45+
}
46+
return true;
47+
},
3748
},
3849
check: false,
3950
},

packages/manager-wiki/.storybook/preview.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ const preview: Preview = {
4040
},
4141
source: {
4242
excludeDecorators: true,
43-
state: 'open',
43+
state: 'shown',
44+
type: 'dynamic',
45+
},
46+
canvas: {
47+
sourceState: 'shown',
4448
},
4549
page: TechnicalInformation,
4650
},
@@ -88,7 +92,7 @@ const preview: Preview = {
8892
},
8993
};
9094

91-
const withI18next = (Story, context) => {
95+
const withI18next = (story, context) => {
9296
const { locale } = context.globals;
9397
const [isLoading, setIsLoading] = useState(true);
9498

@@ -107,6 +111,7 @@ const withI18next = (Story, context) => {
107111
setIsLoading(false);
108112
}
109113
} catch (error) {
114+
// eslint-disable-next-line no-console
110115
console.error('Language change failed:', error);
111116
if (isMounted) {
112117
setIsLoading(false);
@@ -124,15 +129,15 @@ const withI18next = (Story, context) => {
124129
useEffect(() => {
125130
const handleBrowserLanguageChange = () => {
126131
const normalizedLang = normalizeLanguageCode(navigator.language);
132+
// eslint-disable-next-line no-console
127133
console.info('Browser language changed:', normalizedLang);
128-
i18n
129-
.changeLanguage(normalizedLang)
130-
.catch((err) =>
131-
console.error(
132-
'Failed to change language on system languagechange:',
133-
err,
134-
),
134+
i18n.changeLanguage(normalizedLang).catch((err) => {
135+
// eslint-disable-next-line no-console
136+
console.error(
137+
'Failed to change language on system languagechange:',
138+
err,
135139
);
140+
});
136141
};
137142

138143
window.addEventListener('languagechange', handleBrowserLanguageChange);
@@ -146,11 +151,13 @@ const withI18next = (Story, context) => {
146151
return <div>Loading translations...</div>;
147152
}
148153

154+
const StoryComponent = story;
155+
149156
return (
150157
<Suspense fallback={<div>loading translations...</div>}>
151158
<I18nextProvider i18n={i18n}>
152159
<QueryClientProvider client={mockQueryClient}>
153-
<Story />
160+
<StoryComponent />
154161
</QueryClientProvider>
155162
</I18nextProvider>
156163
</Suspense>

packages/manager-wiki/.storybook/technical-information.mdx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
Primary,
66
Stories,
77
ArgTypes,
8+
Source,
9+
Controls,
810
} from '@storybook/addon-docs';
911
import { Meta, Story, Canvas } from '@storybook/blocks';
1012

@@ -14,12 +16,18 @@ import { Meta, Story, Canvas } from '@storybook/blocks';
1416

1517
<Description />
1618

17-
<Canvas sourceState="shown">
18-
<Story />
19-
</Canvas>
19+
## Basic Usage
2020

21-
## Properties
21+
<Primary />
2222

23-
<ArgTypes />
23+
## API Reference
24+
25+
### Props
26+
27+
<Controls />
28+
29+
## Code Examples
30+
31+
All examples below include their source code for easy copy-paste:
2432

2533
<Stories />

packages/manager-wiki/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
"@ovh-ux/muk": "^0.0.1",
1717
"@ovhcloud/ods-react": "^19.0.1",
1818
"@ovhcloud/ods-themes": "^19.0.1",
19+
"@tanstack/react-query": "^5.0.0",
1920
"@tanstack/react-table": "^8.10.0",
2021
"clsx": "^2.1.1",
22+
"i18next": "^23.0.0",
2123
"lz-string": "^1.5.0",
2224
"react": "^18.2.0",
2325
"react-docgen": "^8.0.2",
26+
"react-i18next": "^14.0.0",
2427
"react-router-dom": "^6.3.0",
2528
"sass": "1.56.1",
2629
"tailwindcss": "^3.4.4",

packages/manager-wiki/stories/manager-ui-kit/components/Breadcrumb/breadcrumb.stories.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ Basic.args = {
2323
hideRootLabel: false,
2424
};
2525

26+
Basic.parameters = {
27+
docs: {
28+
source: {
29+
code: `<Breadcrumb
30+
rootLabel="vRack Services"
31+
appName="vrack-services"
32+
hideRootLabel={false}
33+
/>`,
34+
},
35+
},
36+
};
37+
2638
export const HideRootLabel = BreadcrumbStory.bind({});
2739

2840
HideRootLabel.args = {
@@ -31,9 +43,22 @@ HideRootLabel.args = {
3143
hideRootLabel: true,
3244
};
3345

46+
HideRootLabel.parameters = {
47+
docs: {
48+
source: {
49+
code: `<Breadcrumb
50+
rootLabel="vRack Services"
51+
appName="vrack-services"
52+
hideRootLabel={true}
53+
/>`,
54+
},
55+
},
56+
};
57+
3458
export default {
3559
title: 'Manager UI Kit/Components/Breadcrumb',
3660
component: Breadcrumb,
61+
tags: ['autodocs'],
3762
decorators: [withRouter],
3863
parameters: {
3964
docs: {

packages/manager-wiki/stories/manager-ui-kit/components/Clipboard/clipboard.stories.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Clipboard } from '@ovh-ux/muk';
44
const meta: Meta<typeof Clipboard> = {
55
title: 'Manager UI Kit/Components/Clipboard',
66
component: Clipboard,
7+
tags: ['autodocs'],
78
};
89

910
type Story = StoryObj<typeof Clipboard>;
@@ -15,27 +16,64 @@ export const regular: Story = {
1516
loading: false,
1617
masked: false,
1718
},
19+
parameters: {
20+
docs: {
21+
source: {
22+
code: `<Clipboard value="Value to copy to clipboard" />`,
23+
},
24+
},
25+
},
1826
};
1927

2028
export const disabled: Story = {
2129
args: {
2230
value: 'Disabled clipboard',
2331
disabled: true,
2432
},
33+
parameters: {
34+
docs: {
35+
source: {
36+
code: `<Clipboard
37+
value="Disabled clipboard"
38+
disabled={true}
39+
/>`,
40+
},
41+
},
42+
},
2543
};
2644

2745
export const loading: Story = {
2846
args: {
2947
value: '',
3048
loading: true,
3149
},
50+
parameters: {
51+
docs: {
52+
source: {
53+
code: `<Clipboard
54+
value=""
55+
loading={true}
56+
/>`,
57+
},
58+
},
59+
},
3260
};
3361

3462
export const masked: Story = {
3563
args: {
3664
value: 'Secret Data',
3765
masked: true,
3866
},
67+
parameters: {
68+
docs: {
69+
source: {
70+
code: `<Clipboard
71+
value="Secret Data"
72+
masked={true}
73+
/>`,
74+
},
75+
},
76+
},
3977
};
4078

4179
export default meta;

packages/manager-wiki/stories/manager-ui-kit/components/Datagrid/datagrid.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ FullFooter.args = {
438438
const meta = {
439439
title: 'Manager UI Kit/Components/Datagrid New',
440440
component: Datagrid,
441+
tags: ['autodocs'],
441442
decorators: [withRouter],
442443
parameters: {
443444
docs: {

packages/manager-wiki/stories/manager-ui-kit/components/Drawer/Drawer.stories.tsx

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react';
22
import { Meta } from '@storybook/react';
33
import { Button } from '@ovh-ux/muk';
4+
import { DrawerBase } from '@ovh-ux/muk/src/components/drawer/drawer-base/DrawerBase.component';
45
import { DrawerContent } from './DrawerContent.component';
56
import { Content } from './mocks/Content.component';
67
import {
@@ -11,6 +12,8 @@ import {
1112

1213
const meta = {
1314
title: 'Manager UI Kit/Components/Drawer',
15+
component: DrawerBase,
16+
tags: ['autodocs'],
1417
args: {
1518
isOpen: false,
1619
isLoading: false,
@@ -38,7 +41,6 @@ const meta = {
3841
const [isOpen, setIsOpen] = useState(args.isOpen);
3942
const triggerDrawer = () => setIsOpen(!isOpen);
4043

41-
console.info('isOpen', isOpen);
4244
const title = args.title as string;
4345
return (
4446
<>
@@ -49,7 +51,9 @@ const meta = {
4951
<DrawerCollapsibleComposed
5052
{...args}
5153
isOpen={isOpen}
52-
onDismiss={() => alert('dismiss')}
54+
onDismiss={() => {
55+
// Dismiss action
56+
}}
5357
primaryButton={{
5458
...args.primaryButton,
5559
onClick: triggerDrawer,
@@ -88,6 +92,31 @@ export const Default: Meta<DrawerComposedProps> = {
8892
children: <div>Children drawer story</div>,
8993
content: <DrawerContent size="short" />,
9094
},
95+
parameters: {
96+
docs: {
97+
source: {
98+
code: `<Drawer.Root
99+
isOpen={isOpen}
100+
onDismiss={handleDismiss}
101+
>
102+
<Drawer.Header title="Classic Drawer" />
103+
<Drawer.Content>
104+
<div>Your drawer content here</div>
105+
</Drawer.Content>
106+
<Drawer.Footer
107+
primaryButton={{
108+
label: 'Confirm',
109+
onClick: handleConfirm,
110+
}}
111+
secondaryButton={{
112+
label: 'Cancel',
113+
onClick: handleCancel,
114+
}}
115+
/>
116+
</Drawer.Root>`,
117+
},
118+
},
119+
},
91120
};
92121

93122
export const ScrollableContent: Meta<DrawerComposedProps> = {
@@ -97,6 +126,31 @@ export const ScrollableContent: Meta<DrawerComposedProps> = {
97126
children: <div>Children scrollable drawer story</div>,
98127
content: <DrawerContent size="long" />,
99128
},
129+
parameters: {
130+
docs: {
131+
source: {
132+
code: `<Drawer.Root
133+
isOpen={isOpen}
134+
onDismiss={handleDismiss}
135+
>
136+
<Drawer.Header title="Scrollable Content" />
137+
<Drawer.Content>
138+
<div>Long scrollable content here...</div>
139+
</Drawer.Content>
140+
<Drawer.Footer
141+
primaryButton={{
142+
label: 'Confirm',
143+
onClick: handleConfirm,
144+
}}
145+
secondaryButton={{
146+
label: 'Cancel',
147+
onClick: handleCancel,
148+
}}
149+
/>
150+
</Drawer.Root>`,
151+
},
152+
},
153+
},
100154
};
101155

102156
export const Collapsible: Meta<DrawerComposedProps> = {
@@ -106,4 +160,29 @@ export const Collapsible: Meta<DrawerComposedProps> = {
106160
children: <div>Children Collapsible drawer story</div>,
107161
content: <DrawerContent size="short" />,
108162
},
163+
parameters: {
164+
docs: {
165+
source: {
166+
code: `<Drawer.RootCollapsible
167+
isOpen={isOpen}
168+
onDismiss={handleDismiss}
169+
>
170+
<Drawer.Header title="Collapsible Drawer" />
171+
<Drawer.Content>
172+
<div>Your drawer content here</div>
173+
</Drawer.Content>
174+
<Drawer.Footer
175+
primaryButton={{
176+
label: 'Confirm',
177+
onClick: handleConfirm,
178+
}}
179+
secondaryButton={{
180+
label: 'Cancel',
181+
onClick: handleCancel,
182+
}}
183+
/>
184+
</Drawer.RootCollapsible>`,
185+
},
186+
},
187+
},
109188
};

0 commit comments

Comments
 (0)