feat(icon-color): add icon color clear button (#3593)

This commit is contained in:
Andre Silva
2025-07-11 17:39:12 +01:00
committed by GitHub
parent dc754232bc
commit 5a8653d850
2 changed files with 23 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ import {
useMantineTheme, useMantineTheme,
} from "@mantine/core"; } from "@mantine/core";
import { useDisclosure } from "@mantine/hooks"; import { useDisclosure } from "@mantine/hooks";
import { IconX } from "@tabler/icons-react";
import { useZodForm } from "@homarr/form"; import { useZodForm } from "@homarr/form";
import { useI18n } from "@homarr/translation/client"; import { useI18n } from "@homarr/translation/client";
@@ -102,12 +103,25 @@ export const ColorSettingsContent = ({ board }: Props) => {
</InputWrapper> </InputWrapper>
</Grid.Col> </Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}> <Grid.Col span={{ sm: 12, md: 6 }}>
<ColorInput <Group align="end">
label={t("board.field.iconColor.label")} <ColorInput
format="hex" label={t("board.field.iconColor.label")}
swatches={Object.values(theme.colors).map((color) => color[6])} format="hex"
{...form.getInputProps("iconColor")} swatches={Object.values(theme.colors).map((color) => color[6])}
/> flex={1}
{...form.getInputProps("iconColor")}
/>
<Button
variant="subtle"
leftSection={<IconX />}
onClick={() => form.setFieldValue("iconColor", "")}
disabled={!form.values.iconColor}
>
{t("board.field.clearColor.label")}
</Button>
</Group>
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<Select <Select
label={t("board.field.itemRadius.label")} label={t("board.field.itemRadius.label")}
description={t("board.field.itemRadius.description")} description={t("board.field.itemRadius.description")}

View File

@@ -2556,6 +2556,9 @@
"iconColor": { "iconColor": {
"label": "Icon color" "label": "Icon color"
}, },
"clearColor": {
"label": "Clear color"
},
"customCss": { "customCss": {
"label": "Custom css for this board", "label": "Custom css for this board",
"description": "Further, customize your dashboard using CSS, only recommended for experienced users", "description": "Further, customize your dashboard using CSS, only recommended for experienced users",