diff --git a/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx b/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx index 31c9f4269e48d..963e3d4067f0b 100644 --- a/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx +++ b/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx @@ -55,7 +55,7 @@ export const LicenseBannerView: FC = ({ if (messages.length === 1) { return (
- + {Language.licenseIssue}
{messages[0]}   @@ -73,7 +73,7 @@ export const LicenseBannerView: FC = ({ return (
- + {Language.licenseIssues(messages.length)}
{Language.exceeded} diff --git a/site/src/components/Dashboard/ServiceBanner/ServiceBannerView.tsx b/site/src/components/Dashboard/ServiceBanner/ServiceBannerView.tsx index b2b30ecb46d70..b76b517f9e745 100644 --- a/site/src/components/Dashboard/ServiceBanner/ServiceBannerView.tsx +++ b/site/src/components/Dashboard/ServiceBanner/ServiceBannerView.tsx @@ -17,7 +17,7 @@ export const ServiceBannerView: FC = ({ }) => { return (
- {isPreview && } + {isPreview && Preview}
= { title: "components/Pill", @@ -11,55 +12,63 @@ type Story = StoryObj; export const Default: Story = { args: { - text: "Default", + children: "Default", }, }; export const Danger: Story = { args: { - text: "Danger", + children: "Danger", type: "danger", }, }; export const Error: Story = { args: { - text: "Error", + children: "Error", type: "error", }, }; export const Warning: Story = { args: { - text: "Warning", + children: "Warning", type: "warning", }, }; export const Notice: Story = { args: { - text: "Notice", + children: "Notice", type: "notice", }, }; export const Info: Story = { args: { - text: "Information", + children: "Information", type: "info", }, }; export const Success: Story = { args: { - text: "Success", + children: "Success", type: "success", }, }; export const Active: Story = { args: { - text: "Active", + children: "Active", type: "active", }, }; + +export const WithIcon: Story = { + args: { + children: "Information", + type: "info", + icon: , + }, +}; diff --git a/site/src/components/Pill/Pill.tsx b/site/src/components/Pill/Pill.tsx index edfc88c0a5490..fd4c9558c2565 100644 --- a/site/src/components/Pill/Pill.tsx +++ b/site/src/components/Pill/Pill.tsx @@ -1,16 +1,19 @@ -import { type FC, type ReactNode, useMemo, forwardRef } from "react"; -import { css, useTheme, type Interpolation, type Theme } from "@emotion/react"; +import { + type FC, + type ReactNode, + useMemo, + forwardRef, + HTMLAttributes, +} from "react"; +import { useTheme, type Interpolation, type Theme } from "@emotion/react"; import type { ThemeRole } from "theme/experimental"; export type PillType = ThemeRole | keyof typeof themeOverrides; -export interface PillProps { - className?: string; +export type PillProps = HTMLAttributes & { icon?: ReactNode; - text: ReactNode; type?: PillType; - title?: string; -} +}; const themeOverrides = { neutral: (theme) => ({ @@ -27,11 +30,14 @@ const themeStyles = (type: ThemeRole) => (theme: Theme) => { }; }; +const PILL_HEIGHT = 24; +const PILL_ICON_SIZE = 14; +const PILL_ICON_SPACING = (PILL_HEIGHT - PILL_ICON_SIZE) / 2; + export const Pill: FC = forwardRef( (props, ref) => { - const { icon, text = null, type = "neutral", ...attrs } = props; + const { icon, type = "neutral", children, ...divProps } = props; const theme = useTheme(); - const typeStyles = useMemo(() => { if (type in themeOverrides) { return themeOverrides[type as keyof typeof themeOverrides]; @@ -44,47 +50,33 @@ export const Pill: FC = forwardRef( ref={ref} css={[ { + fontSize: 12, + color: theme.experimental.l1.text, cursor: "default", display: "inline-flex", alignItems: "center", + whiteSpace: "nowrap", + fontWeight: 400, borderWidth: 1, borderStyle: "solid", borderRadius: 99999, - fontSize: 12, - color: theme.experimental.l1.text, - height: 24, - paddingLeft: icon ? 6 : 12, + lineHeight: 1, + height: PILL_HEIGHT, + gap: PILL_ICON_SPACING, paddingRight: 12, - whiteSpace: "nowrap", - fontWeight: 400, + paddingLeft: icon ? PILL_ICON_SPACING : 12, + + "& svg": { + width: PILL_ICON_SIZE, + height: PILL_ICON_SIZE, + }, }, typeStyles, ]} - role="status" - {...attrs} + {...divProps} > - {icon && ( -
img, - & > svg { - width: 14px; - height: 14px; - } - `} - > - {icon} -
- )} - {text} + {icon} + {children}
); }, diff --git a/site/src/components/TemplateExampleCard/TemplateExampleCard.tsx b/site/src/components/TemplateExampleCard/TemplateExampleCard.tsx index e5151880eb753..1a92a18ed6c26 100644 --- a/site/src/components/TemplateExampleCard/TemplateExampleCard.tsx +++ b/site/src/components/TemplateExampleCard/TemplateExampleCard.tsx @@ -57,7 +57,6 @@ export const TemplateExampleCard = (props: TemplateExampleCardProps) => { return ( ({ borderColor: isActive ? theme.palette.primary.main @@ -70,7 +69,9 @@ export const TemplateExampleCard = (props: TemplateExampleCardProps) => { borderColor: theme.palette.primary.main, }, })} - /> + > + {tag} + ); })} diff --git a/site/src/components/WorkspaceStatusBadge/WorkspaceStatusBadge.tsx b/site/src/components/WorkspaceStatusBadge/WorkspaceStatusBadge.tsx index 00aced41ad3f6..73c53e72b84e4 100644 --- a/site/src/components/WorkspaceStatusBadge/WorkspaceStatusBadge.tsx +++ b/site/src/components/WorkspaceStatusBadge/WorkspaceStatusBadge.tsx @@ -47,13 +47,15 @@ export const WorkspaceStatusBadge: FC = ({ } placement="top" > -
- -
+ + {text} + - + + {text} + ); @@ -95,11 +97,13 @@ export const DormantStatusBadge: FC = ({ } > } - text="Deletion Pending" type="error" - /> + > + Deletion Pending + ) : ( = ({ } > } - text="Dormant" type="warning" - /> + > + Dormant + ); }; diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx index 91a37b80a6a29..9859117b58416 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx @@ -138,8 +138,9 @@ export const AuditLogRow: React.FC = ({ + > + {auditLog.status_code.toString()} + diff --git a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx index 73b1c5b379c6d..39886bf18e15a 100644 --- a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx +++ b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx @@ -86,7 +86,9 @@ export const LicenseCard = ({ new Date(license.claims.license_expires * 1000), new Date(), ) < 1 ? ( - + + Expired + ) : ( Valid Until )} diff --git a/site/src/pages/TemplatePage/TemplatePageHeader.tsx b/site/src/pages/TemplatePage/TemplatePageHeader.tsx index dab4423f074b0..90515523e1af2 100644 --- a/site/src/pages/TemplatePage/TemplatePageHeader.tsx +++ b/site/src/pages/TemplatePage/TemplatePageHeader.tsx @@ -216,7 +216,7 @@ export const TemplatePageHeader: FC = ({ )}
- {template.deprecated && } + {template.deprecated && Deprecated} diff --git a/site/src/pages/TemplatePage/TemplateVersionsPage/VersionRow.tsx b/site/src/pages/TemplatePage/TemplateVersionsPage/VersionRow.tsx index af8110c7ad5b9..03491fc3da2d9 100644 --- a/site/src/pages/TemplatePage/TemplateVersionsPage/VersionRow.tsx +++ b/site/src/pages/TemplatePage/TemplateVersionsPage/VersionRow.tsx @@ -75,19 +75,36 @@ export const VersionRow: FC = ({ - {isActive && } - {isLatest && } - + {isActive && ( + + Active + + )} + {isLatest && ( + + Newest + + )} {jobStatus === "pending" && ( - Pending…} type="warning" /> + + Pending… + )} {jobStatus === "running" && ( - Building…} type="warning" /> + + Building… + )} {(jobStatus === "canceling" || jobStatus === "canceled") && ( - + + Canceled + + )} + {jobStatus === "failed" && ( + + Failed + )} - {jobStatus === "failed" && } {showActions && ( <> diff --git a/site/src/pages/TemplateVersionEditorPage/TemplateVersionStatusBadge.tsx b/site/src/pages/TemplateVersionEditorPage/TemplateVersionStatusBadge.tsx index 4fa2046d93815..e9e470b09a4c7 100644 --- a/site/src/pages/TemplateVersionEditorPage/TemplateVersionStatusBadge.tsx +++ b/site/src/pages/TemplateVersionEditorPage/TemplateVersionStatusBadge.tsx @@ -10,12 +10,9 @@ export const TemplateVersionStatusBadge: FC<{ }> = ({ version }) => { const { text, icon, type } = getStatus(version); return ( - + + {text} + ); }; diff --git a/site/src/pages/UsersPage/UsersTable/UserRoleCell.tsx b/site/src/pages/UsersPage/UsersTable/UserRoleCell.tsx index 5ad5c148fa606..6340f8e31fe54 100644 --- a/site/src/pages/UsersPage/UsersTable/UserRoleCell.tsx +++ b/site/src/pages/UsersPage/UsersTable/UserRoleCell.tsx @@ -71,7 +71,6 @@ export const UserRoleCell: FC = ({ )} = ({ ? theme.experimental.roles.info.outline : theme.experimental.l2.outline, }} - /> + > + {mainDisplayRole.display_name} + {extraRoles.length > 0 && } @@ -99,12 +100,13 @@ const OverflowRolePill: FC = ({ roles }) => { + > + {`+${roles.length} more`} + = ({ roles }) => { {roles.map((role) => ( + > + {role.display_name || role.name} + ))} diff --git a/site/src/pages/WorkspacePage/ChangeVersionDialog.tsx b/site/src/pages/WorkspacePage/ChangeVersionDialog.tsx index ec8b2c45777b5..248e7fc2c43c5 100644 --- a/site/src/pages/WorkspacePage/ChangeVersionDialog.tsx +++ b/site/src/pages/WorkspacePage/ChangeVersionDialog.tsx @@ -106,7 +106,7 @@ export const ChangeVersionDialog: FC = ({ )} {template?.active_version_id === option.id && ( - + Active )} }