Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/extension-ui/src/components/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React, { useState } from 'react';
import styled, { ThemeProvider } from 'styled-components';
import { AvailableThemes, chooseTheme, themes, ThemeSwitchContext } from '.';
import styled, { ThemeProvider, createGlobalStyle } from 'styled-components';
import { AvailableThemes, chooseTheme, themes, ThemeSwitchContext, Theme } from '.';

interface Props {
children: React.ReactNode;
Expand All @@ -22,6 +22,7 @@ function View ({ children, className }: Props): React.ReactElement<Props> {
return (
<ThemeSwitchContext.Provider value={switchTheme}>
<ThemeProvider theme={themes[theme]}>
<BodyTheme theme={themes[theme]} />
<Main className={className}>
{children}
</Main>
Expand All @@ -30,6 +31,12 @@ function View ({ children, className }: Props): React.ReactElement<Props> {
);
}

const BodyTheme = createGlobalStyle<{ theme: Theme }>`
body {
background-color: ${({ theme }): string => theme.bodyColor};
}
`;

const Main = styled.main`
display: flex;
flex-direction: column;
Expand All @@ -39,7 +46,7 @@ const Main = styled.main`
font-size: ${({ theme }): string => theme.fontSize};
line-height: ${({ theme }): string => theme.lineHeight};
border: 1px solid ${({ theme }): string => theme.inputBorderColor};

* {
font-family: ${({ theme }): string => theme.fontFamily};
}
Expand Down
2 changes: 2 additions & 0 deletions packages/extension-ui/src/components/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const darkTheme = {
id: 'dark',
background: '#181A23',
bodyColor: '#20222A',
highlightedAreaBackground: '#0B0C10',
popupBackground: '#0B0C10',
accountBackground: '#0B0C10',
Expand Down Expand Up @@ -44,6 +45,7 @@ const lightTheme: Theme = {
...darkTheme,
id: 'light',
background: '#FFFFFF',
bodyColor: '#FFFFFF',
highlightedAreaBackground: '#F4F5F7',
accountBackground: '#FFFFFF',
popupBackground: '#FFFFFF',
Expand Down