Skip to content

Commit 505f24b

Browse files
committed
🧹
1 parent 421ab68 commit 505f24b

File tree

4 files changed

+44
-37
lines changed

4 files changed

+44
-37
lines changed

site/src/components/DeploySettingsLayout/Option.tsx

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import type { HTMLAttributes, PropsWithChildren, FC } from "react";
44
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
55
import { DisabledBadge, EnabledBadge } from "../Badges/Badges";
66

7-
export const OptionName: FC<PropsWithChildren> = (props) => {
8-
const { children } = props;
9-
7+
export const OptionName: FC<PropsWithChildren> = ({ children }) => {
108
return <span css={{ display: "block" }}>{children}</span>;
119
};
1210

13-
export const OptionDescription: FC<PropsWithChildren> = (props) => {
14-
const { children } = props;
11+
export const OptionDescription: FC<PropsWithChildren> = ({ children }) => {
1512
const theme = useTheme();
1613

1714
return (
@@ -36,31 +33,20 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
3633
const { children: value } = props;
3734
const theme = useTheme();
3835

39-
const optionStyles = css`
40-
font-size: 14px;
41-
font-family: ${MONOSPACE_FONT_FAMILY};
42-
overflow-wrap: anywhere;
43-
user-select: all;
44-
45-
& ul {
46-
padding: 16px;
47-
}
48-
`;
49-
5036
if (typeof value === "boolean") {
5137
return value ? <EnabledBadge /> : <DisabledBadge />;
5238
}
5339

5440
if (typeof value === "number") {
55-
return <span css={optionStyles}>{value}</span>;
41+
return <span css={styles.option}>{value}</span>;
5642
}
5743

5844
if (!value || value.length === 0) {
59-
return <span css={optionStyles}>Not set</span>;
45+
return <span css={styles.option}>Not set</span>;
6046
}
6147

6248
if (typeof value === "string") {
63-
return <span css={optionStyles}>{value}</span>;
49+
return <span css={styles.option}>{value}</span>;
6450
}
6551

6652
if (typeof value === "object" && !Array.isArray(value)) {
@@ -72,7 +58,7 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
7258
<li
7359
key={option}
7460
css={[
75-
optionStyles,
61+
styles.option,
7662
!isEnabled && {
7763
marginLeft: 32,
7864
color: theme.palette.text.disabled,
@@ -107,24 +93,27 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
10793
return (
10894
<ul css={{ listStylePosition: "inside" }}>
10995
{value.map((item) => (
110-
<li key={item} css={optionStyles}>
96+
<li key={item} css={styles.option}>
11197
{item}
11298
</li>
11399
))}
114100
</ul>
115101
);
116102
}
117103

118-
return <span css={optionStyles}>{JSON.stringify(value)}</span>;
104+
return <span css={styles.option}>{JSON.stringify(value)}</span>;
119105
};
120106

121107
interface OptionConfigProps extends HTMLAttributes<HTMLDivElement> {
122108
source?: boolean;
123109
}
124110

125111
// OptionConfig takes a source bool to indicate if the Option is the source of the configured value.
126-
export const OptionConfig = (props: OptionConfigProps) => {
127-
const { children, source, ...attrs } = props;
112+
export const OptionConfig: FC<OptionConfigProps> = ({
113+
children,
114+
source,
115+
...attrs
116+
}) => {
128117
const theme = useTheme();
129118
const borderColor = source
130119
? theme.palette.primary.main
@@ -156,8 +145,11 @@ interface OptionConfigFlagProps extends HTMLAttributes<HTMLDivElement> {
156145
source?: boolean;
157146
}
158147

159-
export const OptionConfigFlag = (props: OptionConfigFlagProps) => {
160-
const { children, source, ...attrs } = props;
148+
export const OptionConfigFlag: FC<OptionConfigFlagProps> = ({
149+
children,
150+
source,
151+
...attrs
152+
}) => {
161153
const theme = useTheme();
162154

163155
return (
@@ -178,3 +170,16 @@ export const OptionConfigFlag = (props: OptionConfigFlagProps) => {
178170
</div>
179171
);
180172
};
173+
174+
const styles = {
175+
option: css`
176+
font-size: 14px;
177+
font-family: ${MONOSPACE_FONT_FAMILY};
178+
overflow-wrap: anywhere;
179+
user-select: all;
180+
181+
& ul {
182+
padding: 16px;
183+
}
184+
`,
185+
};

site/src/pages/UserSettingsPage/AccountPage/AccountPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Stack } from "@mui/system";
22
import { type FC } from "react";
33
import { useQuery } from "react-query";
4-
import { useMe } from "hooks/useMe";
54
import { useOrganizationId } from "hooks";
5+
import { useMe } from "hooks/useMe";
66
import { usePermissions } from "hooks/usePermissions";
77
import { groupsForUser } from "api/queries/groups";
88
import { useAuth } from "components/AuthProvider/AuthProvider";

site/src/pages/UserSettingsPage/AccountPage/AccountUserGroups.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1+
import Grid from "@mui/material/Grid";
12
import { useTheme } from "@emotion/react";
3+
import { type FC } from "react";
24
import { isApiError } from "api/errors";
3-
import { type Group } from "api/typesGenerated";
4-
5+
import type { Group } from "api/typesGenerated";
56
import { ErrorAlert } from "components/Alert/ErrorAlert";
67
import { AvatarCard } from "components/AvatarCard/AvatarCard";
78
import { Loader } from "components/Loader/Loader";
89
import { Section } from "components/SettingsLayout/Section";
9-
import Grid from "@mui/material/Grid";
1010

1111
type AccountGroupsProps = {
1212
groups: readonly Group[] | undefined;
1313
error: unknown;
1414
loading: boolean;
1515
};
1616

17-
export function AccountUserGroups({
17+
export const AccountUserGroups: FC<AccountGroupsProps> = ({
1818
groups,
1919
error,
2020
loading,
21-
}: AccountGroupsProps) {
21+
}) => {
2222
const theme = useTheme();
2323

2424
return (
@@ -71,4 +71,4 @@ export function AccountUserGroups({
7171
</div>
7272
</Section>
7373
);
74-
}
74+
};

site/src/pages/WorkspacesPage/WorkspacesButton.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ const WorkspaceResultsRow: FC<WorkspaceResultsRowProps> = ({ template }) => {
179179
);
180180
};
181181

182-
function PopoverLink(props: RouterLinkProps) {
182+
const PopoverLink: FC<RouterLinkProps> = ({ children, ...linkProps }) => {
183183
return (
184184
<RouterLink
185-
{...props}
185+
{...linkProps}
186186
css={(theme) => ({
187187
color: theme.palette.text.primary,
188188
padding: "8px 16px",
@@ -197,9 +197,11 @@ function PopoverLink(props: RouterLinkProps) {
197197
backgroundColor: theme.palette.action.hover,
198198
},
199199
})}
200-
/>
200+
>
201+
{children}
202+
</RouterLink>
201203
);
202-
}
204+
};
203205

204206
function sortTemplatesByUsersDesc(
205207
templates: readonly Template[],

0 commit comments

Comments
 (0)