Skip to content

Commit 9649fd5

Browse files
authored
docs(Storybook): migrate deprecated APIs & fix ObjectPage action bug (#7103)
1 parent 9c90bcc commit 9649fd5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.storybook/main.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,10 @@ const config: StorybookConfig = {
7272
}
7373
],
7474
addons,
75-
docs: {
76-
autodocs: true
77-
},
7875
typescript: {
7976
reactDocgen: 'react-docgen-typescript'
8077
},
81-
staticDirs: [isDevMode && 'images-dev', 'images'].filter(Boolean)
78+
staticDirs: [isDevMode && 'images-dev', !isDevMode && 'images'].filter(Boolean)
8279
};
8380

8481
export default config;

.storybook/preview.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ const preview: Preview = {
156156
}
157157
},
158158
chromatic: { pauseAnimationAtEnd: true }
159-
}
159+
},
160+
tags: ['autodocs']
160161
};
161162

162163
export default preview;

packages/main/src/components/ObjectPage/ObjectPage.stories.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ type Story = StoryObj<typeof meta>;
126126
export const Default: Story = {
127127
render(args) {
128128
return (
129-
<ObjectPage {...args}>
129+
// `onBeforeNavigate` has to be called like this, otherwise it's invoked two times for some reason.
130+
<ObjectPage {...args} onBeforeNavigate={args.onBeforeNavigate}>
130131
<ObjectPageSection titleText="Goals" id="goals" aria-label="Goals">
131132
<Form layout="S1 M2 L3 XL3" labelSpan="S12 M12 L12 XL12">
132133
<FormItem labelContent={<Label showColon>Evangelize the UI framework across the company</Label>}>
@@ -305,7 +306,7 @@ export const SectionWithCustomHeader: Story = {
305306
name: 'section with custom header',
306307
render(args) {
307308
return (
308-
<ObjectPage {...args}>
309+
<ObjectPage {...args} onBeforeNavigate={args.onBeforeNavigate}>
309310
<ObjectPageSection
310311
titleText="Goals"
311312
hideTitleText
@@ -349,7 +350,7 @@ export const FullScreenSingleSection: Story = {
349350
name: 'with fullscreen section',
350351
render(args) {
351352
return (
352-
<ObjectPage {...args} mode={ObjectPageMode.IconTabBar}>
353+
<ObjectPage {...args} mode={ObjectPageMode.IconTabBar} onBeforeNavigate={args.onBeforeNavigate}>
353354
<ObjectPageSection titleText="Section 1" id="section1" style={{ height: '100%' }}>
354355
<div style={{ height: '100%', background: 'lightblue' }}>
355356
It is recommended to only use fullscreen sections in TabBar mode, otherwise your layout will most probably
@@ -378,6 +379,7 @@ export const LegacyToolbarSupport: Story = {
378379
return (
379380
<ObjectPage
380381
{...args}
382+
onBeforeNavigate={args.onBeforeNavigate}
381383
ref={objectPageRef}
382384
titleArea={
383385
<ObjectPageTitle

0 commit comments

Comments
 (0)