Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit c73f2a2

Browse files
author
Jonathan Bursztyn
committed
refactor
1 parent 7340b65 commit c73f2a2

File tree

2 files changed

+45
-18
lines changed

2 files changed

+45
-18
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { iconColorVariants } from "@babylonlabs-io/core-ui";
2+
import { twJoin } from "tailwind-merge";
3+
4+
interface ThreeDotsMenuIconProps {
5+
className?: string;
6+
size?: number;
7+
/** Same variants supported by other icons */
8+
variant?: keyof typeof iconColorVariants;
9+
/** Tailwind className to force a color */
10+
color?: string;
11+
}
12+
13+
export const ThreeDotsMenuIcon = ({
14+
className = "",
15+
size = 20,
16+
variant = "default",
17+
color,
18+
}: ThreeDotsMenuIconProps) => {
19+
const colorClass = color || iconColorVariants[variant];
20+
21+
return (
22+
<svg
23+
style={{ width: size, height: size }}
24+
viewBox="0 0 20 20"
25+
fill="none"
26+
xmlns="http://www.w3.org/2000/svg"
27+
className={twJoin(
28+
"transition-opacity duration-200",
29+
colorClass,
30+
className,
31+
)}
32+
>
33+
<path
34+
d="M4.99967 8.33203C4.08301 8.33203 3.33301 9.08203 3.33301 9.9987C3.33301 10.9154 4.08301 11.6654 4.99967 11.6654C5.91634 11.6654 6.66634 10.9154 6.66634 9.9987C6.66634 9.08203 5.91634 8.33203 4.99967 8.33203ZM14.9997 8.33203C14.083 8.33203 13.333 9.08203 13.333 9.9987C13.333 10.9154 14.083 11.6654 14.9997 11.6654C15.9163 11.6654 16.6663 10.9154 16.6663 9.9987C16.6663 9.08203 15.9163 8.33203 14.9997 8.33203ZM9.99967 8.33203C9.08301 8.33203 8.33301 9.08203 8.33301 9.9987C8.33301 10.9154 9.08301 11.6654 9.99967 11.6654C10.9163 11.6654 11.6663 10.9154 11.6663 9.9987C11.6663 9.08203 10.9163 8.33203 9.99967 8.33203Z"
35+
fill="currentColor"
36+
/>
37+
</svg>
38+
);
39+
};

src/ui/common/components/ThreeDotsMenu/ThreeDotsMenu.tsx

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { Popover, Text } from "@babylonlabs-io/core-ui";
2-
import { useTheme } from "next-themes";
3-
import { useEffect, useState } from "react";
2+
import { useState } from "react";
43

5-
import threeDotsDark from "@/ui/common/assets/three-dots-black.svg";
6-
import threeDotsLight from "@/ui/common/assets/three-dots.svg";
4+
import { ThreeDotsMenuIcon } from "@/ui/common/components/Icons/common/ThreeDotsMenuIcon";
75

86
interface ThreeDotsMenuProps {
97
onChange: () => void;
@@ -18,12 +16,6 @@ export const ThreeDotsMenu = ({
1816
}: ThreeDotsMenuProps) => {
1917
const [open, setOpen] = useState(false);
2018
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
21-
const { resolvedTheme } = useTheme();
22-
const [mounted, setMounted] = useState(false);
23-
24-
useEffect(() => {
25-
setMounted(true);
26-
}, []);
2719

2820
return (
2921
<>
@@ -33,14 +25,10 @@ export const ThreeDotsMenu = ({
3325
className={className}
3426
aria-label="Open options"
3527
>
36-
{mounted && (
37-
<img
38-
src={resolvedTheme === "light" ? threeDotsDark : threeDotsLight}
39-
alt="options"
40-
width={20}
41-
height={20}
42-
/>
43-
)}
28+
<ThreeDotsMenuIcon
29+
size={20}
30+
className="text-accent-primary dark:text-white"
31+
/>
4432
</button>
4533

4634
<Popover

0 commit comments

Comments
 (0)