fix: converting card tag color for light theme
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { CardTagSchema } from "../../client";
|
import { CardTagSchema } from "../../client";
|
||||||
import { Pill, useMantineColorScheme } from "@mantine/core";
|
import { darken, lighten, Pill, useMantineColorScheme } from "@mantine/core";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tag: Partial<CardTagSchema>;
|
tag: Partial<CardTagSchema>;
|
||||||
@@ -7,19 +7,25 @@ type Props = {
|
|||||||
|
|
||||||
const CardTag = ({ tag }: Props) => {
|
const CardTag = ({ tag }: Props) => {
|
||||||
const theme = useMantineColorScheme();
|
const theme = useMantineColorScheme();
|
||||||
|
const isInherit = tag.tagColor!.backgroundColor === "inherit";
|
||||||
|
|
||||||
let color = "lightgray";
|
let color = tag.tagColor!.color;
|
||||||
if (tag?.tagColor?.backgroundColor === "inherit" && theme.colorScheme == "light") {
|
let backgroundColor = tag.tagColor!.backgroundColor;
|
||||||
color = "gray";
|
|
||||||
|
if (!(theme.colorScheme == "dark" || isInherit)) {
|
||||||
|
color = darken(color, 0.95);
|
||||||
|
backgroundColor = lighten(backgroundColor, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pill
|
<Pill
|
||||||
key={tag.id}
|
key={tag.id}
|
||||||
style={{
|
style={{
|
||||||
|
opacity: 0.7,
|
||||||
color,
|
color,
|
||||||
backgroundColor: tag?.tagColor?.backgroundColor,
|
backgroundColor,
|
||||||
border: "1px solid " + tag?.tagColor?.color,
|
border: "1px solid",
|
||||||
|
borderColor: color,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tag.name}
|
{tag.name}
|
||||||
|
|||||||
Reference in New Issue
Block a user