This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from gnosis/74-safe-list-sidebar
Feature #74: Safe list sidebar
- Loading branch information
Showing
56 changed files
with
1,362 additions
and
1,007 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import { connect } from 'react-redux' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import IconButton from '@material-ui/core/IconButton' | ||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore' | ||
import ExpandLessIcon from '@material-ui/icons/ExpandLess' | ||
import Paragraph from '~/components/layout/Paragraph' | ||
import Col from '~/components/layout/Col' | ||
import { | ||
xs, sm, md, border, | ||
} from '~/theme/variables' | ||
import { safesCountSelector } from '~/routes/safe/store/selectors' | ||
import { SidebarContext } from '~/components/Sidebar' | ||
|
||
export const TOGGLE_SIDEBAR_BTN_TESTID = 'TOGGLE_SIDEBAR_BTN' | ||
|
||
const useStyles = makeStyles({ | ||
container: { | ||
flexGrow: 0, | ||
padding: `0 ${md}`, | ||
}, | ||
counter: { | ||
background: border, | ||
padding: xs, | ||
borderRadius: '3px', | ||
marginLeft: sm, | ||
lineHeight: 'normal', | ||
}, | ||
icon: { | ||
marginLeft: sm, | ||
}, | ||
}) | ||
|
||
type Props = { | ||
safesCount: number, | ||
} | ||
|
||
const { useContext } = React | ||
|
||
const SafeListHeader = ({ safesCount }: Props) => { | ||
const classes = useStyles() | ||
const { toggleSidebar, isOpen } = useContext(SidebarContext) | ||
|
||
return ( | ||
<Col start="xs" middle="xs" className={classes.container}> | ||
Safes | ||
{' '} | ||
<Paragraph size="xs" className={classes.counter}> | ||
{safesCount} | ||
</Paragraph> | ||
<IconButton | ||
onClick={toggleSidebar} | ||
className={classes.icon} | ||
aria-label="Expand Safe List" | ||
data-testid={TOGGLE_SIDEBAR_BTN_TESTID} | ||
> | ||
{isOpen ? <ExpandLessIcon /> : <ExpandMoreIcon color="secondary" />} | ||
</IconButton> | ||
</Col> | ||
) | ||
} | ||
|
||
export default connect<Object, Object, ?Function, ?Object>( | ||
// $FlowFixMe | ||
(state) => ({ safesCount: safesCountSelector(state) }), | ||
null, | ||
)(SafeListHeader) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import Img from '~/components/layout/Img' | ||
import Block from '~/components/layout/Block' | ||
import Paragraph from '~/components/layout/Paragraph' | ||
import { primary, sm } from '~/theme/variables' | ||
import StarIcon from './assets/star.svg' | ||
|
||
const useStyles = makeStyles({ | ||
container: { | ||
background: primary, | ||
padding: '5px', | ||
boxSizing: 'border-box', | ||
width: '73px', | ||
justifyContent: 'space-around', | ||
marginLeft: sm, | ||
color: '#fff', | ||
borderRadius: '3px', | ||
}, | ||
}) | ||
|
||
const DefaultBadge = () => { | ||
const classes = useStyles() | ||
|
||
return ( | ||
<Block align="left" className={classes.container}> | ||
<Img src={StarIcon} alt="Star Icon" /> | ||
<Paragraph noMargin size="xs"> | ||
default | ||
</Paragraph> | ||
</Block> | ||
) | ||
} | ||
|
||
export default DefaultBadge |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.