Skip to content

Commit

Permalink
feat: new Sidebar design (safe-global#93)
Browse files Browse the repository at this point in the history
* feat: theme

* feat: redesign Safe sidebar

* fix: lint + theme import

* fix: add `alt`s

* feat: Safe list drawer

* fix: Safe list navigation

* fix: restructure sidebar folder

* fix: adjust hooks

* fix: split component, adjust currency logic + lint

* fix: extract function

* feat: basis of new Safe list

* fix: adjust secondary action

* fix: add tests

* test: SVG icons

* Revert "test: SVG icons"

This reverts commit b5cdc1f.

* fix: highlight icon + scroll to Safe

* fix: test

* feat: Safe list context menu + review fixes

* fix: move assets + style context menu

* fix: update theme typography

* fix: styles + open drawer

* fix: styles

* fix: hydration error

* fix: make entire Safe list scrollable

* fix: address review comments

* fix: balance

* fix: test

* fix: tweak styles + add optional chain
  • Loading branch information
iamacook authored Jun 20, 2022
1 parent 5a1d1cb commit 6d89cd8
Show file tree
Hide file tree
Showing 55 changed files with 1,659 additions and 435 deletions.
24 changes: 15 additions & 9 deletions components/common/Identicon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import { ReactElement, useMemo } from 'react'
import { ReactElement, useMemo, CSSProperties } from 'react'
import makeBlockie from 'ethereum-blockies-base64'
import Skeleton from '@mui/material/Skeleton'

import css from './styles.module.css'

interface IdenticonProps {
export interface IdenticonProps {
address: string
}

const Identicon = ({ address }: IdenticonProps): ReactElement => {
const iconSrc = useMemo<string>(() => {
if (!address) return ''
try {
return makeBlockie(address)
} catch (e) {
return ''
const style = useMemo<CSSProperties | null>(() => {
if (!address) {
return null
}

let blockie = ''
try {
blockie = makeBlockie(address)
} catch (e) {}

return blockie ? { backgroundImage: `url(${blockie})` } : null
}, [address])

return <div className={css.icon} style={{ backgroundImage: `url(${iconSrc})` }} />
return !style ? <Skeleton variant="circular" width={40} height={40} /> : <div className={css.icon} style={style} />
}

export default Identicon
1 change: 0 additions & 1 deletion components/common/Identicon/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
min-width: 20px;
min-height: 20px;
border-radius: 50%;
background-color: #eee;
background-size: cover;
}
161 changes: 0 additions & 161 deletions components/common/Navigation/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion components/common/PageLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, type ReactElement } from 'react'
import { Box, Drawer } from '@mui/material'

import Sidebar from '@/components/common/Sidebar'
import Sidebar from '@/components/sidebar/Sidebar'
import Header from '@/components/common//Header'
import css from './styles.module.css'

Expand Down
36 changes: 0 additions & 36 deletions components/common/SafeHeader/index.tsx

This file was deleted.

42 changes: 0 additions & 42 deletions components/common/SafeHeader/styles.module.css

This file was deleted.

36 changes: 36 additions & 0 deletions components/common/SafeIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { ReactElement } from 'react'
import { Box } from '@mui/material'

import css from './styles.module.css'
import Identicon, { type IdenticonProps } from '../Identicon'

interface ThresholdProps {
threshold: number | string
owners: number | string
}
const Threshold = ({ threshold, owners }: ThresholdProps): ReactElement => (
<Box
className={css.threshold}
sx={({ palette }) => ({
background: palette.primaryGreen[200],
// @ts-expect-error type '400' can't be used to index type 'PaletteColor'
color: palette.primary[400],
})}
>
{threshold}/{owners}
</Box>
)

interface SafeIconProps extends IdenticonProps {
threshold?: ThresholdProps['threshold']
owners?: ThresholdProps['owners']
}

const SafeIcon = ({ address, threshold, owners }: SafeIconProps): ReactElement => (
<div className={css.container}>
{threshold && owners && <Threshold threshold={threshold} owners={owners} />}
<Identicon address={address} />
</div>
)

export default SafeIcon
24 changes: 24 additions & 0 deletions components/common/SafeIcon/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.container {
position: relative;
height: 40px;
width: 40px;
}

.threshold {
position: absolute;
margin-top: -8px;
margin-left: -8px;
left: 36px;
z-index: 1;
border-radius: 100%;
font-size: 12px;
min-width: 25px;
min-height: 25px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
line-height: 16px;
font-weight: 700;
}
Loading

0 comments on commit 6d89cd8

Please sign in to comment.