aural-ui 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/input/Input.stories.tsx +3 -0
- package/dist/components/input/index.tsx +24 -0
- package/dist/components/search/Search.stories.tsx +7 -0
- package/dist/components/search/index.tsx +6 -0
- package/dist/components/slider/index.tsx +10 -0
- package/dist/components/switch/index.tsx +3 -3
- package/dist/components/thumbnail-tags/ThumbnailTags.stories.tsx +40 -11
- package/dist/components/thumbnail-tags/index.tsx +125 -21
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -80,10 +80,13 @@ type InputProps = {
|
|
|
80
80
|
className?: string
|
|
81
81
|
value?: string | number
|
|
82
82
|
defaultValue?: string | number
|
|
83
|
+
autoComplete?: string
|
|
84
|
+
autoFocus?: boolean
|
|
83
85
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
84
86
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void
|
|
85
87
|
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void
|
|
86
88
|
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void
|
|
89
|
+
ariaLabel?: string
|
|
87
90
|
startIcon?: ReactNode
|
|
88
91
|
endIcon?: ReactNode
|
|
89
92
|
id?: string
|
|
@@ -92,6 +95,7 @@ type InputProps = {
|
|
|
92
95
|
min?: number
|
|
93
96
|
max?: number
|
|
94
97
|
unstyled?: boolean
|
|
98
|
+
transparentOnAutofill?: boolean
|
|
95
99
|
classes?: {
|
|
96
100
|
root?: string
|
|
97
101
|
label?: string
|
|
@@ -208,6 +212,8 @@ const PasswordToggle = forwardRef<
|
|
|
208
212
|
</button>
|
|
209
213
|
))
|
|
210
214
|
|
|
215
|
+
PasswordToggle.displayName = "PasswordToggle"
|
|
216
|
+
|
|
211
217
|
// InputBase component - Core input functionality without any wrapper elements
|
|
212
218
|
const InputBase = forwardRef<
|
|
213
219
|
HTMLInputElement,
|
|
@@ -217,6 +223,7 @@ const InputBase = forwardRef<
|
|
|
217
223
|
disabled?: boolean
|
|
218
224
|
className?: string
|
|
219
225
|
unstyled?: boolean
|
|
226
|
+
ariaLabel?: string
|
|
220
227
|
type?: string
|
|
221
228
|
placeholder?: string
|
|
222
229
|
value?: string | number
|
|
@@ -231,6 +238,7 @@ const InputBase = forwardRef<
|
|
|
231
238
|
maxLength?: number
|
|
232
239
|
startIcon?: boolean // Indicates if start icon spacing should be applied
|
|
233
240
|
endIcon?: boolean // Indicates if end icon spacing should be applied
|
|
241
|
+
transparentOnAutofill?: boolean
|
|
234
242
|
} & Omit<
|
|
235
243
|
React.InputHTMLAttributes<HTMLInputElement>,
|
|
236
244
|
"onChange" | "onBlur" | "onFocus" | "defaultValue"
|
|
@@ -256,6 +264,8 @@ const InputBase = forwardRef<
|
|
|
256
264
|
maxLength,
|
|
257
265
|
startIcon = false,
|
|
258
266
|
endIcon = false,
|
|
267
|
+
ariaLabel,
|
|
268
|
+
transparentOnAutofill = false,
|
|
259
269
|
...props
|
|
260
270
|
},
|
|
261
271
|
ref
|
|
@@ -282,6 +292,16 @@ const InputBase = forwardRef<
|
|
|
282
292
|
// Determine focus state
|
|
283
293
|
const state = disabled ? "disabled" : isFocused ? "focused" : "default"
|
|
284
294
|
|
|
295
|
+
const autoFillStyle = transparentOnAutofill
|
|
296
|
+
? {
|
|
297
|
+
WebkitTextFillColor: "#ffffff",
|
|
298
|
+
color: "#ffffff",
|
|
299
|
+
caretColor: "#ffffff",
|
|
300
|
+
transition: "background-color 999999s ease-in-out 0s",
|
|
301
|
+
backgroundColor: "transparent",
|
|
302
|
+
}
|
|
303
|
+
: {}
|
|
304
|
+
|
|
285
305
|
// Apply styles only if not unstyled
|
|
286
306
|
const inputClassName = unstyled
|
|
287
307
|
? className
|
|
@@ -303,6 +323,7 @@ const InputBase = forwardRef<
|
|
|
303
323
|
ref={ref}
|
|
304
324
|
type={type}
|
|
305
325
|
id={id}
|
|
326
|
+
aria-label={ariaLabel}
|
|
306
327
|
name={name}
|
|
307
328
|
className={inputClassName}
|
|
308
329
|
placeholder={placeholder}
|
|
@@ -314,6 +335,7 @@ const InputBase = forwardRef<
|
|
|
314
335
|
onBlur={handleBlur}
|
|
315
336
|
required={required}
|
|
316
337
|
maxLength={maxLength}
|
|
338
|
+
style={autoFillStyle}
|
|
317
339
|
{...props}
|
|
318
340
|
/>
|
|
319
341
|
)
|
|
@@ -348,6 +370,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
348
370
|
decoration,
|
|
349
371
|
unstyled = false,
|
|
350
372
|
classes = {},
|
|
373
|
+
transparentOnAutofill = false,
|
|
351
374
|
...props
|
|
352
375
|
},
|
|
353
376
|
ref
|
|
@@ -428,6 +451,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
428
451
|
endIcon={!!(endIcon || type === "password")}
|
|
429
452
|
unstyled={unstyled}
|
|
430
453
|
className={unstyled ? className : classes.input}
|
|
454
|
+
transparentOnAutofill={transparentOnAutofill}
|
|
431
455
|
{...props}
|
|
432
456
|
/>
|
|
433
457
|
|
|
@@ -32,6 +32,7 @@ A comprehensive search input component with both controlled and uncontrolled mod
|
|
|
32
32
|
- **Dark Theme Optimized**: Default styling for dark interfaces
|
|
33
33
|
- **Accessibility**: Full keyboard navigation and screen reader support
|
|
34
34
|
- **Event Handling**: Separate onChange and onSearch callbacks
|
|
35
|
+
- **Input Ref Access**: Easily focus or manage the input programmatically
|
|
35
36
|
|
|
36
37
|
## Component Modes
|
|
37
38
|
|
|
@@ -40,11 +41,13 @@ Use \`value\`, \`onChange\`, and \`onSearch\` for external state management:
|
|
|
40
41
|
|
|
41
42
|
\`\`\`tsx
|
|
42
43
|
const [searchValue, setSearchValue] = useState("")
|
|
44
|
+
const inputRef = useRef<HTMLInputElement>(null)
|
|
43
45
|
|
|
44
46
|
<Search
|
|
45
47
|
value={searchValue}
|
|
46
48
|
onChange={setSearchValue}
|
|
47
49
|
onSearch={(query) => handleSearch(query)}
|
|
50
|
+
inputRef={inputRef}
|
|
48
51
|
/>
|
|
49
52
|
\`\`\`
|
|
50
53
|
|
|
@@ -52,9 +55,12 @@ const [searchValue, setSearchValue] = useState("")
|
|
|
52
55
|
Use \`initialValue\` and \`onSearch\` for internal state management:
|
|
53
56
|
|
|
54
57
|
\`\`\`tsx
|
|
58
|
+
const inputRef = useRef<HTMLInputElement>(null)
|
|
59
|
+
|
|
55
60
|
<Search
|
|
56
61
|
initialValue="initial search"
|
|
57
62
|
onSearch={(query) => handleSearch(query)}
|
|
63
|
+
inputRef={inputRef}
|
|
58
64
|
/>
|
|
59
65
|
\`\`\`
|
|
60
66
|
|
|
@@ -68,6 +74,7 @@ Use \`initialValue\` and \`onSearch\` for internal state management:
|
|
|
68
74
|
- **children**: Custom content for rendering results
|
|
69
75
|
- **placeholder**: Input placeholder text
|
|
70
76
|
- **className**: Additional CSS classes
|
|
77
|
+
- **inputRef**: Ref to access or focus the underlying input element
|
|
71
78
|
`,
|
|
72
79
|
},
|
|
73
80
|
},
|
|
@@ -14,11 +14,13 @@ export interface SearchProps {
|
|
|
14
14
|
placeholder?: string
|
|
15
15
|
className?: string
|
|
16
16
|
value?: string // Add value prop for controlled component
|
|
17
|
+
autoFocus?: boolean
|
|
17
18
|
onSearch?: (query: string) => void
|
|
18
19
|
onChange?: (value: string) => void // Add onChange for controlled component
|
|
19
20
|
results?: SearchResult[]
|
|
20
21
|
initialValue?: string
|
|
21
22
|
children?: React.ReactNode // Children can be used to render custom search results
|
|
23
|
+
inputRef?: React.RefObject<HTMLInputElement | null>
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export const Search = React.forwardRef<HTMLDivElement, SearchProps>(
|
|
@@ -27,11 +29,13 @@ export const Search = React.forwardRef<HTMLDivElement, SearchProps>(
|
|
|
27
29
|
placeholder = "Search episodes",
|
|
28
30
|
className = "",
|
|
29
31
|
value: controlledValue,
|
|
32
|
+
autoFocus = false,
|
|
30
33
|
onSearch,
|
|
31
34
|
onChange,
|
|
32
35
|
results = [],
|
|
33
36
|
initialValue = "",
|
|
34
37
|
children, // Children can be used to render custom search results
|
|
38
|
+
inputRef,
|
|
35
39
|
},
|
|
36
40
|
ref
|
|
37
41
|
) => {
|
|
@@ -99,8 +103,10 @@ export const Search = React.forwardRef<HTMLDivElement, SearchProps>(
|
|
|
99
103
|
>
|
|
100
104
|
{/* Search Input */}
|
|
101
105
|
<Input
|
|
106
|
+
ref={inputRef}
|
|
102
107
|
placeholder={placeholder}
|
|
103
108
|
value={value}
|
|
109
|
+
autoFocus={autoFocus}
|
|
104
110
|
onChange={handleChange}
|
|
105
111
|
onFocus={() => setIsFocused(true)}
|
|
106
112
|
onBlur={() => setIsFocused(false)}
|
|
@@ -70,6 +70,7 @@ interface SliderProps
|
|
|
70
70
|
showLabel?: boolean
|
|
71
71
|
label?: string
|
|
72
72
|
alignThumb?: "center" | "bottom" | "top"
|
|
73
|
+
ariaLabel?: string
|
|
73
74
|
classes?: {
|
|
74
75
|
root?: string
|
|
75
76
|
track?: string
|
|
@@ -89,6 +90,7 @@ function Slider({
|
|
|
89
90
|
showLabel = true,
|
|
90
91
|
label,
|
|
91
92
|
alignThumb = "bottom",
|
|
93
|
+
ariaLabel,
|
|
92
94
|
classes = {},
|
|
93
95
|
...props
|
|
94
96
|
}: SliderProps) {
|
|
@@ -102,6 +104,13 @@ function Slider({
|
|
|
102
104
|
[value, defaultValue, min, max]
|
|
103
105
|
)
|
|
104
106
|
|
|
107
|
+
const getThumbAriaLabel = (index: number, currentValue: number) => {
|
|
108
|
+
if (ariaLabel) {
|
|
109
|
+
return `${ariaLabel}, current value: ${currentValue}`
|
|
110
|
+
}
|
|
111
|
+
return `Slider control ${index + 1}, current value: ${currentValue}`
|
|
112
|
+
}
|
|
113
|
+
|
|
105
114
|
return (
|
|
106
115
|
<SliderPrimitive.Root
|
|
107
116
|
data-slot="slider"
|
|
@@ -145,6 +154,7 @@ function Slider({
|
|
|
145
154
|
<SliderPrimitive.Thumb
|
|
146
155
|
data-slot="slider-thumb"
|
|
147
156
|
key={index}
|
|
157
|
+
aria-label={getThumbAriaLabel(index, _values[index])}
|
|
148
158
|
className={cn(
|
|
149
159
|
"block shrink-0 transition-[color,box-shadow] hover:ring-2 focus-visible:ring-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50",
|
|
150
160
|
sliderThumbVariants({ size, variant }),
|
|
@@ -27,7 +27,7 @@ const switchVariants = {
|
|
|
27
27
|
root: "h-6 w-12",
|
|
28
28
|
thumb:
|
|
29
29
|
"size-4 data-[state=checked]:translate-x-6.5 data-[state=unchecked]:translate-x-1",
|
|
30
|
-
onIcon: "left-1 text-fm-xs",
|
|
30
|
+
onIcon: "p-1 left-1 text-fm-xs",
|
|
31
31
|
offIcon: "right-[5px] text-fm-xs",
|
|
32
32
|
},
|
|
33
33
|
md: {
|
|
@@ -79,7 +79,7 @@ const Switch = React.forwardRef<
|
|
|
79
79
|
"focus-visible:ring-fm-primary focus-visible:ring-offset-fm-green-50",
|
|
80
80
|
"hover:bg-fm-surface-secondary data-[state=unchecked]:not-[:disabled]:hover:bg-fm-surface-secondary",
|
|
81
81
|
"data-[state=unchecked]:not-[:disabled]:hover:border-fm-divider-primary",
|
|
82
|
-
"relative rounded-full border border-solid transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed",
|
|
82
|
+
"relative cursor-pointer rounded-full border border-solid transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed",
|
|
83
83
|
sizeConfig.root,
|
|
84
84
|
classNames?.root,
|
|
85
85
|
className
|
|
@@ -88,7 +88,7 @@ const Switch = React.forwardRef<
|
|
|
88
88
|
>
|
|
89
89
|
<span
|
|
90
90
|
className={clsx(
|
|
91
|
-
"font-fm-brand text-fm-positive absolute top-1/2 -translate-y-1/2",
|
|
91
|
+
"font-fm-brand text-fm-divider-positive absolute top-1/2 -translate-y-1/2",
|
|
92
92
|
{
|
|
93
93
|
"text-fm-positive-tert": disabled,
|
|
94
94
|
},
|
|
@@ -5,7 +5,7 @@ import ThumbnailTags from "."
|
|
|
5
5
|
|
|
6
6
|
type ThumbnailTagsProps = React.ComponentProps<typeof ThumbnailTags>
|
|
7
7
|
|
|
8
|
-
const meta: Meta<
|
|
8
|
+
const meta: Meta<typeof ThumbnailTags> = {
|
|
9
9
|
title: "Components/UI/ThumbnailTags",
|
|
10
10
|
component: ThumbnailTags,
|
|
11
11
|
parameters: {
|
|
@@ -28,6 +28,7 @@ const meta: Meta<ThumbnailTagsProps> = {
|
|
|
28
28
|
"top10",
|
|
29
29
|
"engagement",
|
|
30
30
|
"completed-series",
|
|
31
|
+
"ranked",
|
|
31
32
|
],
|
|
32
33
|
description:
|
|
33
34
|
"Determines the visual style and layout of the thumbnail tag",
|
|
@@ -44,8 +45,13 @@ const meta: Meta<ThumbnailTagsProps> = {
|
|
|
44
45
|
control: "text",
|
|
45
46
|
description: "The secondary text content for variant Engagement",
|
|
46
47
|
},
|
|
48
|
+
classNames: {
|
|
49
|
+
control: "object",
|
|
50
|
+
description:
|
|
51
|
+
"Custom CSS classes for the component elements (container, text, primaryText, secondaryText,svg)",
|
|
52
|
+
},
|
|
47
53
|
},
|
|
48
|
-
}
|
|
54
|
+
}
|
|
49
55
|
|
|
50
56
|
export default meta
|
|
51
57
|
type Story = StoryObj<ThumbnailTagsProps>
|
|
@@ -57,6 +63,13 @@ export const Default: Story = {
|
|
|
57
63
|
},
|
|
58
64
|
}
|
|
59
65
|
|
|
66
|
+
export const Ranked: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
variant: "ranked",
|
|
69
|
+
text: "#1 in hindi",
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
export const PromotionalTag = {
|
|
61
74
|
args: {
|
|
62
75
|
variant: "promotional",
|
|
@@ -98,7 +111,7 @@ export const AllVariants: Story = {
|
|
|
98
111
|
render: () => (
|
|
99
112
|
<div className="flex flex-col gap-6">
|
|
100
113
|
<div className="space-y-4">
|
|
101
|
-
<h3 className="text-lg font-semibold text-white">Promotional Tag</h3>
|
|
114
|
+
<h3 className="text-fm-lg font-semibold text-white">Promotional Tag</h3>
|
|
102
115
|
<div className="flex gap-4">
|
|
103
116
|
<ThumbnailTags variant="promotional" text="30% off" />
|
|
104
117
|
<ThumbnailTags variant="promotional" text="NEW" />
|
|
@@ -107,7 +120,7 @@ export const AllVariants: Story = {
|
|
|
107
120
|
</div>
|
|
108
121
|
|
|
109
122
|
<div className="space-y-4">
|
|
110
|
-
<h3 className="text-lg font-semibold text-white">Checked Tag</h3>
|
|
123
|
+
<h3 className="text-fm-lg font-semibold text-white">Checked Tag</h3>
|
|
111
124
|
<div className="flex gap-4">
|
|
112
125
|
<ThumbnailTags variant="checked" />
|
|
113
126
|
<ThumbnailTags variant="checked" />
|
|
@@ -116,7 +129,7 @@ export const AllVariants: Story = {
|
|
|
116
129
|
</div>
|
|
117
130
|
|
|
118
131
|
<div className="space-y-4">
|
|
119
|
-
<h3 className="text-lg font-semibold text-white">Engagement Tag</h3>
|
|
132
|
+
<h3 className="text-fm-lg font-semibold text-white">Engagement Tag</h3>
|
|
120
133
|
<div className="flex gap-4">
|
|
121
134
|
<ThumbnailTags
|
|
122
135
|
variant="engagement"
|
|
@@ -137,20 +150,27 @@ export const AllVariants: Story = {
|
|
|
137
150
|
</div>
|
|
138
151
|
|
|
139
152
|
<div className="space-y-4">
|
|
140
|
-
<h3 className="text-lg font-semibold text-white">Top 10 Tag</h3>
|
|
153
|
+
<h3 className="text-fm-lg font-semibold text-white">Top 10 Tag</h3>
|
|
141
154
|
<div className="flex gap-4">
|
|
142
155
|
<ThumbnailTags variant="top10" />
|
|
143
156
|
</div>
|
|
144
157
|
</div>
|
|
145
158
|
|
|
146
159
|
<div className="space-y-4">
|
|
147
|
-
<h3 className="text-lg font-semibold text-white">
|
|
160
|
+
<h3 className="text-fm-lg font-semibold text-white">
|
|
148
161
|
Completed Series Tag
|
|
149
162
|
</h3>
|
|
150
163
|
<div className="flex gap-4">
|
|
151
164
|
<ThumbnailTags variant="completed-series" />
|
|
152
165
|
</div>
|
|
153
166
|
</div>
|
|
167
|
+
|
|
168
|
+
<div className="space-y-4">
|
|
169
|
+
<h3 className="text-fm-lg font-semibold text-white">Ranked Tag</h3>
|
|
170
|
+
<div className="flex gap-4">
|
|
171
|
+
<ThumbnailTags variant="ranked" text="#1 show" />
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
154
174
|
</div>
|
|
155
175
|
),
|
|
156
176
|
}
|
|
@@ -163,7 +183,9 @@ export const UseCases: Story = {
|
|
|
163
183
|
render: () => (
|
|
164
184
|
<div className="space-y-8">
|
|
165
185
|
<div className="space-y-4">
|
|
166
|
-
<h3 className="text-lg font-semibold text-white">
|
|
186
|
+
<h3 className="text-fm-lg font-semibold text-white">
|
|
187
|
+
Promotional Tags
|
|
188
|
+
</h3>
|
|
167
189
|
<div className="flex gap-4">
|
|
168
190
|
<ThumbnailTags variant="promotional" text="30% off" />
|
|
169
191
|
<ThumbnailTags variant="promotional" text="FREE" />
|
|
@@ -172,14 +194,18 @@ export const UseCases: Story = {
|
|
|
172
194
|
</div>
|
|
173
195
|
|
|
174
196
|
<div className="space-y-4">
|
|
175
|
-
<h3 className="text-lg font-semibold text-white">
|
|
197
|
+
<h3 className="text-fm-lg font-semibold text-white">
|
|
198
|
+
Status Indicators
|
|
199
|
+
</h3>
|
|
176
200
|
<div className="flex gap-4">
|
|
177
201
|
<ThumbnailTags variant="checked" />
|
|
178
202
|
</div>
|
|
179
203
|
</div>
|
|
180
204
|
|
|
181
205
|
<div className="space-y-4">
|
|
182
|
-
<h3 className="text-lg font-semibold text-white">
|
|
206
|
+
<h3 className="text-fm-lg font-semibold text-white">
|
|
207
|
+
Engagement Metrics
|
|
208
|
+
</h3>
|
|
183
209
|
<div className="flex gap-4">
|
|
184
210
|
<ThumbnailTags
|
|
185
211
|
variant="engagement"
|
|
@@ -200,10 +226,13 @@ export const UseCases: Story = {
|
|
|
200
226
|
</div>
|
|
201
227
|
|
|
202
228
|
<div className="space-y-4">
|
|
203
|
-
<h3 className="text-lg font-semibold text-white">
|
|
229
|
+
<h3 className="text-fm-lg font-semibold text-white">
|
|
230
|
+
Achievement Badges
|
|
231
|
+
</h3>
|
|
204
232
|
<div className="flex gap-4">
|
|
205
233
|
<ThumbnailTags variant="top10" />
|
|
206
234
|
<ThumbnailTags variant="completed-series" />
|
|
235
|
+
<ThumbnailTags variant="ranked" text="#1 show" />
|
|
207
236
|
</div>
|
|
208
237
|
</div>
|
|
209
238
|
</div>
|
|
@@ -1,34 +1,117 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils"
|
|
2
5
|
|
|
3
6
|
type ThumbnailTagsProps =
|
|
4
7
|
| {
|
|
5
8
|
variant: "promotional"
|
|
6
9
|
text: string
|
|
10
|
+
classNames?: {
|
|
11
|
+
container?: string
|
|
12
|
+
text?: string
|
|
13
|
+
svg?: {
|
|
14
|
+
height?: number
|
|
15
|
+
width?: number
|
|
16
|
+
className?: string
|
|
17
|
+
}
|
|
18
|
+
}
|
|
7
19
|
}
|
|
8
20
|
| {
|
|
9
21
|
variant: "engagement"
|
|
10
22
|
primaryText: string
|
|
11
23
|
secondaryText: string
|
|
24
|
+
classNames?: {
|
|
25
|
+
container?: string
|
|
26
|
+
primaryText?: string
|
|
27
|
+
secondaryText?: string
|
|
28
|
+
svg?: {
|
|
29
|
+
height?: number
|
|
30
|
+
width?: number
|
|
31
|
+
className?: string
|
|
32
|
+
}
|
|
33
|
+
}
|
|
12
34
|
}
|
|
13
35
|
| {
|
|
14
36
|
variant: "checked" | "top10" | "completed-series"
|
|
37
|
+
classNames?: {
|
|
38
|
+
container?: string
|
|
39
|
+
svg?: {
|
|
40
|
+
height?: number
|
|
41
|
+
width?: number
|
|
42
|
+
className?: string
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
variant: "ranked"
|
|
48
|
+
text: string
|
|
49
|
+
classNames?: {
|
|
50
|
+
container?: string
|
|
51
|
+
text?: string
|
|
52
|
+
svg?: {
|
|
53
|
+
height?: number
|
|
54
|
+
width?: number
|
|
55
|
+
className?: string
|
|
56
|
+
}
|
|
57
|
+
}
|
|
15
58
|
}
|
|
16
59
|
|
|
17
60
|
export function ThumbnailTags(props: ThumbnailTagsProps) {
|
|
18
|
-
const { variant } = props
|
|
61
|
+
const { variant, classNames } = props
|
|
62
|
+
|
|
63
|
+
if (variant === "ranked") {
|
|
64
|
+
return (
|
|
65
|
+
<div className={cn("flex items-center", classNames?.container)}>
|
|
66
|
+
<p
|
|
67
|
+
//cn intentional not used, as it was breaking text-fm-primary
|
|
68
|
+
className={clsx(
|
|
69
|
+
"bg-fm-primary-500 text-fm-primary text-fm-md font-fm-brand flex px-1 py-0.5 uppercase",
|
|
70
|
+
classNames?.text
|
|
71
|
+
)}
|
|
72
|
+
style={{
|
|
73
|
+
clipPath: "polygon(99.5% 0, 0 0, 0 100%, 99.5% 100%, 100% 50%)",
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{props.text}
|
|
77
|
+
</p>
|
|
78
|
+
<svg
|
|
79
|
+
width={props.classNames?.svg?.width ?? 13.3}
|
|
80
|
+
height={props.classNames?.svg?.height ?? 25.3}
|
|
81
|
+
viewBox="0 0 11 23"
|
|
82
|
+
fill="none"
|
|
83
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
84
|
+
className={cn("-ml-[4.4px]", props.classNames?.svg?.className)}
|
|
85
|
+
>
|
|
86
|
+
<path
|
|
87
|
+
d="M0.849976 11.5L3.03162 23L4.54529 15.0215L5.50427 21.8496L6.95837 11.5L5.50427 1.15039L4.54529 7.97754L3.03162 0L0.849976 11.5ZM7.47498 11.5L8.20154 20.7002L8.92908 11.5L8.20154 2.2998L7.47498 11.5ZM9.44568 11.5L10.1722 17.25L10.8998 11.5L10.1722 5.75L9.44568 11.5Z"
|
|
88
|
+
fill="#FA2937"
|
|
89
|
+
/>
|
|
90
|
+
</svg>
|
|
91
|
+
</div>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
19
95
|
if (variant === "promotional") {
|
|
20
96
|
return (
|
|
21
|
-
<div className="flex h-4 w-14 gap-0.5">
|
|
22
|
-
<p
|
|
97
|
+
<div className={cn("flex h-4 w-14 gap-0.5", classNames?.container)}>
|
|
98
|
+
<p
|
|
99
|
+
//cn intentional not used, as it was breaking text-fm-neutral-100
|
|
100
|
+
className={clsx(
|
|
101
|
+
"bg-fm-neongreen-500 text-fm-neutral-100 font-fm-brand text-fm-xs w-11 text-center uppercase",
|
|
102
|
+
classNames?.text
|
|
103
|
+
)}
|
|
104
|
+
>
|
|
23
105
|
{props.text}
|
|
24
106
|
</p>
|
|
25
107
|
|
|
26
108
|
<svg
|
|
27
|
-
|
|
28
|
-
|
|
109
|
+
height={props.classNames?.svg?.height ?? 16}
|
|
110
|
+
width={props.classNames?.svg?.width ?? 12}
|
|
29
111
|
viewBox="0 0 12 16"
|
|
30
112
|
fill="none"
|
|
31
113
|
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
+
className={classNames?.svg?.className}
|
|
32
115
|
>
|
|
33
116
|
<g clipPath="url(#clip0_3_736)">
|
|
34
117
|
<rect
|
|
@@ -113,26 +196,28 @@ export function ThumbnailTags(props: ThumbnailTagsProps) {
|
|
|
113
196
|
</div>
|
|
114
197
|
)
|
|
115
198
|
}
|
|
199
|
+
|
|
116
200
|
if (variant === "checked") {
|
|
117
201
|
return (
|
|
118
202
|
<svg
|
|
119
|
-
width=
|
|
120
|
-
height=
|
|
203
|
+
width={props.classNames?.svg?.width ?? 29}
|
|
204
|
+
height={props.classNames?.svg?.height ?? 16}
|
|
121
205
|
viewBox="0 0 29 16"
|
|
122
206
|
fill="none"
|
|
123
207
|
xmlns="http://www.w3.org/2000/svg"
|
|
208
|
+
className={classNames?.svg?.className}
|
|
124
209
|
>
|
|
125
210
|
<g opacity="0.5">
|
|
126
211
|
<path
|
|
127
212
|
fillRule="evenodd"
|
|
128
213
|
clipRule="evenodd"
|
|
129
|
-
d="M12 15.5024C8.08937 15.2353 5 11.9784 5 7.99994C5 4.0215 8.08937 0.764629 12 0.
|
|
214
|
+
d="M12 15.5024C8.08937 15.2353 5 11.9784 5 7.99994C5 4.0215 8.08937 0.764629 12 0.497437V15.5024Z"
|
|
130
215
|
fill="#004719"
|
|
131
216
|
/>
|
|
132
217
|
<path
|
|
133
218
|
fillRule="evenodd"
|
|
134
219
|
clipRule="evenodd"
|
|
135
|
-
d="M4 12.9317C1.71552 12.4529 4.76837e-07 10.4268 4.76837e-07 7.99999C4.76837e-07 5.5732 1.71552 3.5471 4 3.
|
|
220
|
+
d="M4 12.9317C1.71552 12.4529 4.76837e-07 10.4268 4.76837e-07 7.99999C4.76837e-07 5.5732 1.71552 3.5471 4 3.06824V12.9317Z"
|
|
136
221
|
fill="#004719"
|
|
137
222
|
/>
|
|
138
223
|
</g>
|
|
@@ -149,25 +234,37 @@ export function ThumbnailTags(props: ThumbnailTagsProps) {
|
|
|
149
234
|
</svg>
|
|
150
235
|
)
|
|
151
236
|
}
|
|
237
|
+
|
|
152
238
|
if (variant === "engagement") {
|
|
153
239
|
return (
|
|
154
|
-
<div className="flex
|
|
240
|
+
<div className={cn("flex gap-0.5", classNames?.container)}>
|
|
155
241
|
<div className="bg-fm-primary-400 text-fm-primary font-fm-brand flex uppercase">
|
|
156
|
-
<p
|
|
242
|
+
<p
|
|
243
|
+
className={cn(
|
|
244
|
+
"text-fm-sm flex w-fit items-center justify-center px-1",
|
|
245
|
+
classNames?.primaryText
|
|
246
|
+
)}
|
|
247
|
+
>
|
|
157
248
|
{props.primaryText}
|
|
158
249
|
</p>
|
|
159
250
|
<div className="flex w-1.5 items-center justify-center">
|
|
160
|
-
<span
|
|
251
|
+
<span
|
|
252
|
+
className={cn(
|
|
253
|
+
"rotate-90 pt-1 text-[6px] leading-none whitespace-nowrap",
|
|
254
|
+
classNames?.secondaryText
|
|
255
|
+
)}
|
|
256
|
+
>
|
|
161
257
|
{props.secondaryText}
|
|
162
258
|
</span>
|
|
163
259
|
</div>
|
|
164
260
|
</div>
|
|
165
261
|
<svg
|
|
166
|
-
width=
|
|
167
|
-
height=
|
|
262
|
+
width={props.classNames?.svg?.width ?? 9}
|
|
263
|
+
height={props.classNames?.svg?.height ?? 16}
|
|
168
264
|
viewBox="0 0 9 16"
|
|
169
265
|
fill="none"
|
|
170
266
|
xmlns="http://www.w3.org/2000/svg"
|
|
267
|
+
className={classNames?.svg?.className}
|
|
171
268
|
>
|
|
172
269
|
<g clipPath="url(#clip0_17092_166916)">
|
|
173
270
|
<path
|
|
@@ -187,15 +284,16 @@ export function ThumbnailTags(props: ThumbnailTagsProps) {
|
|
|
187
284
|
</div>
|
|
188
285
|
)
|
|
189
286
|
}
|
|
190
|
-
|
|
287
|
+
|
|
191
288
|
if (variant === "top10") {
|
|
192
289
|
return (
|
|
193
290
|
<svg
|
|
194
|
-
width=
|
|
195
|
-
height=
|
|
291
|
+
width={props.classNames?.svg?.width ?? 28}
|
|
292
|
+
height={props.classNames?.svg?.height ?? 20}
|
|
196
293
|
viewBox="0 0 28 20"
|
|
197
294
|
fill="none"
|
|
198
295
|
xmlns="http://www.w3.org/2000/svg"
|
|
296
|
+
className={classNames?.svg?.className}
|
|
199
297
|
>
|
|
200
298
|
<g clipPath="url(#clip0_3_790)">
|
|
201
299
|
<path
|
|
@@ -228,15 +326,15 @@ export function ThumbnailTags(props: ThumbnailTagsProps) {
|
|
|
228
326
|
)
|
|
229
327
|
}
|
|
230
328
|
|
|
231
|
-
// completed series
|
|
232
329
|
if (variant === "completed-series") {
|
|
233
330
|
return (
|
|
234
331
|
<svg
|
|
235
|
-
width=
|
|
236
|
-
height=
|
|
332
|
+
width={props.classNames?.svg?.width ?? 136}
|
|
333
|
+
height={props.classNames?.svg?.height ?? 16}
|
|
237
334
|
viewBox="0 0 136 16"
|
|
238
335
|
fill="none"
|
|
239
336
|
xmlns="http://www.w3.org/2000/svg"
|
|
337
|
+
className={classNames?.svg?.className}
|
|
240
338
|
>
|
|
241
339
|
<g opacity="0.5">
|
|
242
340
|
<path
|
|
@@ -283,9 +381,15 @@ export function ThumbnailTags(props: ThumbnailTagsProps) {
|
|
|
283
381
|
</svg>
|
|
284
382
|
)
|
|
285
383
|
}
|
|
384
|
+
|
|
286
385
|
// Default version
|
|
287
386
|
return (
|
|
288
|
-
<p
|
|
387
|
+
<p
|
|
388
|
+
className={cn(
|
|
389
|
+
"bg-fm-neongreen-500 text-fm-neutral-100 font-fm-brand font-fm-xs text-fm-xs w-11 p-1 text-center uppercase",
|
|
390
|
+
classNames?.container
|
|
391
|
+
)}
|
|
392
|
+
>
|
|
289
393
|
30% off
|
|
290
394
|
</p>
|
|
291
395
|
)
|