Skip to content

Commit 230aa1d

Browse files
committed
chore: add xs size for badge
1 parent c7308c3 commit 230aa1d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

site/src/components/FeatureBadge/FeatureBadge.stories.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,14 @@ export const LargeStaticBeta: Story = {
4343
variant: "static",
4444
},
4545
};
46+
47+
// While it's possible, we shouldn't use the xs size with the interactive
48+
// variant, because then the badge might be too small for users with motor
49+
// control issues to get their hand to hover over the target reliably
50+
export const ExtraSmallStaticBeta: Story = {
51+
args: {
52+
type: "beta",
53+
size: "xs",
54+
variant: "static",
55+
},
56+
};

site/src/components/FeatureBadge/FeatureBadge.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ const styles = {
5555
fontSize: "1rem",
5656
},
5757

58+
badgeExtraSmallText: {
59+
fontSize: "0.625rem",
60+
},
61+
5862
tooltipTitle: (theme) => ({
5963
color: theme.palette.text.primary,
6064
fontWeight: 600,
@@ -80,7 +84,7 @@ const styles = {
8084
type FeatureBadgeProps = Readonly<
8185
Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
8286
type: keyof typeof featureBadgeTypes;
83-
size?: "sm" | "lg";
87+
size?: "xs" | "sm" | "lg";
8488
variant: "interactive" | "static";
8589
}
8690
>;
@@ -116,6 +120,7 @@ export const FeatureBadge: FC<FeatureBadgeProps> = ({
116120
<span
117121
css={[
118122
styles.badge,
123+
size === "xs" && styles.badgeExtraSmallText,
119124
size === "lg" && styles.badgeLargeText,
120125
showBadgeHoverStyle && styles.badgeHover,
121126
]}

site/src/modules/dashboard/Navbar/DeploymentDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const DeploymentDropdownContent: FC<DeploymentDropdownProps> = ({
110110
onClick={onPopoverClose}
111111
>
112112
Organizations
113-
<FeatureBadge type="beta" size="sm" variant="static" />
113+
<FeatureBadge type="beta" size="xs" variant="static" />
114114
</MenuItem>
115115
)}
116116
{canViewAllUsers && (

0 commit comments

Comments
 (0)