From 2956e15d045dc36241a89f3ce01c1f6579284009 Mon Sep 17 00:00:00 2001 From: Amir Hossein Salar Date: Tue, 26 Jan 2021 08:52:22 +0330 Subject: [PATCH 1/5] changes for add theme modal --- .../OperatorControls/_OperatorControls.scss | 10 + .../OperatorControls/components/AddTheme.js | 213 ++++++++++-------- .../OperatorControls/components/ColorInput.js | 2 +- web/src/index.css | 7 + 4 files changed, 141 insertions(+), 91 deletions(-) diff --git a/web/src/containers/OperatorControls/_OperatorControls.scss b/web/src/containers/OperatorControls/_OperatorControls.scss index c12b7abacb..9ae04d319d 100644 --- a/web/src/containers/OperatorControls/_OperatorControls.scss +++ b/web/src/containers/OperatorControls/_OperatorControls.scss @@ -296,3 +296,13 @@ $operator-controls__panel-border-color: #a7a7a7; border: none !important; } } + +.operator-button_underline { + &.ant-btn > span { + text-decoration: underline; + } + &.ant-btn-link { + padding: 4px 8px; + color: white; + } +} diff --git a/web/src/containers/OperatorControls/components/AddTheme.js b/web/src/containers/OperatorControls/components/AddTheme.js index e61ab07f3f..1a019c1fe4 100644 --- a/web/src/containers/OperatorControls/components/AddTheme.js +++ b/web/src/containers/OperatorControls/components/AddTheme.js @@ -2,7 +2,11 @@ import React, { Component } from 'react'; import Modal from 'components/Dialog/DesktopDialog'; import { bool, object, func, string } from 'prop-types'; import { Input, Button, Radio, Divider, Collapse, Tooltip } from 'antd'; -import { UndoOutlined, BgColorsOutlined } from '@ant-design/icons'; +import { + UndoOutlined, + BgColorsOutlined, + CaretDownOutlined, +} from '@ant-design/icons'; import initialTheme, { nestedColors as nestedStructure, } from 'config/colors/light'; @@ -244,99 +248,128 @@ class AddTheme extends Component { )}
- {Object.entries(nestedStructure).map(([clusterKey, clusterObj]) => { - const renderCollapse = clusterKey === 'base' && isSingleBase; + {Object.entries(nestedStructure) + .filter( + ([clusterKey, clusterObj]) => + !isSingleBase || clusterKey === 'base' + ) + .map(([clusterKey, clusterObj]) => { + const renderCollapse = clusterKey === 'base' && isSingleBase; - return ( -
- - - {clusterKey} - - - {renderCollapse ? ( - - - {Object.keys(clusterObj) - .filter( - (localColorKey) => localColorKey === 'background' - ) - .map((localColorKey) => { - const colorKey = `${clusterKey}_${localColorKey}`; - const isCalculated = this.isCalculated(colorKey); - const colorValue = isCalculated - ? baseRatios[colorKey] - : theme[colorKey]; + return ( +
+ + + {clusterKey} + + + {renderCollapse ? ( + + + {Object.keys(clusterObj) + .filter( + (localColorKey) => localColorKey === 'background' + ) + .map((localColorKey) => { + const colorKey = `${clusterKey}_${localColorKey}`; + const isCalculated = this.isCalculated(colorKey); + const colorValue = isCalculated + ? baseRatios[colorKey] + : theme[colorKey]; - return ( - - ); - })} - - - {Object.keys(clusterObj) - .filter( - (localColorKey) => localColorKey !== 'background' - ) - .map((localColorKey) => { - const colorKey = `${clusterKey}_${localColorKey}`; - const isCalculated = this.isCalculated(colorKey); - const colorValue = isCalculated - ? baseRatios[colorKey] - : theme[colorKey]; + return ( + + ); + })} + + + Modify theme breakdown + + } + key="2" + > + {Object.keys(clusterObj) + .filter( + (localColorKey) => localColorKey !== 'background' + ) + .map((localColorKey) => { + const colorKey = `${clusterKey}_${localColorKey}`; + const isCalculated = this.isCalculated(colorKey); + const colorValue = isCalculated + ? baseRatios[colorKey] + : theme[colorKey]; - return ( - - ); - })} - - - ) : ( -
- {Object.keys(clusterObj).map((localColorKey) => { - const colorKey = `${clusterKey}_${localColorKey}`; - const isCalculated = this.isCalculated(colorKey); - const colorValue = isCalculated - ? baseRatios[colorKey] - : theme[colorKey]; + return ( + + ); + })} + {isSingleBase && ( +
+ + To edit more colors directly try switching to the + + + configuration +
+ )} + + + ) : ( +
+ {Object.keys(clusterObj).map((localColorKey) => { + const colorKey = `${clusterKey}_${localColorKey}`; + const isCalculated = this.isCalculated(colorKey); + const colorValue = isCalculated + ? baseRatios[colorKey] + : theme[colorKey]; - return ( - - ); - })} -
- )} -
- ); - })} + return ( + + ); + })} +
+ )} +
+ ); + })}
-
-
Theme:
- -
-
- - - - Use separated base - - - - - Use single base - - - - {/*{isSingleBase && (*/} - {/*
*/} - {/**/} - {/*Darken*/} - {/*Lighten*/} - {/**/} - {/*
*/} - {/*)}*/} -
-
- {Object.entries(nestedStructure) - .filter( - ([clusterKey, clusterObj]) => - !isSingleBase || clusterKey === 'base' - ) - .map(([clusterKey, clusterObj]) => { - const renderCollapse = clusterKey === 'base' && isSingleBase; - - return ( -
- - - {clusterKey} - - - {renderCollapse ? ( - - - {Object.keys(clusterObj) - .filter( - (localColorKey) => localColorKey === 'background' - ) - .map((localColorKey) => { - const colorKey = `${clusterKey}_${localColorKey}`; - const isCalculated = this.isCalculated(colorKey); - const colorValue = isCalculated - ? baseRatios[colorKey] - : theme[colorKey]; + {!upstreamSelected && ( + +
+ Select the base color type. This can be directly edited later in + the separated base color settings. +
+
+ + Light based theme + Dark based theme + +
+
+ )} + {upstreamSelected && ( + +
+
Theme:
+ +
+
+ + + + Use separated base + + + + + Use single base + + + + {/*{isSingleBase && (*/} + {/*
*/} + {/**/} + {/*Darken*/} + {/*Lighten*/} + {/**/} + {/*
*/} + {/*)}*/} +
+
+ {Object.entries(nestedStructure) + .filter( + ([clusterKey, clusterObj]) => + !isSingleBase || clusterKey === 'base' + ) + .map(([clusterKey, clusterObj]) => { + const renderCollapse = clusterKey === 'base' && isSingleBase; - return ( - - ); - })} - - - Modify theme breakdown - - } - key="2" - > - {Object.keys(clusterObj) - .filter( - (localColorKey) => localColorKey !== 'background' - ) - .map((localColorKey) => { + return ( +
+ + + {clusterKey} + + + {renderCollapse ? ( + + + {Object.keys(clusterObj) + .filter( + (localColorKey) => + localColorKey === 'background' + ) + .map((localColorKey) => { + const colorKey = `${clusterKey}_${localColorKey}`; + const isCalculated = this.isCalculated( + colorKey + ); + const colorValue = isCalculated + ? baseRatios[colorKey] + : theme[colorKey]; + + return ( + + ); + })} + + + Modify theme breakdown + + } + key="2" + > + {Object.keys(clusterObj) + .filter( + (localColorKey) => + localColorKey !== 'background' + ) + .map((localColorKey) => { + const colorKey = `${clusterKey}_${localColorKey}`; + const isCalculated = this.isCalculated( + colorKey + ); + const colorValue = isCalculated + ? baseRatios[colorKey] + : theme[colorKey]; + + return ( + + ); + })} + {isSingleBase && ( +
+ + To edit more colors directly try switching to + the + + + configuration +
+ )} +
+
+ ) : ( +
+ {Object.keys(clusterObj).map((localColorKey) => { const colorKey = `${clusterKey}_${localColorKey}`; const isCalculated = this.isCalculated(colorKey); const colorValue = isCalculated @@ -330,66 +426,38 @@ class AddTheme extends Component { /> ); })} - {isSingleBase && ( -
- - To edit more colors directly try switching to the - - - configuration -
- )} - - - ) : ( -
- {Object.keys(clusterObj).map((localColorKey) => { - const colorKey = `${clusterKey}_${localColorKey}`; - const isCalculated = this.isCalculated(colorKey); - const colorValue = isCalculated - ? baseRatios[colorKey] - : theme[colorKey]; - - return ( - - ); - })} +
+ )}
- )} -
- ); - })} -
+ ); + })} +
+ + )}
- + {upstreamSelected ? ( + + ) : ( + + )}
); From ec26139e8e0035cbf4bda994f52c97ded56232a5 Mon Sep 17 00:00:00 2001 From: Amir Hossein Salar Date: Tue, 26 Jan 2021 11:36:40 +0330 Subject: [PATCH 5/5] changes for theme breakdown --- web/src/config/colors/light.js | 2 +- web/src/utils/color.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/src/config/colors/light.js b/web/src/config/colors/light.js index 38f7fd13ca..0df99ef413 100644 --- a/web/src/config/colors/light.js +++ b/web/src/config/colors/light.js @@ -4,7 +4,7 @@ const options = { safe: true, delimiter: '_' }; export const nestedColors = { base: { background: '#f8f8f8', - 'top-bar-navigation': '#f3f3f3', + 'top-bar-navigation': '#000000', 'secondary-navigation-bar': '#e9e9e9', 'wallet-sidebar-and-popup': '#f8f8f8', footer: '#000000', diff --git a/web/src/utils/color.js b/web/src/utils/color.js index fdc8b7d23c..f6f7d12dd2 100644 --- a/web/src/utils/color.js +++ b/web/src/utils/color.js @@ -155,10 +155,10 @@ export const filterTheme = (theme) => { }; export const CALCULATED_COLOR_RATIO_OBJECT = { - 'base_top-bar-navigation': 0.7, - 'base_secondary-navigation-bar': 0.5, - 'base_wallet-sidebar-and-popup': 0.3, - base_footer: 0.6, + 'base_top-bar-navigation': 1, + 'base_secondary-navigation-bar': 0.1, + 'base_wallet-sidebar-and-popup': 0, + base_footer: 1, }; export const CALCULATED_COLOR_KEYS = Object.keys(CALCULATED_COLOR_RATIO_OBJECT);