A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
feat(dynamic-sections): add custom css classes option (#4256)
Meier Lukas4c2e352acac6
diff --git a/apps/nextjs/src/components/board/items/actions/test/mocks/dynamic-section-mock.ts b/apps/nextjs/src/components/board/items/actions/test/mocks/dynamic-section-mock.tsindex 81ddc0443..dde39bcfb 100644--- a/apps/nextjs/src/components/board/items/actions/test/mocks/dynamic-section-mock.ts+++ b/apps/nextjs/src/components/board/items/actions/test/mocks/dynamic-section-mock.ts@@ -12,6 +12,7 @@ export class DynamicSectionMockBuilder {options: {title: "",borderColor: "",+ customCssClasses: [],},layouts: [],...section,diff --git a/apps/nextjs/src/components/board/sections/dynamic-section.tsx b/apps/nextjs/src/components/board/sections/dynamic-section.tsxindex 3b5493366..39818c5de 100644--- a/apps/nextjs/src/components/board/sections/dynamic-section.tsx+++ b/apps/nextjs/src/components/board/sections/dynamic-section.tsx@@ -1,4 +1,5 @@import { Badge, Box, Card } from "@mantine/core";+import combineClasses from "clsx";import { useCurrentLayout, useRequiredBoard } from "@homarr/boards/context";@@ -24,7 +25,7 @@ export const BoardDynamicSection = ({ section }: Props) => {}}><Card- className={classes.itemCard}+ className={combineClasses(classes.itemCard, section.options.customCssClasses.join(" "))}w="100%"h="100%"withBorderdiff --git a/apps/nextjs/src/components/board/sections/dynamic/actions/add-dynamic-section.ts b/apps/nextjs/src/components/board/sections/dynamic/actions/add-dynamic-section.tsindex 11102fb5b..ba85cecfb 100644--- a/apps/nextjs/src/components/board/sections/dynamic/actions/add-dynamic-section.ts+++ b/apps/nextjs/src/components/board/sections/dynamic/actions/add-dynamic-section.ts@@ -19,6 +19,7 @@ export const addDynamicSectionCallback = () => (board: Board) => {options: {title: "",borderColor: "",+ customCssClasses: [],},layouts: createDynamicSectionLayouts(board, firstSection),} satisfies DynamicSection;diff --git a/apps/nextjs/src/components/board/sections/dynamic/dynamic-edit-modal.tsx b/apps/nextjs/src/components/board/sections/dynamic/dynamic-edit-modal.tsxindex b15c700a9..f80a833d6 100644--- a/apps/nextjs/src/components/board/sections/dynamic/dynamic-edit-modal.tsx+++ b/apps/nextjs/src/components/board/sections/dynamic/dynamic-edit-modal.tsx@@ -6,6 +6,7 @@ import type { z } from "zod/v4";import { useZodForm } from "@homarr/form";import { createModal } from "@homarr/modals";import { useI18n } from "@homarr/translation/client";+import { TextMultiSelect } from "@homarr/ui";import { dynamicSectionOptionsSchema } from "@homarr/validation/shared";interface ModalProps {@@ -31,6 +32,10 @@ export const DynamicSectionEditModal = createModal<ModalProps>(({ actions, inner><Stack><TextInput label={t("section.dynamic.option.title.label")} {...form.getInputProps("title")} />+ <TextMultiSelect+ label={t("section.dynamic.option.customCssClasses.label")}+ {...form.getInputProps("customCssClasses")}+ /><ColorInputlabel={t("section.dynamic.option.borderColor.label")}format="hex"diff --git a/packages/translation/src/lang/en.json b/packages/translation/src/lang/en.jsonindex ab8721032..5331e306a 100644--- a/packages/translation/src/lang/en.json+++ b/packages/translation/src/lang/en.json@@ -1163,6 +1163,9 @@"title": {"label": "Title"},+ "customCssClasses": {+ "label": "Custom css classes"+ },"borderColor": {"label": "Border color"}diff --git a/packages/validation/src/shared.ts b/packages/validation/src/shared.tsindex 87bb3b41f..620a0f2f4 100644--- a/packages/validation/src/shared.ts+++ b/packages/validation/src/shared.ts@@ -62,6 +62,7 @@ const emptySectionSchema = z.object({export const dynamicSectionOptionsSchema = z.object({title: z.string().max(20).default(""),+ customCssClasses: z.array(z.string()).default([]),borderColor: z.string().default(""),});