Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 9 additions & 2 deletions packages/extension-ui/src/components/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React, { useState } from 'react';
import styled, { ThemeProvider } from 'styled-components';
import styled, { ThemeProvider, createGlobalStyle } from 'styled-components';
import { AvailableThemes, chooseTheme, themes, ThemeSwitchContext } from '.';
Comment thread
vanruch marked this conversation as resolved.
Outdated

interface Props {
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].bodyColor}/>
Comment thread
vanruch marked this conversation as resolved.
Outdated
<Main className={className}>
{children}
</Main>
Expand All @@ -30,6 +31,12 @@ function View ({ children, className }: Props): React.ReactElement<Props> {
);
}

const BodyTheme = createGlobalStyle<{ theme: string}>`
Comment thread
vanruch marked this conversation as resolved.
Outdated
body {
background-color: ${({ theme }): string => theme};
Comment thread
vanruch marked this conversation as resolved.
Outdated
}
`;

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