-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add cache call functionality and work on identicon
- Loading branch information
Showing
5 changed files
with
100 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { List, Popover } from 'antd' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import ReactBlockies from 'react-blockies' | ||
import styled from 'styled-components/macro' | ||
import { useDrizzle } from '../temp/drizzle-react-hooks' | ||
|
||
const StyledDiv = styled.div` | ||
line-height: 100%; | ||
` | ||
const StyledReactBlockies = styled(ReactBlockies)` | ||
border-radius: ${({ large }) => (large ? '4' : '16')}px; | ||
` | ||
const Identicon = ({ large, pinakion: _pinakion }) => { | ||
const { drizzle, drizzleState } = useDrizzle() | ||
const content = ( | ||
<StyledDiv> | ||
<StyledReactBlockies | ||
large={large} | ||
scale={large ? 7 : 4} | ||
seed={drizzleState.accounts[0].toLowerCase()} | ||
size={large ? 14 : 8} | ||
/> | ||
</StyledDiv> | ||
) | ||
return large ? ( | ||
content | ||
) : ( | ||
<Popover | ||
arrowPointAtCenter | ||
content={ | ||
<List> | ||
<List.Item> | ||
<List.Item.Meta | ||
description={`${drizzleState.accounts[0].slice( | ||
0, | ||
6 | ||
)}...${drizzleState.accounts[0].slice( | ||
drizzleState.accounts[0].length - 4 | ||
)}`} | ||
title="Address" | ||
/> | ||
</List.Item> | ||
<List.Item> | ||
<List.Item.Meta | ||
description={Number( | ||
drizzle.web3.utils.fromWei( | ||
drizzleState.accountBalances[drizzleState.accounts[0]] | ||
) | ||
).toFixed(4)} | ||
title="ETH" | ||
/> | ||
</List.Item> | ||
</List> | ||
} | ||
placement="bottomRight" | ||
title="Your Account" | ||
trigger="click" | ||
> | ||
{content} | ||
</Popover> | ||
) | ||
} | ||
|
||
Identicon.propTypes = { | ||
large: PropTypes.bool, | ||
pinakion: PropTypes.bool | ||
} | ||
|
||
Identicon.defaultProps = { | ||
large: false, | ||
pinakion: false | ||
} | ||
|
||
export default Identicon |
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