Skip to content

Commit

Permalink
refactor(theme, colors): replace isLightMode with colorMode in regula…
Browse files Browse the repository at this point in the history
…r components (anoma#103)

* fix(theme, colors): replace isLightMode with colorMode in regukar
components

* fix: replace == with ===
  • Loading branch information
mateuszjasiuk authored Oct 10, 2022
1 parent c1069da commit 629e6dd
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 688 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ const DerivedAccounts = ({ setTotal }: Props): JSX.Element => {
const shielded: TokenBalance[] =
tokens.filter(
(tokenBalance) =>
tokenBalance.token == symbol && tokenBalance.isShielded
tokenBalance.token === symbol && tokenBalance.isShielded
) || [];
const transparent: TokenBalance[] =
tokens.filter(
(tokenBalance) =>
tokenBalance.token == symbol && !tokenBalance.isShielded
tokenBalance.token === symbol && !tokenBalance.isShielded
) || [];
tokenBalances.push(...shielded, ...transparent);
return tokenBalances;
Expand Down
4 changes: 2 additions & 2 deletions apps/namada-interface/src/App/App.components.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled, { createGlobalStyle } from "styled-components/macro";
import { motion } from "framer-motion";
import { DesignConfiguration, ThemeName } from "utils/theme";
import { ColorMode, DesignConfiguration, ThemeName } from "utils/theme";

enum ComponentColor {
BorderColor,
Expand All @@ -25,7 +25,7 @@ const getColor = (
}
};
type GlobalStyleProps = {
isLightMode: boolean;
colorMode: ColorMode;
};

// Set global styles for themed control of background color based
Expand Down
10 changes: 5 additions & 5 deletions apps/namada-interface/src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function App(): JSX.Element {
const theme = getTheme(isLightMode, ShouldUsePlaceholderTheme);

const toggleColorMode = (): void => {
setColorMode((currentMode) => (currentMode == "dark" ? "light" : "dark"));
setColorMode((currentMode) => (currentMode === "dark" ? "light" : "dark"));
};

useEffect(() => storeColorMode(colorMode), [colorMode]);
Expand All @@ -85,11 +85,11 @@ function App(): JSX.Element {
return (
<ThemeProvider theme={theme}>
<Provider store={store}>
<GlobalStyles isLightMode={isLightMode} />
<GlobalStyles colorMode={colorMode} />
<AppContainer data-testid="AppContainer">
<TopSection>
<TopNavigation
isLightMode={isLightMode}
colorMode={colorMode}
toggleColorMode={toggleColorMode}
setColorMode={setColorMode}
isLoggedIn={!!password}
Expand Down Expand Up @@ -118,11 +118,11 @@ function App(): JSX.Element {
*/
return (
<ThemeProvider theme={theme}>
<GlobalStyles isLightMode={isLightMode} />
<GlobalStyles colorMode={colorMode} />
<AppContainer data-testid="AppContainer">
<TopSection>
<TopNavigation
isLightMode={isLightMode}
colorMode={colorMode}
setColorMode={setColorMode}
toggleColorMode={toggleColorMode}
logout={() => setPassword(undefined)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const SettingsAccountSettings = (): JSX.Element => {
if (
prompt(
`Please type in ${account.alias} if you're sure you want to delete this account`
) == account.alias
) === account.alias
) {
dispatch(removeAccount({ chainId, id: account.id }));
navigate(TopLevelRoute.SettingsAccounts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const SettingsWalletSettings = ({ password }: Props): JSX.Element => {
</Button>
)}

{keplrConnectionState == KeplrConnectionState.Connected && (
{keplrConnectionState === KeplrConnectionState.Connected && (
<ExtensionInfo>Connected to Keplr Extension</ExtensionInfo>
)}

Expand Down

This file was deleted.

Loading

0 comments on commit 629e6dd

Please sign in to comment.