Skip to content

Commit 15972ea

Browse files
authored
fix hidden decoration for Mesh product card on hover, when there is both <ExploreMainProductCards /> and <ToolsAndLibrariesCards /> on page (#1951)
1 parent de3ed3a commit 15972ea

File tree

7 files changed

+46
-180
lines changed

7 files changed

+46
-180
lines changed

.changeset/curvy-feet-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@theguild/components': patch
3+
---
4+
5+
fix hidden decoration for Mesh product card on hover, when there is both `<ExploreMainProductCards />` and `<ToolsAndLibrariesCards />` on page
Lines changed: 1 addition & 49 deletions
Loading
Lines changed: 1 addition & 27 deletions
Loading

packages/components/src/components/product-card/index.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useId } from 'react';
12
import { cn } from '../../cn';
23
import { FOUR_MAIN_PRODUCTS, ProductInfo, PRODUCTS } from '../../products';
34
import { HighlightDecoration } from '../decorations';
@@ -19,12 +20,13 @@ export function MainProductCard({ as: Root, product, className, ...rest }: Produ
1920
const Icon = product.logo;
2021

2122
const isHive = product.name === PRODUCTS.HIVE.name;
23+
const id = useId();
2224

2325
return (
2426
<Root
2527
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',
2830
className,
2931
)}
3032
{...rest}
@@ -40,11 +42,31 @@ export function MainProductCard({ as: Root, product, className, ...rest }: Produ
4042
<Decoration
4143
strokeWidth="0.5px"
4244
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',
4547
)}
46-
preserveAspectRatio="xMidYMid meet"
48+
fill={`url(#${id})`}
4749
/>
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>
4870
<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" />
4971
</Root>
5072
);
Lines changed: 1 addition & 49 deletions
Loading

0 commit comments

Comments
 (0)