Skip to content

Commit

Permalink
Refactor: dynamic CSS overrides as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rdig committed Jan 29, 2025
1 parent d13a035 commit 9c1f3f1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
12 changes: 7 additions & 5 deletions src/Entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import motionStatesMessages from './i18n/en-motion-states.ts';
import systemMessages from './i18n/en-system-messages.ts';
import messages from './i18n/en.json';
import Routes from './routes/index.ts';
import {
dynamicCssOverridesLight,
dynamicCssOverridesDark,
} from './styles/dynamicOverrides.ts';

interface Props {
store: any;
Expand Down Expand Up @@ -69,11 +73,9 @@ const Entry = ({ store }: Props) => {
],
// Since we can't use the shadow Dom override for css styling, since that breaks the skeleton loader
// we have to resort to this method to override the css, which is very verbose
cssOverrides: isDarkMode ? (
<link rel="stylesheet" href="/src/styles/dynamicOverridesDark.css" />
) : (
<link rel="stylesheet" href="/src/styles/dynamicOverridesLight.css" />
),
cssOverrides: isDarkMode
? dynamicCssOverridesDark
: dynamicCssOverridesLight,
overrides: {
evmNetworks: (networks) => {
// Only needed for embedded wallets
Expand Down
11 changes: 11 additions & 0 deletions src/styles/dynamicOverrides.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const dynamicCssOverridesDark = `
.badge__container__primary {
background-color: var(--dynamic-badge-dot-background) !important;
}
`;

export const dynamicCssOverridesLight = `
.badge__container__primary {
background-color: #eff8ff !important;
}
`;
3 changes: 0 additions & 3 deletions src/styles/dynamicOverridesDark.css

This file was deleted.

4 changes: 0 additions & 4 deletions src/styles/dynamicOverridesLight.css

This file was deleted.

0 comments on commit 9c1f3f1

Please sign in to comment.