From 5fa64b19716b22b6b2d628a8c0a3f2afab42be29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Thune?= Date: Thu, 6 Jun 2024 15:17:43 +0200 Subject: [PATCH] Added hidden button to toggle globals on themepicker --- .../TokenModal/TokenModal.module.css | 10 ++++ .../components/TokenModal/TokenModal.tsx | 56 ++++++++++--------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/apps/theme/components/TokenModal/TokenModal.module.css b/apps/theme/components/TokenModal/TokenModal.module.css index 3b2b97328b..ff10d379e4 100644 --- a/apps/theme/components/TokenModal/TokenModal.module.css +++ b/apps/theme/components/TokenModal/TokenModal.module.css @@ -60,3 +60,13 @@ right: 22px; top: 22px; } + +.hiddenGlobalBtn { + position: absolute; + left: 0; + bottom: 0; + height: 48px; + width: 48px; + background-color: transparent; + border: transparent; +} diff --git a/apps/theme/components/TokenModal/TokenModal.tsx b/apps/theme/components/TokenModal/TokenModal.tsx index 026fdce36f..9987266b8b 100644 --- a/apps/theme/components/TokenModal/TokenModal.tsx +++ b/apps/theme/components/TokenModal/TokenModal.tsx @@ -42,6 +42,7 @@ export const TokenModal = ({ ':root { --color-1: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; --color-2: #F45F63; }', ); const [toolTipText, setToolTipText] = useState('Kopier nettaddresse'); + const [showGlobals, setShowGlobals] = useState(false); const generateJsonForColor = (colorArray: ColorInfoType[]) => { const obj: { [key: string]: { value: string; type: string } } = {}; @@ -209,6 +210,11 @@ export const TokenModal = ({
+
generateThemeJson('light')} value='value1' > - Light + Lightmode generateThemeJson('dark')} value='value2' > - Dark - - generateThemeJson('contrast')} - value='value3' - > - Contrast - - genereateGlobalsJson('light')} - value='value4' - > - G: Light - - genereateGlobalsJson('dark')} - value='value5' - > - G: Dark - - genereateGlobalsJson('contrast')} - value='value6' - > - G: Contrast + Darkmode + {showGlobals && ( + <> + genereateGlobalsJson('light')} + value='value4' + > + G: Light + + genereateGlobalsJson('dark')} + value='value5' + > + G: Dark + + genereateGlobalsJson('contrast')} + value='value6' + > + G: Contrast + + + )}