-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
318 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
import { SVGProps } from 'react'; | ||
|
||
const SvgDots = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
width="21" | ||
height="4" | ||
viewBox="0 0 21 4" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...props} | ||
> | ||
<circle cx="10.5" cy="2" r="2" fill="currentColor" /> | ||
<circle cx="18.5" cy="2" r="2" fill="currentColor" /> | ||
<circle cx="2.5" cy="2" r="2" fill="currentColor" /> | ||
</svg> | ||
); | ||
|
||
export default SvgDots; |
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,11 @@ | ||
import * as React from 'react'; | ||
import { SVGProps } from 'react'; | ||
|
||
const SvgExclamation = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg viewBox="0 0 3 18" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}> | ||
<circle cx="1.5" cy="16.5" r="1.5" fill="currentColor" /> | ||
<rect x="0.5" width="2" height="12" rx="1" fill="currentColor" /> | ||
</svg> | ||
); | ||
|
||
export default SvgExclamation; |
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,19 @@ | ||
import React from 'react'; | ||
import { withThemeProvider, withCenterStory } from 'stories/decorators'; | ||
import { VoteProposalUi } from '.'; | ||
|
||
export default { | ||
title: 'Components/VoteProposalUi', | ||
decorators: [withThemeProvider, withCenterStory({ width: 600 })], | ||
parameters: { | ||
backgrounds: { | ||
default: 'Default', | ||
}, | ||
}, | ||
}; | ||
|
||
export const Active = () => <VoteProposalUi status="active" />; | ||
export const Queued = () => <VoteProposalUi status="queued" />; | ||
export const ReadyToExecute = () => <VoteProposalUi status="readyToExecute" />; | ||
export const Executed = () => <VoteProposalUi status="executed" />; | ||
export const Cancelled = () => <VoteProposalUi status="cancelled" />; |
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,131 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import React from 'react'; | ||
import Paper from '@mui/material/Paper'; | ||
import Grid from '@mui/material/Grid'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
import { Icon } from '../Icon'; | ||
import { useStyles } from './styles'; | ||
|
||
type Status = 'active' | 'queued' | 'readyToExecute' | 'executed' | 'cancelled'; | ||
|
||
interface IStatusCard { | ||
status: Status; | ||
} | ||
|
||
const StatusCard: React.FC<IStatusCard> = ({ status }) => { | ||
const styles = useStyles(); | ||
|
||
switch (status) { | ||
case 'active': | ||
return ( | ||
<> | ||
<Typography css={styles.statusText} variant="body2"> | ||
stats | ||
</Typography> | ||
</> | ||
); | ||
case 'queued': | ||
return ( | ||
<> | ||
<div css={[styles.iconWrapper, styles.iconDotsWrapper]}> | ||
<Icon css={styles.icon} name="dots" /> | ||
</div> | ||
<Typography css={styles.statusText} variant="body2"> | ||
Queue | ||
</Typography> | ||
</> | ||
); | ||
case 'readyToExecute': | ||
return ( | ||
<> | ||
<div css={[styles.iconWrapper, styles.iconInfoWrapper]}> | ||
<Icon css={styles.icon} name="exclamation" /> | ||
</div> | ||
<Typography css={styles.statusText} variant="body2"> | ||
Ready to execute | ||
</Typography> | ||
</> | ||
); | ||
case 'executed': | ||
return ( | ||
<> | ||
<div css={[styles.iconWrapper, styles.iconMarkWrapper]}> | ||
<Icon css={[styles.icon, styles.iconCheck]} name="mark" /> | ||
</div> | ||
<Typography css={styles.statusText} variant="body2"> | ||
Executed | ||
</Typography> | ||
</> | ||
); | ||
default: | ||
case 'cancelled': | ||
return ( | ||
<> | ||
<div css={[styles.iconWrapper, styles.iconCloseWrapper]}> | ||
<Icon css={styles.icon} name="close" /> | ||
</div> | ||
<Typography css={styles.statusText} variant="body2"> | ||
Cancelled | ||
</Typography> | ||
</> | ||
); | ||
} | ||
}; | ||
|
||
interface IVoteProposalUiProps { | ||
className?: string; | ||
status: Status; | ||
} | ||
|
||
export const VoteProposalUi: React.FC<IVoteProposalUiProps> = ({ className, status }) => { | ||
const styles = useStyles(); | ||
return ( | ||
<Paper className={className} css={styles.root}> | ||
<Grid container> | ||
<Grid css={[styles.gridItem, styles.gridItemLeft]} item xs={12} sm={8}> | ||
<div css={styles.cardHeader}> | ||
<div css={styles.cardBadges}> | ||
<Typography | ||
variant="small2" | ||
color="textPrimary" | ||
css={[styles.cardBadgeItem, styles.cardBadgeNumber]} | ||
> | ||
#57 | ||
</Typography> | ||
<Typography | ||
variant="small2" | ||
color="textPrimary" | ||
css={[styles.cardBadgeItem, styles.cardBadgeActive]} | ||
> | ||
Active | ||
</Typography> | ||
</div> | ||
|
||
<Typography variant="small2">Not voted</Typography> | ||
</div> | ||
|
||
<Typography variant="h4" css={styles.cardTitle}> | ||
Buy back and burn and Tokenomic contribution finised soon | ||
</Typography> | ||
|
||
<div css={styles.cardFooter}> | ||
<Typography variant="small2"> | ||
Active until: | ||
<Typography variant="small2" color="textPrimary"> | ||
27 Jun 13:54 | ||
</Typography> | ||
</Typography> | ||
|
||
<Typography color="textPrimary" variant="small2"> | ||
27h : 13m : 54s | ||
</Typography> | ||
</div> | ||
</Grid> | ||
<Grid css={[styles.gridItem, styles.gridItemRight]} item xs={12} sm={4}> | ||
<StatusCard status={status} /> | ||
</Grid> | ||
</Grid> | ||
</Paper> | ||
); | ||
}; |
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,124 @@ | ||
import { css } from '@emotion/react'; | ||
import { alpha, useTheme } from '@mui/material'; | ||
|
||
export const useStyles = () => { | ||
const theme = useTheme(); | ||
|
||
return { | ||
root: css` | ||
padding-top: 0; | ||
padding-bottom: 0; | ||
${theme.breakpoints.down('sm')} { | ||
padding-left: 0; | ||
padding-right: 0; | ||
} | ||
`, | ||
gridItem: css` | ||
padding: ${theme.spacing(6, 0)}; | ||
${theme.breakpoints.down('sm')} { | ||
padding-left: ${theme.spacing(6)}; | ||
padding-right: ${theme.spacing(6)}; | ||
} | ||
`, | ||
gridItemLeft: css` | ||
padding-right: ${theme.spacing(6)}; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
`, | ||
cardHeader: css` | ||
display: flex; | ||
justify-content: space-between; | ||
`, | ||
cardBadges: css` | ||
/* TODO */ | ||
`, | ||
cardBadgeItem: css` | ||
padding: ${theme.spacing(1, 3)}; | ||
background-color: ${theme.palette.secondary.light}; | ||
border-radius: ${theme.shape.borderRadius.small}px; | ||
margin-right: ${theme.spacing(2)}; | ||
`, | ||
cardBadgeNumber: css` | ||
/* TODO */ | ||
`, | ||
cardBadgeActive: css` | ||
background-color: ${alpha(theme.palette.interactive.success as string, 0.1)}; | ||
color: ${theme.palette.interactive.success}; | ||
`, | ||
cardTitle: css` | ||
padding-top: ${theme.spacing(5)}; | ||
padding-bottom: ${theme.spacing(6)}; | ||
`, | ||
cardFooter: css` | ||
display: flex; | ||
justify-content: space-between; | ||
`, | ||
gridItemRight: css` | ||
padding-left: ${theme.spacing(6)}; | ||
border-left: 1px solid ${theme.palette.secondary.light}; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
${theme.breakpoints.down('sm')} { | ||
flex-direction: row; | ||
border-left: none; | ||
border-top: 1px solid ${theme.palette.secondary.light}; | ||
padding-top: ${theme.spacing(10)}; | ||
padding-bottom: ${theme.spacing(10)}; | ||
} | ||
`, | ||
|
||
/* StatusCard styles */ | ||
statusText: css` | ||
color: ${theme.palette.text.primary}; | ||
text-transform: none; | ||
margin-top: ${theme.spacing(2)}; | ||
text-align: center; | ||
${theme.breakpoints.down('sm')} { | ||
margin-top: 0; | ||
margin-left: ${theme.spacing(3)}; | ||
} | ||
`, | ||
|
||
iconWrapper: css` | ||
border-radius: 50%; | ||
width: ${theme.shape.iconSize.xxLarge}px; | ||
height: ${theme.shape.iconSize.xxLarge}px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
${theme.breakpoints.down('sm')} { | ||
width: ${theme.shape.iconSize.xLarge}px; | ||
height: ${theme.shape.iconSize.xLarge}px; | ||
} | ||
`, | ||
iconDotsWrapper: css` | ||
background-color: ${theme.palette.text.secondary}; | ||
`, | ||
iconInfoWrapper: css` | ||
background-color: ${theme.palette.interactive.primary}; | ||
`, | ||
iconMarkWrapper: css` | ||
background-color: ${theme.palette.interactive.success}; | ||
`, | ||
iconCloseWrapper: css` | ||
background-color: ${theme.palette.interactive.error}; | ||
`, | ||
icon: css` | ||
width: ${theme.shape.iconSize.medium}px; | ||
height: ${theme.shape.iconSize.medium}px; | ||
color: white; | ||
${theme.breakpoints.down('sm')} { | ||
width: ${theme.shape.iconSize.small}px; | ||
height: ${theme.shape.iconSize.small}px; | ||
} | ||
`, | ||
iconCheck: css` | ||
background-color: ${theme.palette.interactive.success}; | ||
border-radius: 50%; | ||
stroke-width: ${theme.spacing(0.5)}; | ||
`, | ||
}; | ||
}; |
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
b45af28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
175 tests passing in 65 suites.
Report generated by 🧪jest coverage report action from b45af28