From f22c044aa67646dee3537375eec40b36e6c192b3 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Tue, 17 Sep 2019 17:49:29 +0400 Subject: [PATCH] Fix safe list colors --- src/components/Header/component/Layout.jsx | 6 +-- src/components/Sidebar/SafeList.jsx | 63 ++++++++++++++++++++++ src/components/Sidebar/index.jsx | 17 ++++-- src/components/Sidebar/style.js | 4 +- src/theme/variables.js | 2 + 5 files changed, 84 insertions(+), 8 deletions(-) create mode 100644 src/components/Sidebar/SafeList.jsx diff --git a/src/components/Header/component/Layout.jsx b/src/components/Header/component/Layout.jsx index 00007aa2..17d8edc0 100644 --- a/src/components/Header/component/Layout.jsx +++ b/src/components/Header/component/Layout.jsx @@ -12,14 +12,14 @@ import Col from '~/components/layout/Col' import Img from '~/components/layout/Img' import Row from '~/components/layout/Row' import Spacer from '~/components/Spacer' -import { border, sm, md } from '~/theme/variables' +import { + border, sm, md, headerHeight, +} from '~/theme/variables' import Provider from './Provider' import SafeListHeader from './SafeListHeader' const logo = require('../assets/gnosis-safe-logo.svg') -export const headerHeight = '53px' - type Props = Open & { classes: Object, providerDetails: React.Node, diff --git a/src/components/Sidebar/SafeList.jsx b/src/components/Sidebar/SafeList.jsx new file mode 100644 index 00000000..d2522d42 --- /dev/null +++ b/src/components/Sidebar/SafeList.jsx @@ -0,0 +1,63 @@ +// @flow +import * as React from 'react' +import { makeStyles } from '@material-ui/core/styles' +import { List } from 'immutable' +import MuiList from '@material-ui/core/List' +import ListItem from '@material-ui/core/ListItem' +import ListItemIcon from '@material-ui/core/ListItemIcon' +import ListItemText from '@material-ui/core/ListItemText' +import Link from '~/components/layout/Link' +import Hairline from '~/components/layout/Hairline' +import Identicon from '~/components/Identicon' +import { sm, secondary, primary } from '~/theme/variables' +import { shortVersionOf } from '~/logic/wallets/ethAddresses' +import { type Safe } from '~/routes/safe/store/models/safe' +import { SAFELIST_ADDRESS } from '~/routes/routes' + +type SafeListProps = { + safes: List, +} + +const useStyles = makeStyles({ + icon: { + marginRight: sm, + }, + listItemRoot: { + paddingTop: 0, + paddingBottom: 0, + }, + safeName: { + color: secondary, + }, + safeAddress: { + color: primary, + }, +}) + +const SafeList = ({ safes }: SafeListProps) => { + const classes = useStyles() + + return ( + + {safes.map((safe) => ( + + + + + + + + + + + + ))} + + ) +} + +export default SafeList diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx index 6ae6086a..d8432158 100644 --- a/src/components/Sidebar/index.jsx +++ b/src/components/Sidebar/index.jsx @@ -1,7 +1,12 @@ // @flow import * as React from 'react' +import { List } from 'immutable' +import { connect } from 'react-redux' import Drawer from '@material-ui/core/Drawer' +import { type Safe } from '~/routes/safe/store/models/safe' +import { safesListSelector } from '~/routes/safeList/store/selectors' import useSidebarStyles from './style' +import SafeList from './SafeList' const { useState } = React @@ -17,9 +22,10 @@ export const SidebarContext = React.createContext({ type SidebarProps = { children: React.Node, + safes: List, } -const Sidebar = ({ children }: SidebarProps) => { +const Sidebar = ({ children, safes }: SidebarProps) => { const [isOpen, setIsOpen] = useState(false) const classes = useSidebarStyles() @@ -33,14 +39,19 @@ const Sidebar = ({ children }: SidebarProps) => { className={classes.sidebar} open={isOpen} onKeyDown={toggleSidebar} + onClick={toggleSidebar} classes={{ paper: classes.sidebarPaper }} >
- Wop + {children} ) } -export default Sidebar +export default connect( + // $FlowFixMe + (state) => ({ safes: safesListSelector(state) }), + null, +)(Sidebar) diff --git a/src/components/Sidebar/style.js b/src/components/Sidebar/style.js index fd5fa0c5..73945689 100644 --- a/src/components/Sidebar/style.js +++ b/src/components/Sidebar/style.js @@ -1,6 +1,6 @@ // @flow import { makeStyles } from '@material-ui/core/styles' -import { headerHeight } from '~/components/Header/component/Layout' +import { headerHeight } from '~/theme/variables' const sidebarWidth = '400px' @@ -12,7 +12,7 @@ const useSidebarStyles = makeStyles({ width: sidebarWidth, }, headerPlaceholder: { - height: headerHeight, + height: headerHeight, // for some reason it didn't want to work with an imported variable 🤔 }, }) diff --git a/src/theme/variables.js b/src/theme/variables.js index e7143318..84d9f9ea 100644 --- a/src/theme/variables.js +++ b/src/theme/variables.js @@ -17,6 +17,7 @@ const lg = '24px' const xl = '32px' const xxl = '40px' const marginButtonImg = '12px' +const headerHeight = '53px' module.exports = { primary, @@ -29,6 +30,7 @@ module.exports = { warning: warningColor, error: errorColor, connected: connectedColor, + headerHeight, xs, sm, md,