Skip to content

Commit cfcde3f

Browse files
committed
feat(toggle): accept font class and colors
1 parent 5817433 commit cfcde3f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/CustomToggle.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const CustomToggle = ({
99
label,
1010
disabled,
1111
colorTheme = 'rose',
12+
fontClass = '',
13+
labelColorClass = 'text-gray-300',
14+
hoverColorClass = 'group-hover:text-white',
1215
}) => {
1316
const themes = {
1417
rose: {
@@ -52,12 +55,12 @@ const CustomToggle = ({
5255

5356
return (
5457
<div
55-
className={`flex items-center justify-between w-full group py-2 ${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`}
58+
className={`flex items-center justify-between w-full group py-2 gap-4 ${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`}
5659
onClick={() => !disabled && onChange({ target: { checked: !checked } })}
5760
>
5861
<label
5962
htmlFor={id}
60-
className="text-base sm:text-lg text-gray-300 font-medium cursor-pointer select-none group-hover:text-white transition-colors duration-300"
63+
className={`text-base sm:text-lg font-medium cursor-pointer select-none transition-colors duration-300 ${labelColorClass} ${hoverColorClass} ${fontClass}`}
6164
onClick={(e) => e.stopPropagation()} // Prevent double toggle if label is clicked directly (though container click handles it)
6265
>
6366
{label}

0 commit comments

Comments
 (0)