-
Notifications
You must be signed in to change notification settings - Fork 0
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
vien.nguyen2-tiki
committed
Sep 28, 2022
1 parent
22aa3d3
commit a4ea472
Showing
27 changed files
with
769 additions
and
205 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NEXT_PUBLIC_COSMOS_API=https://explorer.astranaut.dev | ||
NEXT_PUBLIC_EVM_API=http://128.199.238.171:8080/api/v1 | ||
NEXT_PUBLIC_BLOCK_INTERVAL=5000 | ||
NEXT_PUBLIC_TRANSACTION_INTERVAL=5000 |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import clsx from 'clsx' | ||
import React from 'react' | ||
import styles from './style.module.scss' | ||
|
||
interface Props { | ||
classes?: string[] | ||
children: React.ReactNode | ||
} | ||
|
||
const BackgroundCard = ({ children }: Props) => { | ||
return <div className={styles.backgroundCard}>{children}</div> | ||
const BackgroundCard = ({ children, classes = [] }: Props) => { | ||
return <div className={clsx(styles.backgroundCard, 'radius-lg', ...classes)}>{children}</div> | ||
} | ||
|
||
export default BackgroundCard |
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,22 +1,6 @@ | ||
.backgroundCard { | ||
box-sizing: border-box; | ||
|
||
/* Auto layout */ | ||
|
||
/* White Color/50 */ | ||
|
||
background: var(--border-color); | ||
/* White Color/50 */ | ||
|
||
background: rgba(var(--contrast-color-theme--raw), 0.05); | ||
border: 1px solid var(--border-color); | ||
backdrop-filter: blur(42px); | ||
/* Note: backdrop-filter has minimal browser support */ | ||
|
||
border-radius: 16px; | ||
|
||
/* Inside auto layout */ | ||
|
||
flex: none; | ||
order: 0; | ||
flex-grow: 0; | ||
} |
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,155 @@ | ||
import { CryptoIcon, Typography as TypographyUI } from '@astraprotocol/astra-ui' | ||
import clsx from 'clsx' | ||
import CopyButton from 'components/Button/CopyButton' | ||
import Typography from 'components/Typography' | ||
import { LabelBackgroundTypes, LabelTypes } from 'components/Typography/Label' | ||
import { LinkMaker } from 'utils/helper' | ||
import BackgroundCard from '../Background/BackgroundCard' | ||
import styles from './style.module.scss' | ||
|
||
export type Content = { | ||
link?: string | ||
value?: string | number | ||
prefix?: string | ||
suffix?: string | ||
icon?: string | ||
token?: string | ||
type?: LabelTypes | ||
backgroundType?: LabelBackgroundTypes | ||
transfer?: { | ||
from?: string | ||
to?: string | ||
value?: number | ||
token?: string | ||
} | ||
} | ||
|
||
export type CardRowItem = { | ||
label?: string | ||
type: 'copy' | 'link-copy' | 'label' | 'link' | 'balance' | 'text' | 'time' | 'transfer' | ||
contents: Content[] | ||
} | ||
|
||
type CardInfoProps = { | ||
classes?: string[] | ||
items?: CardRowItem[] | ||
} | ||
|
||
export default function CardInfo({ items, classes = [] }: CardInfoProps) { | ||
return ( | ||
<BackgroundCard classes={['margin-bottom-md', ...classes]}> | ||
<div className={'margin-left-2xl margin-right-2xl margin-top-lg margin-bottom-lg'}> | ||
{items.map(({ label, type, contents }) => ( | ||
<div key={label} className={clsx(styles.cardRow, 'row')}> | ||
<div className={clsx(styles.leftColumn, 'col-2 gutter-right block-ver-center')}> | ||
<Typography.CardLabel>{label}</Typography.CardLabel> | ||
</div> | ||
{(contents as Content[]).map(content => ( | ||
<div | ||
key={content.value || new Date().getTime()} | ||
className={clsx(styles.rightColumn, 'block-center')} | ||
> | ||
{type === 'text' ? ( | ||
<span className="moeny money-sm contrast-color-100">{content.value}</span> | ||
) : null} | ||
{type === 'copy' ? ( | ||
<CopyButton | ||
textCopy={content?.value as string} | ||
textTitle={content?.value as string} | ||
/> | ||
) : null} | ||
{type === 'link' ? ( | ||
<Typography.LinkText href={content.link || ''}> | ||
{content.value as string} | ||
</Typography.LinkText> | ||
) : null} | ||
{type === 'link-copy' ? ( | ||
<div className="block-center"> | ||
<Typography.LinkText href={content.link || ''}> | ||
{content.value as string} | ||
</Typography.LinkText> | ||
<CopyButton textCopy={content.link as string} /> | ||
</div> | ||
) : null} | ||
{type === 'label' ? ( | ||
<div className="block-center"> | ||
<Typography.Label | ||
text={content.value as string} | ||
icon | ||
type={content.type as LabelTypes} | ||
background={content.backgroundType as LabelBackgroundTypes} | ||
/> | ||
</div> | ||
) : null} | ||
{type === 'balance' ? ( | ||
<div className="block-center"> | ||
<TypographyUI.Balance | ||
icon={<CryptoIcon name={'asa'} />} | ||
value={content.value} | ||
currency={content.token} | ||
size="sm" | ||
/> | ||
</div> | ||
) : null} | ||
{type === 'time' ? ( | ||
<div className="block-center"> | ||
<Typography.Time time={content.value} confirmedWithin={content.suffix} /> | ||
</div> | ||
) : null} | ||
{type === 'transfer' ? ( | ||
<div className="block-center"> | ||
<span | ||
className={clsx( | ||
styles.smallCard, | ||
'radius-sm block-center', | ||
'contrast-color-100', | ||
'padding-left-sm padding-right-sm padding-top-xs padding-bottom-xs', | ||
'margin-right-md' | ||
)} | ||
> | ||
<span className="padding-right-xs">From</span> | ||
<Typography.LinkText href={LinkMaker.address(content?.transfer?.from)}> | ||
{content?.transfer?.from} | ||
</Typography.LinkText> | ||
<CopyButton textCopy={content?.transfer?.from} /> | ||
</span> | ||
<span | ||
className={clsx( | ||
styles.smallCard, | ||
'radius-sm block-center', | ||
'contrast-color-100', | ||
'padding-left-sm padding-right-sm padding-top-xs padding-bottom-xs', | ||
'margin-right-md' | ||
)} | ||
> | ||
<span className="padding-right-xs">To</span> | ||
<Typography.LinkText href={LinkMaker.address(content?.transfer?.to)}> | ||
{content?.transfer?.to} | ||
</Typography.LinkText> | ||
<CopyButton textCopy={content?.transfer?.to} /> | ||
</span> | ||
<span | ||
className={clsx( | ||
styles.smallCard, | ||
'radius-sm block-center', | ||
'contrast-color-100', | ||
'padding-left-sm padding-right-sm padding-top-xs padding-bottom-xs', | ||
'margin-right-md' | ||
)} | ||
> | ||
<span className="padding-right-xs">For</span> | ||
<span className="padding-right-xs">{content?.transfer.value}</span> | ||
<Typography.LinkText href={LinkMaker.address(content?.transfer?.to)}> | ||
{content?.transfer?.token} | ||
</Typography.LinkText> | ||
</span> | ||
</div> | ||
) : null} | ||
</div> | ||
))} | ||
</div> | ||
))} | ||
</div> | ||
</BackgroundCard> | ||
) | ||
} |
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,10 @@ | ||
.cardRow { | ||
height: 40px; | ||
.leftColumn { | ||
} | ||
.rightColumn { | ||
} | ||
} | ||
.smallCard { | ||
background-color: rgba(var(--contrast-color-theme--raw), 0.05); | ||
} |
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,7 +1,10 @@ | ||
import clsx from 'clsx' | ||
|
||
type ContainerProps = { | ||
classes?: string[] | ||
children: React.ReactNode | ||
} | ||
|
||
export default function Container({ children }: ContainerProps) { | ||
return <div className="container margin-auto">{children}</div> | ||
export default function Container({ children, classes = [] }: ContainerProps) { | ||
return <div className={clsx('container margin-auto', ...classes)}>{children}</div> | ||
} |
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
Oops, something went wrong.