Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19f544a

Browse files
committed
🍒
1 parent 08f7774 commit 19f544a

File tree

8 files changed

+39
-90
lines changed

8 files changed

+39
-90
lines changed

site/src/components/Callout/Callout.stories.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ export const Active: Story = {
5858
},
5959
};
6060

61-
// export const InfoLight: Story = {
62-
// args: {
63-
// children: "Information",
64-
// type: "info",
65-
// lightBorder: true,
66-
// },
67-
// };
68-
6961
export const Default: Story = {
7062
args: {
7163
children: "Neutral/default",
@@ -77,11 +69,3 @@ export const DefaultLight: Story = {
7769
children: "Neutral/default",
7870
},
7971
};
80-
81-
// export const WarningLight: Story = {
82-
// args: {
83-
// children: "Warning",
84-
// type: "warning",
85-
// lightBorder: true,
86-
// },
87-
// };

site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const LicenseBannerView: React.FC<LicenseBannerViewProps> = ({
5656
if (messages.length === 1) {
5757
return (
5858
<div css={containerStyles}>
59-
<Pill text={Language.licenseIssue} type={type} lightBorder />
59+
<Pill text={Language.licenseIssue} type={type} />
6060
<div css={styles.leftContent}>
6161
<span>{messages[0]}</span>
6262
&nbsp;
@@ -70,11 +70,7 @@ export const LicenseBannerView: React.FC<LicenseBannerViewProps> = ({
7070

7171
return (
7272
<div css={containerStyles}>
73-
<Pill
74-
text={Language.licenseIssues(messages.length)}
75-
type={type}
76-
lightBorder
77-
/>
73+
<Pill text={Language.licenseIssues(messages.length)} type={type} />
7874
<div css={styles.leftContent}>
7975
<div>
8076
{Language.exceeded}

site/src/components/Dashboard/ServiceBanner/ServiceBannerView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const ServiceBannerView: React.FC<ServiceBannerViewProps> = ({
4242
}
4343
`}
4444
>
45-
{isPreview && <Pill text="Preview" type="info" lightBorder />}
45+
{isPreview && <Pill text="Preview" type="info" />}
4646
<div
4747
css={css`
4848
margin-right: auto;

site/src/components/DeploySettingsLayout/Option.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,12 @@ import CheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined";
33
import { css, useTheme } from "@emotion/react";
44
import type { PropsWithChildren, FC } from "react";
55
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
6-
import { DisabledBadge, EnabledBadge } from "./Badges";
6+
import { DisabledBadge, EnabledBadge } from "../Badges/Badges";
77

88
export const OptionName: FC<PropsWithChildren> = (props) => {
99
const { children } = props;
1010

11-
return (
12-
<span
13-
css={{
14-
display: "block",
15-
}}
16-
>
17-
{children}
18-
</span>
19-
);
11+
return <span css={{ display: "block" }}>{children}</span>;
2012
};
2113

2214
export const OptionDescription: FC<PropsWithChildren> = (props) => {

site/src/components/Pill/Pill.stories.tsx

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,24 @@ const meta: Meta<typeof Pill> = {
99
export default meta;
1010
type Story = StoryObj<typeof Pill>;
1111

12-
export const Danger: Story = {
12+
export const Primary: Story = {
1313
args: {
14-
text: "Danger",
15-
type: "danger",
14+
text: "Primary",
15+
type: "primary",
1616
},
1717
};
1818

19-
export const Error: Story = {
19+
export const Secondary: Story = {
2020
args: {
21-
text: "Error",
22-
type: "error",
21+
text: "Secondary",
22+
type: "secondary",
2323
},
2424
};
2525

26-
export const Warning: Story = {
27-
args: {
28-
text: "Warning",
29-
type: "warning",
30-
},
31-
};
32-
33-
export const Notice: Story = {
26+
export const Success: Story = {
3427
args: {
35-
text: "Notice",
36-
type: "notice",
28+
text: "Success",
29+
type: "success",
3730
},
3831
};
3932

@@ -44,22 +37,22 @@ export const Info: Story = {
4437
},
4538
};
4639

47-
export const Success: Story = {
40+
export const Warning: Story = {
4841
args: {
49-
text: "Success",
50-
type: "success",
42+
text: "Warning",
43+
type: "warning",
5144
},
5245
};
5346

54-
export const Active: Story = {
47+
export const Error: Story = {
5548
args: {
56-
text: "Active",
57-
type: "active",
49+
text: "Error",
50+
type: "error",
5851
},
5952
};
6053

6154
export const Default: Story = {
6255
args: {
63-
text: "Neutral/default",
56+
text: "Default",
6457
},
6558
};

site/src/components/Pill/Pill.tsx

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,34 @@ export interface PillProps {
1616
icon?: ReactNode;
1717
text: ReactNode;
1818
type?: PillType;
19-
lightBorder?: boolean;
2019
title?: string;
2120
}
2221

2322
const themeOverrides = {
24-
primary: (lightBorder) => ({
25-
backgroundColor: colors.blue[13],
26-
borderColor: lightBorder ? colors.blue[5] : colors.blue[7],
27-
}),
28-
secondary: (lightBorder) => ({
29-
backgroundColor: colors.indigo[13],
30-
borderColor: lightBorder ? colors.indigo[6] : colors.indigo[8],
31-
}),
32-
neutral: (lightBorder) => ({
23+
neutral: {
3324
backgroundColor: colors.gray[13],
34-
borderColor: lightBorder ? colors.gray[6] : colors.gray[8],
35-
}),
36-
} satisfies Record<string, (lightBorder?: boolean) => Interpolation<Theme>>;
25+
borderColor: colors.gray[6],
26+
},
27+
} satisfies Record<string, Interpolation<Theme>>;
3728

38-
const themeStyles =
39-
(type: PillType, lightBorder?: boolean) => (theme: Theme) => {
40-
const palette = theme.palette[type];
41-
return {
42-
backgroundColor: palette.dark,
43-
borderColor: lightBorder ? palette.light : palette.main,
44-
};
29+
const themeStyles = (type: PillType) => (theme: Theme) => {
30+
const palette = theme.palette[type];
31+
return {
32+
backgroundColor: palette.dark,
33+
borderColor: palette.main,
4534
};
35+
};
4636

4737
export const Pill: FC<PillProps> = forwardRef<HTMLDivElement, PillProps>(
4838
(props, ref) => {
49-
const {
50-
lightBorder,
51-
icon,
52-
text = null,
53-
type = "neutral",
54-
...attrs
55-
} = props;
39+
const { icon, text = null, type = "neutral", ...attrs } = props;
5640

5741
const typeStyles = useMemo(() => {
5842
if (type in themeOverrides) {
59-
return themeOverrides[type as keyof typeof themeOverrides](lightBorder);
43+
return themeOverrides[type as keyof typeof themeOverrides];
6044
}
61-
return themeStyles(type, lightBorder);
62-
}, [type, lightBorder]);
45+
return themeStyles(type);
46+
}, [type]);
6347

6448
return (
6549
<div

site/src/pages/TemplatePage/TemplateVersionsPage/VersionRow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ export const VersionRow: React.FC<VersionRowProps> = ({
8080
{isLatest && <Pill text="Newest" type="info" />}
8181

8282
{jobStatus === "pending" && (
83-
<Pill text={<>Pending&hellip;</>} type="warning" lightBorder />
83+
<Pill text={<>Pending&hellip;</>} type="warning" />
8484
)}
8585
{jobStatus === "running" && (
86-
<Pill text={<>Building&hellip;</>} type="warning" lightBorder />
86+
<Pill text={<>Building&hellip;</>} type="warning" />
8787
)}
8888
{(jobStatus === "canceling" || jobStatus === "canceled") && (
89-
<Pill text="Canceled" type="neutral" lightBorder />
89+
<Pill text="Canceled" type="neutral" />
9090
)}
9191
{jobStatus === "failed" && <Pill text="Failed" type="error" />}
9292

site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const ProxyRow: FC<{
6464
textAlign: "right",
6565
color: (theme) =>
6666
latency
67-
? getLatencyColor(latency.latencyMS)
67+
? getLatencyColor(theme, latency.latencyMS)
6868
: theme.palette.text.secondary,
6969
}}
7070
>

0 commit comments

Comments
 (0)