mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
F OpenNebula/one#5422: Refactor
This commit is contained in:
parent
7ccd5fdac9
commit
142b37f7ee
@ -14,12 +14,13 @@
|
||||
* limitations under the License. *
|
||||
* ------------------------------------------------------------------------- */
|
||||
import Color from 'client/constants/color'
|
||||
import { SCHEMES } from 'client/constants'
|
||||
|
||||
/**
|
||||
* @param {string} scheme - Scheme type: 'dark' or 'light'
|
||||
* @param {SCHEMES} scheme - Scheme type
|
||||
* @returns {object} Provision theme
|
||||
*/
|
||||
const theme = (scheme = 'dark') => ({
|
||||
const theme = (scheme = SCHEMES.DARK) => ({
|
||||
palette: {
|
||||
type: scheme,
|
||||
common: {
|
||||
@ -27,8 +28,8 @@ const theme = (scheme = 'dark') => ({
|
||||
white: '#ffffff'
|
||||
},
|
||||
background: {
|
||||
paper: scheme === 'dark' ? '#2a2d3d' : '#ffffff',
|
||||
default: scheme === 'dark' ? '#222431' : '#f2f4f8'
|
||||
paper: scheme === SCHEMES.DARK ? '#2a2d3d' : '#ffffff',
|
||||
default: scheme === SCHEMES.DARK ? '#222431' : '#f2f4f8'
|
||||
},
|
||||
primary: {
|
||||
light: '#2a2d3d',
|
||||
|
@ -14,12 +14,13 @@
|
||||
* limitations under the License. *
|
||||
* ------------------------------------------------------------------------- */
|
||||
import Color from 'client/constants/color'
|
||||
import { SCHEMES } from 'client/constants'
|
||||
|
||||
/**
|
||||
* @param {string} scheme - Scheme type: 'dark' or 'light'
|
||||
* @returns {object} Sunstone theme
|
||||
* @param {SCHEMES} scheme - Scheme type
|
||||
* @returns {object} Provision theme
|
||||
*/
|
||||
const theme = (scheme = 'dark') => ({
|
||||
const theme = (scheme = SCHEMES.DARK) => ({
|
||||
palette: {
|
||||
type: scheme,
|
||||
common: {
|
||||
@ -27,8 +28,8 @@ const theme = (scheme = 'dark') => ({
|
||||
white: '#ffffff'
|
||||
},
|
||||
background: {
|
||||
paper: scheme === 'dark' ? '#2a2d3d' : '#ffffff',
|
||||
default: scheme === 'dark' ? '#222431' : '#f2f4f8'
|
||||
paper: scheme === SCHEMES.DARK ? '#2a2d3d' : '#ffffff',
|
||||
default: scheme === SCHEMES.DARK ? '#222431' : '#f2f4f8'
|
||||
},
|
||||
primary: {
|
||||
light: '#2a2d3d',
|
||||
|
@ -15,6 +15,8 @@
|
||||
* ------------------------------------------------------------------------- */
|
||||
import { makeStyles } from '@material-ui/core'
|
||||
|
||||
import { SCHEMES } from 'client/constants'
|
||||
|
||||
const styles = makeStyles(theme => ({
|
||||
root: ({ isSelected }) => ({
|
||||
height: '100%',
|
||||
@ -62,7 +64,7 @@ const styles = makeStyles(theme => ({
|
||||
filter: ({ isSelected, disableFilterImage }) =>
|
||||
disableFilterImage
|
||||
? 'none'
|
||||
: (theme.palette.type === 'dark' || isSelected)
|
||||
: (theme.palette.type === SCHEMES.DARK || isSelected)
|
||||
? 'contrast(0) brightness(2)'
|
||||
: 'contrast(0) brightness(0.8)'
|
||||
},
|
||||
|
@ -20,10 +20,11 @@ import clsx from 'clsx'
|
||||
import { Paper, Typography, makeStyles, lighten, darken } from '@material-ui/core'
|
||||
|
||||
import { addOpacityToColor } from 'client/utils'
|
||||
import { SCHEMES } from 'client/constants'
|
||||
|
||||
const useStyles = makeStyles(theme => {
|
||||
const getBackgroundColor = theme.palette.type === 'dark' ? darken : lighten
|
||||
const getContrastBackgroundColor = theme.palette.type === 'light' ? darken : lighten
|
||||
const getBackgroundColor = theme.palette.type === SCHEMES.DARK ? darken : lighten
|
||||
const getContrastBackgroundColor = theme.palette.type === SCHEMES.LIGHT ? darken : lighten
|
||||
|
||||
return {
|
||||
root: {
|
||||
|
@ -18,10 +18,11 @@ import PropTypes from 'prop-types'
|
||||
|
||||
import { makeStyles, Typography, lighten, darken } from '@material-ui/core'
|
||||
import { addOpacityToColor } from 'client/utils'
|
||||
import { SCHEMES } from 'client/constants'
|
||||
|
||||
const useStyles = makeStyles(theme => {
|
||||
const getBackgroundColor = theme.palette.type === 'dark' ? lighten : darken
|
||||
const defaultStateColor = theme.palette.grey[theme.palette.type === 'dark' ? 300 : 700]
|
||||
const getBackgroundColor = theme.palette.type === SCHEMES.DARK ? lighten : darken
|
||||
const defaultStateColor = theme.palette.grey[theme.palette.type === SCHEMES.DARK ? 300 : 700]
|
||||
|
||||
return {
|
||||
root: ({ stateColor = defaultStateColor }) => ({
|
||||
|
@ -13,6 +13,9 @@
|
||||
* See the License for the specific language governing permissions and *
|
||||
* limitations under the License. *
|
||||
* ------------------------------------------------------------------------- */
|
||||
/**
|
||||
* @enum {string} Scheme type
|
||||
*/
|
||||
export const SCHEMES = {
|
||||
SYSTEM: 'system',
|
||||
DARK: 'dark',
|
||||
|
@ -17,9 +17,11 @@ import React, { memo } from 'react'
|
||||
import { number, string, bool, oneOfType } from 'prop-types'
|
||||
import { useTheme } from '@material-ui/core'
|
||||
|
||||
import { SCHEMES } from 'client/constants'
|
||||
|
||||
const Logo = memo(({ width, height, spinner, withText, viewBox, ...props }) => {
|
||||
const { palette: { type } } = useTheme()
|
||||
const isDarkMode = type === 'dark'
|
||||
const isDarkMode = type === SCHEMES.DARK
|
||||
|
||||
const cloudColor = {
|
||||
child1: { from: '#bfe6f2', to: '#ffffff', static: isDarkMode ? '#ffffff' : '#bfe6f2' },
|
||||
|
Loading…
x
Reference in New Issue
Block a user