Skip to content

Commit b4523d3

Browse files
committed
Refactor UserAuthSettingsPageView stories
1 parent b4d04ed commit b4523d3

File tree

1 file changed

+61
-41
lines changed

1 file changed

+61
-41
lines changed
Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
import { ComponentMeta, Story } from "@storybook/react";
2-
import {
3-
UserAuthSettingsPageView,
4-
UserAuthSettingsPageViewProps,
5-
} from "./UserAuthSettingsPageView";
1+
import { DeploymentGroup } from "api/types";
2+
import { UserAuthSettingsPageView } from "./UserAuthSettingsPageView";
3+
import type { Meta, StoryObj } from "@storybook/react";
64

7-
export default {
5+
const oidcGroup: DeploymentGroup = {
6+
name: "OIDC",
7+
description: "",
8+
children: [] as DeploymentGroup[],
9+
};
10+
11+
const ghGroup: DeploymentGroup = {
12+
name: "Networking",
13+
description: "",
14+
children: [] as DeploymentGroup[],
15+
};
16+
17+
const meta: Meta<typeof UserAuthSettingsPageView> = {
818
title: "pages/UserAuthSettingsPageView",
919
component: UserAuthSettingsPageView,
1020
args: {
@@ -13,91 +23,101 @@ export default {
1323
name: "OIDC Client ID",
1424
description: "Client ID to use for Login with OIDC.",
1525
value: "1234",
16-
group: {
17-
name: "OIDC",
18-
},
26+
group: oidcGroup,
27+
flag: "oidc",
28+
flag_shorthand: "o",
29+
hidden: false,
1930
},
2031
{
2132
name: "OIDC Allow Signups",
2233
description: "Whether new users can sign up with OIDC.",
2334
value: true,
24-
group: {
25-
name: "OIDC",
26-
},
35+
group: oidcGroup,
36+
flag: "oidc",
37+
flag_shorthand: "o",
38+
hidden: false,
2739
},
2840
{
2941
name: "OIDC Email Domain",
3042
description:
3143
"Email domains that clients logging in with OIDC must match.",
3244
value: "@coder.com",
33-
group: {
34-
name: "OIDC",
35-
},
45+
group: oidcGroup,
46+
flag: "oidc",
47+
flag_shorthand: "o",
48+
hidden: false,
3649
},
3750
{
3851
name: "OIDC Issuer URL",
3952
description: "Issuer URL to use for Login with OIDC.",
4053
value: "https://coder.com",
41-
group: {
42-
name: "OIDC",
43-
},
54+
group: oidcGroup,
55+
flag: "oidc",
56+
flag_shorthand: "o",
57+
hidden: false,
4458
},
4559
{
4660
name: "OIDC Scopes",
4761
description: "Scopes to grant when authenticating with OIDC.",
4862
value: ["idk"],
49-
group: {
50-
name: "OIDC",
51-
},
63+
group: oidcGroup,
64+
flag: "oidc",
65+
flag_shorthand: "o",
66+
hidden: false,
5267
},
5368
{
5469
name: "OAuth2 GitHub Client ID",
5570
description: "Client ID for Login with GitHub.",
5671
value: "1224",
57-
group: {
58-
name: "GitHub",
59-
},
72+
group: ghGroup,
73+
flag: "oidc",
74+
flag_shorthand: "o",
75+
hidden: false,
6076
},
6177
{
6278
name: "OAuth2 GitHub Allow Signups",
6379
description: "Whether new users can sign up with GitHub.",
6480
value: true,
65-
group: {
66-
name: "GitHub",
67-
},
81+
group: ghGroup,
82+
flag: "oidc",
83+
flag_shorthand: "o",
84+
hidden: false,
6885
},
6986
{
7087
name: "OAuth2 GitHub Enterprise Base URL",
7188
description:
7289
"Base URL of a GitHub Enterprise deployment to use for Login with GitHub.",
7390
value: "https://google.com",
74-
group: {
75-
name: "GitHub",
76-
},
91+
group: ghGroup,
92+
flag: "oidc",
93+
flag_shorthand: "o",
94+
hidden: false,
7795
},
7896
{
7997
name: "OAuth2 GitHub Allowed Orgs",
8098
description:
8199
"Organizations the user must be a member of to Login with GitHub.",
82100
value: true,
83-
group: {
84-
name: "GitHub",
85-
},
101+
group: ghGroup,
102+
flag: "oidc",
103+
flag_shorthand: "o",
104+
hidden: false,
86105
},
87106
{
88107
name: "OAuth2 GitHub Allowed Teams",
89108
description:
90109
"Teams inside organizations the user must be a member of to Login with GitHub. Structured as: <organization-name>/<team-slug>.",
91110
value: true,
92-
group: {
93-
name: "GitHub",
94-
},
111+
group: ghGroup,
112+
flag: "oidc",
113+
flag_shorthand: "o",
114+
hidden: false,
95115
},
96116
],
97117
},
98-
} as ComponentMeta<typeof UserAuthSettingsPageView>;
118+
};
119+
120+
export default meta;
121+
type Story = StoryObj<typeof UserAuthSettingsPageView>;
99122

100-
const Template: Story<UserAuthSettingsPageViewProps> = (args) => (
101-
<UserAuthSettingsPageView {...args} />
102-
);
103-
export const Page = Template.bind({});
123+
export const Page: Story = {};

0 commit comments

Comments
 (0)