Skip to content

Commit

Permalink
fix: update color classNames
Browse files Browse the repository at this point in the history
  • Loading branch information
severinlandolt committed Apr 12, 2024
1 parent efb24b9 commit 993407d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
12 changes: 5 additions & 7 deletions src/components/input-elements/Tabs/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function getVariantStyles(tabVariant: TabVariant, color?: Color) {
// common
"border-transparent border rounded-tremor-small px-2.5 py-1",
// light
"ui-selected:border-tremor-border ui-selected:bg-tremor-background ui-selected:shadow-tremor-input hover:text-tremor-content-emphasis ui-selected:text-tremor-brand",
"ui-selected:border-tremor-border ui-selected:bg-tremor-background ui-selected:shadow-tremor-input ui-not-selected:hover:text-tremor-content-emphasis ui-selected:text-tremor-brand ui-not-selected:text-tremor-content",
// dark
"dark:ui-selected:border-dark-tremor-border dark:ui-selected:bg-dark-tremor-background dark:ui-selected:shadow-dark-tremor-input dark:hover:text-dark-tremor-content-emphasis dark:ui-selected:text-dark-tremor-brand dark:ui-not-selected:text-dark-tremor-content",
"dark:ui-selected:border-dark-tremor-border dark:ui-selected:bg-dark-tremor-background dark:ui-selected:shadow-dark-tremor-input dark:ui-not-selected:hover:text-dark-tremor-content-emphasis dark:ui-selected:text-dark-tremor-brand dark:ui-not-selected:text-dark-tremor-content",
// brand
color
? getColorClassNames(color, colorPalette.text).selectTextColor
Expand All @@ -58,11 +58,9 @@ const Tab = React.forwardRef<HTMLButtonElement, TabProps>((props, ref) => {
// common
"flex whitespace-nowrap truncate max-w-xs outline-none ui-focus-visible:ring text-tremor-default transition duration-100",
// brand
color
? getColorClassNames(color, colorPalette.text).selectTextColor
: variant === "solid"
? "ui-selected:text-tremor-content-emphasis dark:ui-selected:text-dark-tremor-content-emphasis"
: "ui-selected:text-tremor-brand dark:ui-selected:text-dark-tremor-brand",
color && getColorClassNames(color, colorPalette.text).selectTextColor,
// solid ? "ui-selected:text-tremor-content-emphasis dark:ui-selected:text-dark-tremor-content-emphasis"
// : "ui-selected:text-tremor-brand dark:ui-selected:text-dark-tremor-brand",
getVariantStyles(variant, color),
className,
)}
Expand Down
48 changes: 24 additions & 24 deletions src/lib/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,32 @@ export function getColorClassNames(color: Color | string, shade?: number): Color
if (color === "white" || color === "black" || color === "transparent" || !shade || !isBaseColor) {
const unshadedColor = !getIsArbitraryColor(color) ? color : `[${color}]`;
return {
bgColor: `bg-${unshadedColor}`,
hoverBgColor: `hover:bg-${unshadedColor}`,
selectBgColor: `ui-selected:bg-${unshadedColor}`,
textColor: `text-${unshadedColor}`,
selectTextColor: `ui-selected:text-${unshadedColor}`,
hoverTextColor: `hover:text-${unshadedColor}`,
borderColor: `border-${unshadedColor}`,
selectBorderColor: `ui-selected:border-${unshadedColor}`,
hoverBorderColor: `hover:border-${unshadedColor}`,
ringColor: `ring-${unshadedColor}`,
strokeColor: `stroke-${unshadedColor}`,
fillColor: `fill-${unshadedColor}`,
bgColor: `bg-${unshadedColor} dark:bg-${unshadedColor}`,
hoverBgColor: `hover:bg-${unshadedColor} dark:hover:bg-${unshadedColor}`,
selectBgColor: `ui-selected:bg-${unshadedColor} dark:ui-selected:bg-${unshadedColor}`,
textColor: `text-${unshadedColor} dark:text-${unshadedColor}`,
selectTextColor: `ui-selected:text-${unshadedColor} dark:ui-selected:text-${unshadedColor}`,
hoverTextColor: `hover:text-${unshadedColor} dark:hover:text-${unshadedColor}`,
borderColor: `border-${unshadedColor} dark:border-${unshadedColor}`,
selectBorderColor: `ui-selected:border-${unshadedColor} dark:ui-selected:border-${unshadedColor}`,
hoverBorderColor: `hover:border-${unshadedColor} dark:hover:border-${unshadedColor}`,
ringColor: `ring-${unshadedColor} dark:ring-${unshadedColor}`,
strokeColor: `stroke-${unshadedColor} dark:stroke-${unshadedColor}`,
fillColor: `fill-${unshadedColor} dark:fill-${unshadedColor}`,
};
}
return {
bgColor: `bg-${color}-${shade}`,
selectBgColor: `ui-selected:bg-${color}-${shade}`,
hoverBgColor: `hover:bg-${color}-${shade}`,
textColor: `text-${color}-${shade}`,
selectTextColor: `ui-selected:text-${color}-${shade}`,
hoverTextColor: `hover:text-${color}-${shade}`,
borderColor: `border-${color}-${shade}`,
selectBorderColor: `ui-selected:border-${color}-${shade}`,
hoverBorderColor: `hover:border-${color}-${shade}`,
ringColor: `ring-${color}-${shade}`,
strokeColor: `stroke-${color}-${shade}`,
fillColor: `fill-${color}-${shade}`,
bgColor: `bg-${color}-${shade} dark:bg-${color}-${shade}`,
selectBgColor: `ui-selected:bg-${color}-${shade} dark:ui-selected:bg-${color}-${shade}`,
hoverBgColor: `hover:bg-${color}-${shade} dark:hover:bg-${color}-${shade}`,
textColor: `text-${color}-${shade} dark:text-${color}-${shade}`,
selectTextColor: `ui-selected:text-${color}-${shade} dark:ui-selected:text-${color}-${shade}`,
hoverTextColor: `hover:text-${color}-${shade} dark:hover:text-${color}-${shade}`,
borderColor: `border-${color}-${shade} dark:border-${color}-${shade}`,
selectBorderColor: `ui-selected:border-${color}-${shade} dark:ui-selected:border-${color}-${shade}`,
hoverBorderColor: `hover:border-${color}-${shade} dark:hover:border-${color}-${shade}`,
ringColor: `ring-${color}-${shade} dark:ring-${color}-${shade}`,
strokeColor: `stroke-${color}-${shade} dark:stroke-${color}-${shade}`,
fillColor: `fill-${color}-${shade} dark:fill-${color}-${shade}`,
};
}

0 comments on commit 993407d

Please sign in to comment.