Skip to content
/ ably-ui Public

Commit 22d092f

Browse files
committed
feat: Add IconClassName in the ProductTile
1 parent b7408be commit 22d092f

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/core/ProductTile.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ export type ProductTileProps = {
4343
*/
4444
labelClassName?: string;
4545

46+
/**
47+
* Additional CSS class names to apply to the product icon.
48+
*/
49+
iconClassName?: string;
50+
4651
/**
4752
* Callback function to handle click events on the product tile.
4853
*/
54+
4955
onClick?: () => void;
5056

5157
/**
@@ -87,6 +93,7 @@ const ProductTile = ({
8793
animateIcons = false,
8894
descriptionClassName,
8995
labelClassName,
96+
iconClassName,
9097
}: ProductTileProps) => {
9198
const { icon, hoverIcon, label, description, link, unavailable } =
9299
products[name] ?? {};
@@ -141,6 +148,7 @@ const ProductTile = ({
141148
hoverName={animateIcons ? hoverIcon : undefined}
142149
selected={selected}
143150
unavailable={!!unavailable}
151+
className={iconClassName}
144152
/>
145153
<ProductLabel
146154
label={label}

src/core/ProductTile/ProductIcon.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type ProductIconProps = {
99
selected?: boolean;
1010
size: number;
1111
unavailable: boolean;
12+
className?: string;
1213
};
1314

1415
const ProductIcon = ({
@@ -17,6 +18,7 @@ const ProductIcon = ({
1718
selected,
1819
size,
1920
unavailable,
21+
className,
2022
}: ProductIconProps) => {
2123
if (!name) {
2224
return null;
@@ -29,8 +31,11 @@ const ProductIcon = ({
2931
// Outer container, contains the gradient stroke (since we can't natively have CSS gradient strokes)
3032

3133
<span
32-
className="flex items-center justify-center border border-neutral-300 dark:border-neutral-1000 rounded-xl
33-
bg-neutral-100 dark:bg-neutral-1200 hover:bg-neutral-000 dark:hover:bg-neutral-1300 active:bg-neutral-000 dark:active:bg-neutral-1300"
34+
className={cn(
35+
"flex items-center justify-center border border-neutral-300 dark:border-neutral-1000 rounded-xl",
36+
"bg-neutral-100 dark:bg-neutral-1200 hover:bg-neutral-000 dark:hover:bg-neutral-1300 active:bg-neutral-000 dark:active:bg-neutral-1300",
37+
className,
38+
)}
3439
style={{ width: size, height: size }}
3540
>
3641
{/* The product icons themselves */}

0 commit comments

Comments
 (0)