From 517d17d43a92f12dd679a71e67a12f4ade833c49 Mon Sep 17 00:00:00 2001 From: Davide Carpini Date: Mon, 8 Jan 2024 15:19:39 +0100 Subject: [PATCH] fix: null coalish and theme variables --- packages/dapp-kit-ui/src/modal.ts | 2 +- packages/dapp-kit-ui/src/utils/ui-config.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/dapp-kit-ui/src/modal.ts b/packages/dapp-kit-ui/src/modal.ts index 4f0adba8..5b3983f0 100644 --- a/packages/dapp-kit-ui/src/modal.ts +++ b/packages/dapp-kit-ui/src/modal.ts @@ -28,7 +28,7 @@ const createModalIfNotPresent = (options?: { const newModal = document.createElement('vdk-modal'); - (options?.modalParent || document.body).appendChild(newModal); + (options?.modalParent ?? document.body).appendChild(newModal); return newModal; }; diff --git a/packages/dapp-kit-ui/src/utils/ui-config.ts b/packages/dapp-kit-ui/src/utils/ui-config.ts index 4aa4d5e2..23529bf4 100644 --- a/packages/dapp-kit-ui/src/utils/ui-config.ts +++ b/packages/dapp-kit-ui/src/utils/ui-config.ts @@ -4,7 +4,7 @@ import { type DAppKitUIOptions } from '../client'; import { Colors, Font, modalZIndex, defaultI18n } from '../constants'; -const StyleVariables = { +const ThemeVariables = { '--vdk-color-dark-primary': Colors.Dark.Primary.toString(), '--vdk-color-dark-primary-hover': Colors.Dark.PrimaryHover.toString(), '--vdk-color-dark-primary-active': Colors.Dark.PrimaryActive.toString(), @@ -25,10 +25,10 @@ const StyleVariables = { '--vdk-modal-z-index': modalZIndex.toString(), }; -export type StyleVariables = keyof typeof StyleVariables; +export type ThemeVariables = keyof typeof ThemeVariables; export type CustomizedStyle = { - [key in StyleVariables]?: string; + [key in ThemeVariables]?: string; }; export const initStyles = (customizedStyle: CustomizedStyle): void => { @@ -36,7 +36,7 @@ export const initStyles = (customizedStyle: CustomizedStyle): void => { if (root) { for (const [key, value] of Object.entries({ - ...StyleVariables, + ...ThemeVariables, ...customizedStyle, })) { root.style.setProperty(key, value);