From 7c9896a12828f75315d558cb1127a38df7fd255e Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Sun, 7 Apr 2024 15:13:55 +1000 Subject: [PATCH] add hidename switch --- src/interface/components/ThemeCover.tsx | 5 ++++- src/interface/pages/ThemeCreator.tsx | 21 ++++++++++++++++++--- src/interface/types/CustomThemes.ts | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/interface/components/ThemeCover.tsx b/src/interface/components/ThemeCover.tsx index 9363173c..18ee8cb4 100644 --- a/src/interface/components/ThemeCover.tsx +++ b/src/interface/components/ThemeCover.tsx @@ -61,7 +61,10 @@ export const ThemeCover: React.FC = ({ className="absolute inset-0 z-0 object-cover" /> } -
{theme.name}
+ { + theme.hideThemeName ? <> : +
{theme.name}
+ } ); diff --git a/src/interface/pages/ThemeCreator.tsx b/src/interface/pages/ThemeCreator.tsx index 1237fded..b41f72c2 100644 --- a/src/interface/pages/ThemeCreator.tsx +++ b/src/interface/pages/ThemeCreator.tsx @@ -10,6 +10,7 @@ import { CustomTheme, CustomThemeBase64 } from '../types/CustomThemes'; import browser from 'webextension-polyfill'; function ThemeCreator() { + // default settings for new themes const [theme, setTheme] = useState({ id: uuidv4(), name: '', @@ -20,7 +21,8 @@ function ThemeCreator() { CustomCSS: '', CustomImages: [], coverImage: null, - isEditable: true + isEditable: true, + hideThemeName: false, }); useEffect(() => { @@ -204,16 +206,29 @@ function ThemeCreator() { } }} className="absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer" /> { - theme.coverImage && ( + !theme.hideThemeName && theme.coverImage ? +
{theme.name}
: <> + } + { + theme.coverImage && <>
Cover Image - ) }
+
+
Hide Name
+
Useful when your cover image contains text
+
+ setTheme({ ...theme, hideThemeName: value })} /> +
+ + + +
Custom Theme Colour
Allow users to change the theme colour
diff --git a/src/interface/types/CustomThemes.ts b/src/interface/types/CustomThemes.ts index 88f8dccc..0b3f20d1 100644 --- a/src/interface/types/CustomThemes.ts +++ b/src/interface/types/CustomThemes.ts @@ -9,6 +9,7 @@ export type CustomTheme = { CustomImages: CustomImage[]; coverImage: Blob | string | null; isEditable: boolean; + hideThemeName: boolean; } export type CustomImage = {