-
Notifications
You must be signed in to change notification settings - Fork 55
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 #555 from invariant-labs/dev
Bump staging
- Loading branch information
Showing
24 changed files
with
582 additions
and
11,777 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*out | ||
/dev-logs |
Binary file not shown.
Binary file not shown.
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
20 changes: 20 additions & 0 deletions
20
src/components/NewPosition/MarketIdLabel/MarketIdLabel.stories.tsx
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,20 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import MarketIdLabel from './MarketIdLabel' | ||
|
||
storiesOf('position/marketIdLabel', module).add('default', () => { | ||
return ( | ||
<div | ||
style={{ | ||
backgroundColor: '#202946', | ||
padding: 20, | ||
width: 300 | ||
}}> | ||
<MarketIdLabel | ||
marketId='as8d9asdjkl1239871aslkdjas0d978as123hjasjdh' | ||
displayLength={9} | ||
copyPoolAddressHandler={() => {}} | ||
/> | ||
</div> | ||
) | ||
}) |
42 changes: 42 additions & 0 deletions
42
src/components/NewPosition/MarketIdLabel/MarketIdLabel.tsx
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,42 @@ | ||
import React from 'react' | ||
import { Typography } from '@material-ui/core' | ||
import { useLabelStyles } from './style' | ||
import FileCopyOutlinedIcon from '@material-ui/icons/FileCopyOutlined' | ||
import { Color } from '@material-ui/lab' | ||
|
||
export interface IProps { | ||
displayLength: number | ||
marketId: string | ||
copyPoolAddressHandler: (message: string, variant: Color) => void | ||
style?: React.CSSProperties | ||
} | ||
|
||
export const MarketIdLabel: React.FC<IProps> = ({ | ||
displayLength, | ||
marketId, | ||
copyPoolAddressHandler, | ||
style | ||
}) => { | ||
const classes = useLabelStyles() | ||
|
||
const copyToClipboard = () => { | ||
navigator.clipboard | ||
.writeText(marketId) | ||
.then(() => { | ||
copyPoolAddressHandler('Market ID copied to Clipboard', 'success') | ||
}) | ||
.catch(() => { | ||
copyPoolAddressHandler('Failed to copy Market ID to Clipboard', 'error') | ||
}) | ||
} | ||
|
||
return ( | ||
<Typography className={classes.marketId} style={style}> | ||
Market ID: {marketId.slice(0, displayLength)}... | ||
{marketId.slice(marketId.length - displayLength, marketId.length)}{' '} | ||
<FileCopyOutlinedIcon className={classes.clipboardIcon} onClick={copyToClipboard} /> | ||
</Typography> | ||
) | ||
} | ||
|
||
export default MarketIdLabel |
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,20 @@ | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import { colors } from '@static/theme' | ||
|
||
export const useLabelStyles = makeStyles(() => ({ | ||
marketId: { | ||
fontFamily: 'Mukta', | ||
fontSize: 16, | ||
fontWeight: 400, | ||
lineHeight: '20px', | ||
letterSpacing: '-0.03px', | ||
textAlign: 'right', | ||
color: `${colors.invariant.textGrey} !important`, | ||
paddingRight: 7 | ||
}, | ||
clipboardIcon: { | ||
width: 15, | ||
height: 13, | ||
cursor: 'pointer' | ||
} | ||
})) |
Oops, something went wrong.