1
+ import { useId } from 'react' ;
1
2
import { cn } from '../../cn' ;
2
3
import { FOUR_MAIN_PRODUCTS , ProductInfo , PRODUCTS } from '../../products' ;
3
4
import { HighlightDecoration } from '../decorations' ;
@@ -19,12 +20,13 @@ export function MainProductCard({ as: Root, product, className, ...rest }: Produ
19
20
const Icon = product . logo ;
20
21
21
22
const isHive = product . name === PRODUCTS . HIVE . name ;
23
+ const id = useId ( ) ;
22
24
23
25
return (
24
26
< Root
25
27
className = { cn (
26
- 'hive-focus-within group relative flex-1 shrink-0 basis-[283.5px] overflow-hidden rounded-2xl bg-blue-400 text-green-1000 max-md:w-[283.5px]' ,
27
- isHive && 'bg-green-1000 text-white' ,
28
+ 'hive-focus-within group relative flex-1 shrink-0 basis-[283.5px] overflow-hidden rounded-2xl max-md:w-[283.5px]' ,
29
+ isHive ? 'bg-green-1000 text-white' : 'bg-blue-400 text-green-1000 ',
28
30
className ,
29
31
) }
30
32
{ ...rest }
@@ -40,11 +42,31 @@ export function MainProductCard({ as: Root, product, className, ...rest }: Produ
40
42
< Decoration
41
43
strokeWidth = "0.5px"
42
44
className = { cn (
43
- 'pointer-events-none absolute bottom-0 right-0 h-full fill-blue-200 opacity-0 transition-opacity duration-500 group-focus-within:opacity-100 group-hover:opacity-100 ' ,
44
- isHive && 'fill-blue-700 ',
45
+ 'stroke-white/70 ' ,
46
+ 'pointer-events-none absolute bottom-0 right-0 h-full opacity-0 transition-opacity duration-500 group-focus-within:opacity-100 group-hover:opacity-100 ',
45
47
) }
46
- preserveAspectRatio = "xMidYMid meet"
48
+ fill = { `url(# ${ id } )` }
47
49
/>
50
+ < svg
51
+ // To remove from layout, but we can't use `display: none` because it breaks the gradient
52
+ className = "size-0"
53
+ >
54
+ < defs >
55
+ < linearGradient id = { id } x1 = "1" y1 = "2" x2 = "161" y2 = "171" gradientUnits = "userSpaceOnUse" >
56
+ { isHive ? (
57
+ < >
58
+ < stop stopColor = "#3b736a" />
59
+ < stop offset = "1" stopColor = "#245850" />
60
+ </ >
61
+ ) : (
62
+ < >
63
+ < stop stopColor = "white" stopOpacity = "0.1" />
64
+ < stop offset = "1" stopColor = "white" stopOpacity = "0.4" />
65
+ </ >
66
+ ) }
67
+ </ linearGradient >
68
+ </ defs >
69
+ </ svg >
48
70
< HighlightDecoration className = "pointer-events-none absolute left-0 top-[-15%] h-[150%] w-full opacity-0 transition-opacity duration-1000 group-focus-within:opacity-100 group-hover:opacity-100" />
49
71
</ Root >
50
72
) ;
0 commit comments