Skip to content

Commit 1e40624

Browse files
committed
Refactor GroupsPage stories
1 parent 64ee732 commit 1e40624

File tree

3 files changed

+51
-55
lines changed

3 files changed

+51
-55
lines changed
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
import { Story } from "@storybook/react";
2-
import {
3-
CreateGroupPageView,
4-
CreateGroupPageViewProps,
5-
} from "./CreateGroupPageView";
1+
import { CreateGroupPageView } from "./CreateGroupPageView";
2+
import type { Meta, StoryObj } from "@storybook/react";
63

7-
export default {
4+
const meta: Meta<typeof CreateGroupPageView> = {
85
title: "pages/CreateGroupPageView",
96
component: CreateGroupPageView,
107
};
118

12-
const Template: Story<CreateGroupPageViewProps> = (
13-
args: CreateGroupPageViewProps,
14-
) => <CreateGroupPageView {...args} />;
9+
export default meta;
10+
type Story = StoryObj<typeof CreateGroupPageView>;
1511

16-
export const Example = Template.bind({});
17-
Example.args = {};
12+
export const Example: Story = {};
Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,51 @@
1-
import { Story } from "@storybook/react";
21
import { MockGroup } from "testHelpers/entities";
3-
import { GroupsPageView, GroupsPageViewProps } from "./GroupsPageView";
2+
import { GroupsPageView } from "./GroupsPageView";
3+
import type { Meta, StoryObj } from "@storybook/react";
44

5-
export default {
5+
const meta: Meta<typeof GroupsPageView> = {
66
title: "pages/GroupsPageView",
77
component: GroupsPageView,
88
};
99

10-
const Template: Story<GroupsPageViewProps> = (args: GroupsPageViewProps) => (
11-
<GroupsPageView {...args} />
12-
);
10+
export default meta;
11+
type Story = StoryObj<typeof GroupsPageView>;
1312

14-
export const NotEnabled = Template.bind({});
15-
NotEnabled.args = {
16-
groups: [MockGroup],
17-
canCreateGroup: true,
18-
isTemplateRBACEnabled: false,
13+
export const NotEnabled: Story = {
14+
args: {
15+
groups: [MockGroup],
16+
canCreateGroup: true,
17+
isTemplateRBACEnabled: false,
18+
},
1919
};
2020

21-
export const WithGroups = Template.bind({});
22-
WithGroups.args = {
23-
groups: [MockGroup],
24-
canCreateGroup: true,
25-
isTemplateRBACEnabled: true,
21+
export const WithGroups: Story = {
22+
args: {
23+
groups: [MockGroup],
24+
canCreateGroup: true,
25+
isTemplateRBACEnabled: true,
26+
},
2627
};
2728

28-
export const WithDisplayGroup = Template.bind({});
29-
WithGroups.args = {
30-
groups: [{ ...MockGroup, name: "front-end" }],
31-
canCreateGroup: true,
32-
isTemplateRBACEnabled: true,
29+
export const WithDisplayGroup: Story = {
30+
args: {
31+
groups: [{ ...MockGroup, name: "front-end" }],
32+
canCreateGroup: true,
33+
isTemplateRBACEnabled: true,
34+
},
3335
};
3436

35-
export const EmptyGroup = Template.bind({});
36-
EmptyGroup.args = {
37-
groups: [],
38-
canCreateGroup: false,
39-
isTemplateRBACEnabled: true,
37+
export const EmptyGroup: Story = {
38+
args: {
39+
groups: [],
40+
canCreateGroup: false,
41+
isTemplateRBACEnabled: true,
42+
},
4043
};
4144

42-
export const EmptyGroupWithPermission = Template.bind({});
43-
EmptyGroupWithPermission.args = {
44-
groups: [],
45-
canCreateGroup: true,
46-
isTemplateRBACEnabled: true,
45+
export const EmptyGroupWithPermission: Story = {
46+
args: {
47+
groups: [],
48+
canCreateGroup: true,
49+
isTemplateRBACEnabled: true,
50+
},
4751
};
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
import { Story } from "@storybook/react";
21
import { MockGroup } from "testHelpers/entities";
3-
import {
4-
SettingsGroupPageView,
5-
SettingsGroupPageViewProps,
6-
} from "./SettingsGroupPageView";
2+
import { SettingsGroupPageView } from "./SettingsGroupPageView";
3+
import type { Meta, StoryObj } from "@storybook/react";
74

8-
export default {
5+
const meta: Meta<typeof SettingsGroupPageView> = {
96
title: "pages/SettingsGroupPageView",
107
component: SettingsGroupPageView,
118
};
129

13-
const Template: Story<SettingsGroupPageViewProps> = (
14-
args: SettingsGroupPageViewProps,
15-
) => <SettingsGroupPageView {...args} />;
10+
export default meta;
11+
type Story = StoryObj<typeof SettingsGroupPageView>;
1612

17-
export const Example = Template.bind({});
18-
Example.args = {
19-
group: MockGroup,
20-
isLoading: false,
13+
export const Example: Story = {
14+
args: {
15+
group: MockGroup,
16+
isLoading: false,
17+
},
2118
};

0 commit comments

Comments
 (0)