From a9e25647eae1ad51a29a7dea3d728e9514bc349f Mon Sep 17 00:00:00 2001 From: Florian Dieminger Date: Wed, 17 Jul 2024 17:11:40 +0200 Subject: [PATCH] feat(pong): support new colors for the format --- client/src/ui/organisms/placement/index.scss | 34 +++++++++++++++++--- client/src/ui/organisms/placement/index.tsx | 22 +++++++++---- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/client/src/ui/organisms/placement/index.scss b/client/src/ui/organisms/placement/index.scss index 9b97177521da..17170f874856 100644 --- a/client/src/ui/organisms/placement/index.scss +++ b/client/src/ui/organisms/placement/index.scss @@ -11,6 +11,20 @@ section.place { } .pong-box2 { + --place-new-side-background-light: #111; + --place-new-side-color-light: #fff; + + --place-new-side-background-dark: #111; + --place-new-side-color-dark: #fff; + + --place-new-side-background: var(--place-new-side-background-light); + --place-new-side-color: var(--place-new-side-color-light); + + @media (prefers-color-scheme: dark) { + --place-new-side-background: var(--place-new-side-background-dark); + --place-new-side-color: var(--place-new-side-color-dark); + } + --border-radius: 0.5rem; border: 1px solid var(--border-primary); border-radius: var(--border-radius); @@ -23,6 +37,7 @@ section.place { .pong-note { background-color: #fff6; + border: 1px solid #111a; border-radius: 0.25rem; color: #fff; font-size: 0.625rem; @@ -53,9 +68,13 @@ section.place { } > div.content { - background: linear-gradient(to top, #111 9rem, transparent); + background: linear-gradient( + to top, + var(--place-new-side-background) 9rem, + transparent + ); border-radius: var(--border-radius); - color: #fff; + color: var(--place-new-side-color); display: flex; flex-direction: column; gap: 0.25rem; @@ -78,7 +97,7 @@ section.place { } .pong-cta { - --color: #fff; + --color: var(--place-new-side-color); --icon-primary: var(--color); background-color: #fff1; border: solid 2px; @@ -95,8 +114,8 @@ section.place { } &:hover { - --color: #111; - background-color: #fff; + --color: var(--place-new-side-background); + background-color: var(--place-new-side-color); } } } @@ -255,6 +274,11 @@ section.place { } } +.dark section.place .pong-box2 { + --place-new-side-background: var(--place-new-side-background-dark); + --place-new-side-color: var(--place-new-side-color-dark); +} + section.place.hp-main { background-color: var(--place-hp-main-background); margin: 0; diff --git a/client/src/ui/organisms/placement/index.tsx b/client/src/ui/organisms/placement/index.tsx index 5ca0a9ef5bed..53d4662e90e9 100644 --- a/client/src/ui/organisms/placement/index.tsx +++ b/client/src/ui/organisms/placement/index.tsx @@ -50,6 +50,19 @@ function viewed(pong?: PlacementData) { export function SidePlacement() { const placementData = usePlacement(); + const { textColor, backgroundColor, textColorDark, backgroundColorDark } = + placementData?.side?.colors || {}; + const css = Object.fromEntries( + [ + ["--place-new-side-background-light", backgroundColor], + ["--place-new-side-color-light", textColor], + [ + "--place-new-side-background-dark", + backgroundColorDark || backgroundColor, + ], + ["--place-new-side-color-dark", textColorDark || textColor], + ].filter(([_, v]) => Boolean(v)) + ); return !placementData?.side ? (
@@ -62,6 +75,7 @@ export function SidePlacement() { cta={placementData.side.cta} renderer={RenderNewSideBanner} typ="side" + style={css} > ) : ( -
+
+
click ${typ}`}