8000 chore: remove API for controlling FeatureBadge hover styling externally · coder/coder@c7308c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7308c3

Browse files
committed
chore: remove API for controlling FeatureBadge hover styling externally
1 parent da31c84 commit c7308c3

File tree

2 files changed

+3
-73
lines changed

2 files changed

+3
-73
lines changed
Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { useTheme } from "@emotion/react";
21
import type { Meta, StoryObj } from "@storybook/react";
3-
import { useState } from "react";
42
import { FeatureBadge } from "./FeatureBadge";
53

64
const meta: Meta<typeof FeatureBadge> = {
@@ -45,45 +43,3 @@ export const LargeStaticBeta: Story = {
4543
variant: "static",
4644
},
4745
};
48-
49-
export const HoverControlledByParent: Story = {
50-
args: {
51-
type: "experimental",
52-
size: "sm",
53-
},
54-
55-
decorators: (Story, context) => {
56-
const theme = useTheme();
57-
const [isHovering, setIsHovering] = useState(false);
58-
59-
return (
60-
<button
61-
type="button"
62-
onPointerEnter={() => setIsHovering(true)}
63-
onPointerLeave={() => setIsHovering(false)}
64-
css={[
65-
{
66-
backgroundColor: theme.palette.background.default,
67-
color: theme.palette.text.primary,
68-
display: "flex",
69-
flexFlow: "row nowrap",
70-
alignItems: "center",
71-
columnGap: "16px",
72-
},
73-
isHovering && {
74-
backgroundColor: "green",
75-
},
76-
]}
77-
>
78-
<span>Blah</span>
79-
{Story({
80-
args: {
81-
...context.initialArgs,
82-
variant: "static",
83-
highlighted: isHovering,
84-
},
85-
})}
86-
</button>
87-
);
88-
},
89-
};

site/src/components/FeatureBadge/FeatureBadge.tsx

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,39 +81,14 @@ type FeatureBadgeProps = Readonly<
8181
Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
8282
type: keyof typeof featureBadgeTypes;
8383
size?: "sm" | "lg";
84-
} & (
85-
| {
86-
/**
87-
* Defines whether the FeatureBadge should respond directly
88-
* to user input (displaying tooltips, controlling its own
89-
* hover styling, etc.)
90-
*/
91-
variant: "static";
92-
93-
/**
94-
* When used with the static variant, this lets you define
95-
* whether the component should display hover/highlighted
96-
* styling. Useful for coordinating hover behavior with an
97-
* outside component.
98-
*/
99-
highlighted?: boolean;
100-
}
101-
| {
102-
variant: "interactive";
103-
104-
// Had to specify the highlighted key for this union option
105-
// even though it won't be used, because otherwise the type
106-
// ergonomics for users would be too clunky.
107-
highlighted?: undefined;
108-
}
109-
)
84+
variant: "interactive" | "static";
85+
}
11086
>;
11187

11288
export const FeatureBadge: FC<FeatureBadgeProps> = ({
11389
type,
11490
size = "sm",
11591
variant = "interactive",
116-
highlighted = false,
11792
onPointerEnter,
11893
onPointerLeave,
11994
...delegatedProps
@@ -135,8 +110,7 @@ export const FeatureBadge: FC<FeatureBadgeProps> = ({
135110

136111
const featureType = featureBadgeTypes[type];
137112
const showBadgeHoverStyle =
138-
highlighted ||
139-
(variant === "interactive" && (isBadgeHovering || isTooltipHovering));
113+
variant === "interactive" && (isBadgeHovering || isTooltipHovering);
140114

141115
const coreContent = (
142116
<span

0 commit comments

Comments
 (0)
0