@@ -47,21 +50,3 @@ Modal.Header = SUIModal.Header;
Modal.Description = SUIModal.Description;
export default Modal;
-
-// rgba(0, 0, 0, 0.5);
-// @media only screen and (min-width: 1200px)
-// .ui.large.modal {
-// width: 1080px;
-// margin: 0;
-// }
-
-// @media only screen and (min-width: 992px)
-// .ui.large.modal {
-// width: 1020px;
-// margin: 0;
-// }
-// @media only screen and (min-width: 768px)
-// .ui.large.modal {
-// width: 88%;
-// margin: 0;
-// }
diff --git a/packages/react-components/src/Progress.tsx b/packages/react-components/src/Progress.tsx
index 2e86843afb..b82b6dc616 100644
--- a/packages/react-components/src/Progress.tsx
+++ b/packages/react-components/src/Progress.tsx
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from './types';
+
import BN from 'bn.js';
import React from 'react';
import styled from 'styled-components';
@@ -69,7 +71,7 @@ function Progress ({ className = '', isDisabled, size = 'normal', total, value }
);
}
-export default React.memo(styled(Progress)`
+export default React.memo(styled(Progress)(({ theme }: ThemeProps) => `
border-radius: 100%;
clip-path: circle(50%);
height: 4.5rem;
@@ -125,9 +127,10 @@ export default React.memo(styled(Progress)`
.inner {
align-items: center;
- background: rgba(245, 243, 241, 0.91);
+ background: ${theme.bgInverse};
border-radius: 100%;
bottom: 0.375rem;
+ color: ${theme.colorSummary};
display: flex;
justify-content: center;
left: 0.375rem;
@@ -157,4 +160,4 @@ export default React.memo(styled(Progress)`
font-size: 0.625rem;
}
}
-`);
+`));
diff --git a/packages/react-components/src/Sidebar.tsx b/packages/react-components/src/Sidebar.tsx
index defac6b58f..1181c3f074 100644
--- a/packages/react-components/src/Sidebar.tsx
+++ b/packages/react-components/src/Sidebar.tsx
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/app-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from './types';
+
import React from 'react';
import styled from 'styled-components';
@@ -32,8 +34,8 @@ function Sidebar ({ button, children, className = '', onClose }: Props): React.R
);
}
-export default React.memo(styled(Sidebar)(({ offset = 0, position }: Props) => `
- background: #f5f3f1;
+export default React.memo(styled(Sidebar)(({ offset = 0, position, theme }: Props & ThemeProps) => `
+ background: ${theme.bgPage};
bottom: 0;
box-shadow: ${position === 'right' ? '-6px' : '6px'} 0px 20px 0px rgba(0, 0, 0, 0.3);
margin-left: -0.125rem;
diff --git a/packages/react-components/src/Table/Body.tsx b/packages/react-components/src/Table/Body.tsx
index 36cdfd57f3..3b48f6e1ab 100644
--- a/packages/react-components/src/Table/Body.tsx
+++ b/packages/react-components/src/Table/Body.tsx
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
+
import React from 'react';
import styled from 'styled-components';
import { isString } from '@polkadot/util';
@@ -28,7 +30,7 @@ function Body ({ children, className = '', empty, emptySpinner }: Props): React.
);
}
-export default React.memo(styled(Body)`
+export default React.memo(styled(Body)(({ theme }: ThemeProps) => `
position: relative;
td {
@@ -37,11 +39,11 @@ export default React.memo(styled(Body)`
vertical-align: middle;
&:first-child {
- border-left: 1px solid #eeecea;
+ border-left: 1px solid ${theme.borderTable};
}
&:last-child {
- border-right: 1px solid #eeecea;
+ border-right: 1px solid ${theme.borderTable};
}
label {
@@ -158,7 +160,7 @@ export default React.memo(styled(Body)`
// }
&:nth-child(odd) {
- background: white;
+ background: ${theme.bgTable};
}
&:first-child {
@@ -173,7 +175,7 @@ export default React.memo(styled(Body)`
&:last-child {
td {
- border-bottom: 1px solid #eeecea;
+ border-bottom: 1px solid ${theme.borderTable};
&:first-child {
border-bottom-left-radius: 0.25rem;
@@ -203,4 +205,4 @@ export default React.memo(styled(Body)`
background-color: #eee !important;
}
}
-`);
+`));
diff --git a/packages/react-components/src/Table/Foot.tsx b/packages/react-components/src/Table/Foot.tsx
index 59b29df068..33215d6233 100644
--- a/packages/react-components/src/Table/Foot.tsx
+++ b/packages/react-components/src/Table/Foot.tsx
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
+
import React from 'react';
import styled from 'styled-components';
@@ -22,9 +24,9 @@ function Foot ({ className = '', footer, isEmpty }: Props): React.ReactElement `
td {
- color: rgba(78, 78, 78, .66);
+ color: rgba(${theme.theme === 'dark' ? '254, 240, 240' : '78, 78, 78'}, 0.66);
font-family: sans-serif;
font-weight: 100;
padding: 0.75rem 1rem 0.25rem;
@@ -34,6 +36,6 @@ export default React.memo(styled(Foot)`
}
tr {
- background: #f5f3f1;
+ background: ${theme.bgPage};
}
-`);
+`));
diff --git a/packages/react-components/src/Table/Head.tsx b/packages/react-components/src/Table/Head.tsx
index 24978c19fc..d62fd2f230 100644
--- a/packages/react-components/src/Table/Head.tsx
+++ b/packages/react-components/src/Table/Head.tsx
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
+
import React from 'react';
import styled from 'styled-components';
@@ -46,7 +48,7 @@ function Head ({ className = '', filter, header, isEmpty }: Props): React.ReactE
);
}
-export default React.memo(styled(Head)`
+export default React.memo(styled(Head)(({ theme }: ThemeProps) => `
position: relative;
z-index: 1;
@@ -63,11 +65,11 @@ export default React.memo(styled(Head)`
}
&:first-child {
- border-left: 1px solid #eeecea;
+ border-left: 1px solid ${theme.borderTable};
}
&:last-child {
- border-right: 1px solid #eeecea;
+ border-right: 1px solid ${theme.borderTable};
}
&.address {
@@ -98,18 +100,12 @@ export default React.memo(styled(Head)`
}
tr {
- background: white;
+ background: ${theme.bgTable};
text-transform: lowercase;
&:first-child {
th {
- border-top: 1px solid #eeecea;
- }
- }
-
- &:not(.filter) {
- th {
- color: rgba(78, 78, 78, 0.66);
+ border-top: 1px solid ${theme.borderTable};
}
}
@@ -126,5 +122,11 @@ export default React.memo(styled(Head)`
padding: 0;
}
}
+
+ &:not(.filter) {
+ th {
+ color: rgba(${theme.theme === 'dark' ? '254, 240, 240' : '78, 78, 78'}, 0.66);
+ }
+ }
}
-`);
+`));
diff --git a/packages/react-components/src/Tabs/Tab.tsx b/packages/react-components/src/Tabs/Tab.tsx
index d1e96e84c4..c4cfd4128b 100644
--- a/packages/react-components/src/Tabs/Tab.tsx
+++ b/packages/react-components/src/Tabs/Tab.tsx
@@ -1,6 +1,7 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
import { TabItem } from './types';
import React from 'react';
@@ -31,7 +32,7 @@ function Tab ({ basePath, className = '', count, hasParams, index, isExact, isRo
return (
`
border-bottom: 2px solid transparent;
- color: #4e4e4e !important;
+ color: ${theme.color} !important;
margin-bottom: -3px;
padding: 0.5rem 1.5rem 0.75rem;
@@ -64,7 +65,7 @@ export default React.memo(styled(Tab)`
}
&:hover {
- color: inherit !important;
+ filter: highlight(120%);
&:not(.tabLinkActive) {
border-bottom-color: #e6e6e6;
@@ -78,4 +79,4 @@ export default React.memo(styled(Tab)`
.tabIcon {
margin-left: 0.75rem;
}
-`);
+`));
diff --git a/packages/react-components/src/Tabs/index.tsx b/packages/react-components/src/Tabs/index.tsx
index 1ae6e85ffe..009d95d47d 100644
--- a/packages/react-components/src/Tabs/index.tsx
+++ b/packages/react-components/src/Tabs/index.tsx
@@ -1,6 +1,7 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
import { TabItem } from './types';
import React, { useEffect } from 'react';
@@ -57,10 +58,10 @@ function Tabs ({ basePath, className = '', hidden, isSequence, items }: Props):
);
}
-export default React.memo(styled(Tabs)`
+export default React.memo(styled(Tabs)(({ theme }: ThemeProps) => `
align-items: flex-end;
- background: #fff;
- border-bottom: 1px solid #eeecea;
+ background: ${theme.bgTabs};
+ border-bottom: 1px solid ${theme.borderTabs};
display: flex;
margin: 0 -1.5rem;
padding: 1.5rem 1.5rem 0;
@@ -71,4 +72,4 @@ export default React.memo(styled(Tabs)`
display: none;
width: 0px;
}
-`);
+`));
diff --git a/packages/react-components/src/Toggle.tsx b/packages/react-components/src/Toggle.tsx
index 5a67c3387d..bb57971b9b 100644
--- a/packages/react-components/src/Toggle.tsx
+++ b/packages/react-components/src/Toggle.tsx
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from './types';
+
import React, { useCallback } from 'react';
import styled from 'styled-components';
@@ -41,9 +43,8 @@ function Toggle ({ className = '', isDisabled, isOverlay, isRadio, label, onChan
);
}
-export default React.memo(styled(Toggle)`
+export default React.memo(styled(Toggle)(({ theme }: ThemeProps) => `
> label {
- color: rgba(78, 78, 78, 0.75);
display: inline-block;
margin: 0 0.5rem;
}
@@ -54,7 +55,7 @@ export default React.memo(styled(Toggle)`
}
.ui--Toggle-Slider {
- background: #e4e5e6;
+ background: ${theme.bgToggle};
border-radius: 1.5rem;
display: inline-block;
height: 1.5rem;
@@ -62,8 +63,8 @@ export default React.memo(styled(Toggle)`
width: 3rem;
&::before {
- background: white;
- border: 0.125rem solid #e4e5e6;
+ background: ${theme.bgTable};
+ border: 0.125rem solid ${theme.bgToggle};
border-radius: 50%;
content: "";
height: 1.5rem;
@@ -107,4 +108,4 @@ export default React.memo(styled(Toggle)`
position: absolute;
right: 3.5rem;
}
-`);
+`));
diff --git a/packages/react-components/src/styles/components.ts b/packages/react-components/src/styles/components.ts
index 53f74c7039..994f8e2369 100644
--- a/packages/react-components/src/styles/components.ts
+++ b/packages/react-components/src/styles/components.ts
@@ -1,11 +1,13 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
+
import { css } from 'styled-components';
export default css`
.ui--output {
- background: #fefefe;
+ background: ${({ theme }: ThemeProps) => theme.bgInput};
border-radius: 4px;
border: 1px dashed #eee;
box-sizing: border-box;
diff --git a/packages/react-components/src/styles/index.ts b/packages/react-components/src/styles/index.ts
index f8e47471dc..9da9acc724 100644
--- a/packages/react-components/src/styles/index.ts
+++ b/packages/react-components/src/styles/index.ts
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
+
import { createGlobalStyle } from 'styled-components';
import cssComponents from './components';
@@ -20,8 +22,8 @@ const PARTS = [0, 2, 4];
const defaultHighlight = '#f19135'; // '#f19135'; // #999
-function getHighlight (props: Props): string {
- return (props.uiHighlight || defaultHighlight);
+function getHighlight ({ uiHighlight }: Props): string {
+ return (uiHighlight || defaultHighlight);
}
function getContrast (props: Props): string {
@@ -33,7 +35,7 @@ function getContrast (props: Props): string {
: 'rgba(255, 253, 251, 0.875)';
}
-export default createGlobalStyle`
+export default createGlobalStyle`
.highlight--all {
background: ${getHighlight} !important;
border-color: ${getHighlight} !important;
@@ -58,7 +60,7 @@ export default createGlobalStyle`
.highlight--bg-faint,
.highlight--bg-light {
- background: white;
+ background: ${({ theme }) => theme.bgTable};
position: relative;
&:before {
@@ -98,7 +100,7 @@ export default createGlobalStyle`
}
.highlight--gradient {
- background: ${(props: Props) => `linear-gradient(90deg, ${props.uiHighlight || defaultHighlight}, transparent)`};
+ background: ${({ uiHighlight }: Props) => `linear-gradient(90deg, ${uiHighlight || defaultHighlight}, transparent)`};
}
.highlight--hover-bg:hover {
@@ -177,14 +179,12 @@ export default createGlobalStyle`
}
}
- .theme--default {
- .ui--Tabs-Tab.tabLinkActive {
- border-bottom-color: ${getHighlight};
- }
-
- .ui.negative.button,
- .ui.buttons .negative.button {
- background: #666 !important;
+ .theme--dark,
+ .theme--light {
+ .ui--Tabs {
+ .ui--Tab.tabLinkActive {
+ border-bottom-color: ${getHighlight};
+ }
}
.ui.primary.button,
@@ -213,7 +213,8 @@ export default createGlobalStyle`
}
#root {
- color: #4e4e4e;
+ background: ${({ theme }) => theme.bgPage};
+ color: ${({ theme }) => theme.color};
font-family: sans-serif;
height: 100%;
}
@@ -223,7 +224,7 @@ export default createGlobalStyle`
}
article {
- background: white;
+ background: ${({ theme }) => theme.bgTable};
border: 1px solid #f2f2f2;
border-radius: 0.25rem;
box-sizing: border-box;
@@ -297,7 +298,6 @@ export default createGlobalStyle`
}
body {
- background: #f5f3f1;
height: 100%;
margin: 0;
}
@@ -330,7 +330,7 @@ export default createGlobalStyle`
}
h1, h2, h3, h4, h5 {
- color: rgba(0, 0, 0, .6);
+ color: ${({ theme }) => theme.colorSummary};
font-family: sans-serif;
font-weight: 100;
}
@@ -363,7 +363,7 @@ export default createGlobalStyle`
label {
box-sizing: border-box;
- color: rgba(78, 78, 78, .66);
+ color: ${({ theme }) => theme.colorLabel};
display: block;
font-family: sans-serif;
font-size: 1rem;
diff --git a/packages/react-components/src/styles/semantic.ts b/packages/react-components/src/styles/semantic.ts
index 66ca00c709..43040cff70 100644
--- a/packages/react-components/src/styles/semantic.ts
+++ b/packages/react-components/src/styles/semantic.ts
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
+import { ThemeProps } from '../types';
+
import { css } from 'styled-components';
export default css`
@@ -21,7 +23,13 @@ export default css`
.ui.selection.dropdown,
.ui.input > input {
- color: inherit;
+ background: ${({ theme }: ThemeProps) => theme.bgInput};
+ color: ${({ theme }: ThemeProps) => theme.color};
+
+ &:focus {
+ background: ${({ theme }: ThemeProps) => theme.bgInput};
+ color: ${({ theme }: ThemeProps) => theme.color};
+ }
}
.ui.action.input > .buttons {
@@ -39,21 +47,40 @@ export default css`
}
}
+ &.selection.visible {
+ background: ${({ theme }: ThemeProps) => theme.bgInput};
+ color: ${({ theme }: ThemeProps) => theme.color};
+ }
+
+ .menu {
+ background: ${({ theme }: ThemeProps) => theme.bgInput};
+ color: ${({ theme }: ThemeProps) => theme.color};
+
+ > .item {
+ border-color: transparent !important;
+ color: ${({ theme }: ThemeProps) => theme.color} !important;
+
+ &.header.disabled {
+ margin: 1em 0 0 0;
+ opacity: 1;
+
+ &:hover,
+ &.selected {
+ background: ${({ theme }: ThemeProps) => theme.bgInput};
+ }
+ }
+ }
+ }
+
> .text {
min-height: 1em;
+
+ &:not(.default) {
+ color: ${({ theme }: ThemeProps) => theme.color} !important;
+ }
}
}
- .ui.dropdown .menu > .item.header.disabled {
- margin: 1em 0 0 0;
- opacity: 1;
- }
-
- .ui.dropdown .menu > .item.header.disabled:hover,
- .ui.dropdown .menu > .item.header.disabled.selected {
- background: white;
- }
-
.ui.input {
width: 100%;
@@ -96,9 +123,9 @@ export default css`
}
.ui.modal {
- background: #f9f8f7;
+ background: ${({ theme }: ThemeProps) => theme.bgPage};
box-shadow: none;
- color: #4e4e4e;
+ color: ${({ theme }: ThemeProps) => theme.color};
font-family: sans-serif;
> .actions,
@@ -116,7 +143,7 @@ export default css`
> .header:not(.ui) {
background: transparent;
border-bottom: none;
- color: rgba(0, 0, 0, .6);
+ color: ${({ theme }: ThemeProps) => theme.colorSummary};
font-family: sans-serif;
font-size: 1.75rem;
font-weight: 100;
@@ -139,6 +166,15 @@ export default css`
display: flex !important;
}
+ .ui.popup {
+ background: ${({ theme }: ThemeProps) => theme.bgMenu};
+ color: ${({ theme }: ThemeProps) => theme.color};
+
+ .ui.text.menu .item {
+ color: ${({ theme }: ThemeProps) => theme.color};
+ }
+ }
+
.ui.secondary.vertical.menu > .item {
margin: 0;
}
diff --git a/packages/react-components/src/styles/theme.ts b/packages/react-components/src/styles/theme.ts
index f7812fbdd5..1f2975a035 100644
--- a/packages/react-components/src/styles/theme.ts
+++ b/packages/react-components/src/styles/theme.ts
@@ -20,8 +20,9 @@ export const colorBtnText = '#f9f8f7';
export const colorLink = '#2e86ab';
export default css`
- .theme--default {
- a {
+ .theme--dark,
+ .theme--light {
+ a:not(.ui--Tab) {
color: ${colorLink};
&:hover,
@@ -41,5 +42,10 @@ export default css`
.ui.modal > .header:not(.ui) {
border-bottom-color: ${colorBtnDefault};
}
+
+ .ui.negative.button,
+ .ui.buttons .negative.button {
+ background: #666 !important;
+ }
}
`;
diff --git a/packages/react-components/src/types.ts b/packages/react-components/src/types.ts
index 5c993af9a3..87249dbcb4 100644
--- a/packages/react-components/src/types.ts
+++ b/packages/react-components/src/types.ts
@@ -124,3 +124,25 @@ export interface NullContract {
abi: null;
address: null;
}
+
+export interface ThemeDef {
+ bgInput: string;
+ bgInverse: string;
+ bgMenu: string;
+ bgMenuHover: string;
+ bgPage: string;
+ bgTable: string;
+ bgTabs: string;
+ bgToggle: string;
+ borderTable: string;
+ borderTabs: string;
+ color: string;
+ colorError: string;
+ colorLabel: string;
+ colorSummary: string;
+ theme: 'dark' | 'light';
+}
+
+export interface ThemeProps {
+ theme: ThemeDef;
+}