File tree Expand file tree Collapse file tree 2 files changed +3
-73
lines changed
site/src/components/FeatureBadge Expand file tree Collapse file tree 2 files changed +3
-73
lines changed Original file line number Diff line number Diff line change 1
- import { useTheme } from "@emotion/react" ;
2
1
import type { Meta , StoryObj } from "@storybook/react" ;
3
- import { useState } from "react" ;
4
2
import { FeatureBadge } from "./FeatureBadge" ;
5
3
6
4
const meta : Meta < typeof FeatureBadge > = {
@@ -45,45 +43,3 @@ export const LargeStaticBeta: Story = {
45
43
variant : "static" ,
46
44
} ,
47
45
} ;
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
- } ;
Original file line number Diff line number Diff line change @@ -81,39 +81,14 @@ type FeatureBadgeProps = Readonly<
81
81
Omit < HTMLAttributes < HTMLSpanElement > , "children" > & {
82
82
type : keyof typeof featureBadgeTypes ;
83
83
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
+ }
110
86
> ;
111
87
112
88
export const FeatureBadge : FC < FeatureBadgeProps > = ( {
113
89
type,
114
90
size = "sm" ,
115
91
variant = "interactive" ,
116
- highlighted = false ,
117
92
onPointerEnter,
118
93
onPointerLeave,
119
94
...delegatedProps
@@ -135,8 +110,7 @@ export const FeatureBadge: FC<FeatureBadgeProps> = ({
135
110
136
111
const featureType = featureBadgeTypes [ type ] ;
137
112
const showBadgeHoverStyle =
138
- highlighted ||
139
- ( variant === "interactive" && ( isBadgeHovering || isTooltipHovering ) ) ;
113
+ variant === "interactive" && ( isBadgeHovering || isTooltipHovering ) ;
140
114
141
115
const coreContent = (
142
116
< span
You can’t perform that action at this time.
0 commit comments