From 27037c6f50b845f0603a1660a51e09730b018f9c Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Sun, 12 Nov 2023 13:37:32 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Image=20properties=20customization?= =?UTF-8?q?=20(#1590)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customization/page-appearance.json | 23 +++++++++++++++ .../Appearance/AppearanceCustomization.tsx | 29 ++++++++++++++++++- .../layout/Templates/BoardLayout.tsx | 11 ++++--- src/pages/board/[slug]/customize.tsx | 7 +++-- src/server/api/routers/config.ts | 5 +++- src/types/settings.ts | 9 ++++++ src/validations/boards.ts | 4 +++ 7 files changed, 78 insertions(+), 10 deletions(-) diff --git a/public/locales/en/settings/customization/page-appearance.json b/public/locales/en/settings/customization/page-appearance.json index 36d24c33c..b3f380bf2 100644 --- a/public/locales/en/settings/customization/page-appearance.json +++ b/public/locales/en/settings/customization/page-appearance.json @@ -18,6 +18,29 @@ "background": { "label": "Background" }, + "backgroundImageAttachment": { + "label": "Background image attachment", + "options": { + "fixed": "Fixed - Background stays in the same position (recommended)", + "scroll": "Scroll - Background scrolls with your mouse" + } + }, + "backgroundImageSize": { + "label": "Background image size", + "options": { + "cover": "Cover - Scales the image as small as possible to cover the entire window by cropping excessive space. (recommended)", + "contain": "Contain - Scales the image as large as possible within its container without cropping or stretching the image." + } + }, + "backgroundImageRepeat": { + "label": "Background image attachment", + "options": { + "repeat": "Repeat - The image is repeated as much as needed to cover the whole background image painting area.", + "no-repeat": "No repeat - The image is not repeated any may not fill the entire space (recommended)", + "repeat-x": "Repeat X - Same as 'Repeat' but only on horizontal axis.", + "repeat-y": "Repeat Y - Same as 'Repeat' but only on vertical axis." + } + }, "customCSS": { "label": "Custom CSS", "description": "Further, customize your dashboard using CSS, only recommended for experienced users", diff --git a/src/components/Board/Customize/Appearance/AppearanceCustomization.tsx b/src/components/Board/Customize/Appearance/AppearanceCustomization.tsx index 248f4e855..4f1411124 100644 --- a/src/components/Board/Customize/Appearance/AppearanceCustomization.tsx +++ b/src/components/Board/Customize/Appearance/AppearanceCustomization.tsx @@ -4,9 +4,9 @@ import { Group, Input, MantineTheme, + Select, Slider, Stack, - Text, TextInput, createStyles, rem, @@ -16,6 +16,7 @@ import { useTranslation } from 'next-i18next'; import { highlight, languages } from 'prismjs'; import Editor from 'react-simple-code-editor'; import { useColorTheme } from '~/tools/color'; +import { BackgroundImageAttachment, BackgroundImageRepeat, BackgroundImageSize } from '~/types/settings'; import { useBoardCustomizationFormContext } from '../form'; @@ -30,6 +31,32 @@ export const AppearanceCustomization = () => { placeholder="/imgs/backgrounds/background.png" {...form.getInputProps('appearance.backgroundSrc')} /> + ({ + value: size, + label: t(`backgroundImageSize.options.${size}`) as string, + }))} + {...form.getInputProps('appearance.backgroundImageSize')} + /> + +