mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 09:44:53 +01:00
refactor
This commit is contained in:
parent
80901b5bb4
commit
51ab425c35
@ -3,6 +3,7 @@ import { Balance } from '.'
|
|||||||
import styles from './PoolStatistics.module.css'
|
import styles from './PoolStatistics.module.css'
|
||||||
import Token from './Token'
|
import Token from './Token'
|
||||||
import Conversion from '../../../atoms/Price/Conversion'
|
import Conversion from '../../../atoms/Price/Conversion'
|
||||||
|
import TokenList from './TokenList'
|
||||||
|
|
||||||
export default function PoolStatistics({
|
export default function PoolStatistics({
|
||||||
price,
|
price,
|
||||||
@ -21,10 +22,7 @@ export default function PoolStatistics({
|
|||||||
totalBalance.ocean + totalBalance.datatoken * Number(price)
|
totalBalance.ocean + totalBalance.datatoken * Number(price)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.tokeninfo}>
|
<TokenList title="Pool Statistics">
|
||||||
<h3 className={styles.title}>Pool Statistics</h3>
|
|
||||||
|
|
||||||
<div className={styles.tokens}>
|
|
||||||
<div>
|
<div>
|
||||||
<Token symbol="OCEAN" balance={`${totalBalance.ocean}`} />
|
<Token symbol="OCEAN" balance={`${totalBalance.ocean}`} />
|
||||||
<Token symbol={dtSymbol} balance={`${totalBalance.datatoken}`} />
|
<Token symbol={dtSymbol} balance={`${totalBalance.datatoken}`} />
|
||||||
@ -38,7 +36,6 @@ export default function PoolStatistics({
|
|||||||
price={`${totalLiquidityInOcean}`}
|
price={`${totalLiquidityInOcean}`}
|
||||||
className={styles.totalLiquidity}
|
className={styles.totalLiquidity}
|
||||||
/>
|
/>
|
||||||
</div>
|
</TokenList>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
.tokeninfo {
|
||||||
|
padding-top: calc(var(--spacer) / 1.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tokens {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
grid-auto-flow: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: var(--font-size-base);
|
||||||
|
margin-bottom: calc(var(--spacer) / 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight {
|
||||||
|
background: var(--brand-grey-dimmed);
|
||||||
|
padding: calc(var(--spacer) / 1.5) var(--spacer) calc(var(--spacer) / 2)
|
||||||
|
var(--spacer);
|
||||||
|
border-bottom: 1px solid var(--brand-grey-lighter);
|
||||||
|
margin-left: -2rem;
|
||||||
|
margin-right: -2rem;
|
||||||
|
}
|
19
src/components/organisms/AssetActions/Pool/TokenList.tsx
Normal file
19
src/components/organisms/AssetActions/Pool/TokenList.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import React, { ReactElement, ReactNode } from 'react'
|
||||||
|
import styles from './TokenList.module.css'
|
||||||
|
|
||||||
|
export default function TokenList({
|
||||||
|
title,
|
||||||
|
children,
|
||||||
|
highlight
|
||||||
|
}: {
|
||||||
|
title: string | ReactNode
|
||||||
|
children: ReactNode
|
||||||
|
highlight?: boolean
|
||||||
|
}): ReactElement {
|
||||||
|
return (
|
||||||
|
<div className={`${styles.tokeninfo} ${highlight ? styles.highlight : ''}`}>
|
||||||
|
<h3 className={styles.title}>{title}</h3>
|
||||||
|
<div className={styles.tokens}>{children}</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
@ -21,26 +21,6 @@
|
|||||||
margin-right: calc(var(--spacer) / 3);
|
margin-right: calc(var(--spacer) / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tokeninfo {
|
|
||||||
background: var(--brand-grey-dimmed);
|
|
||||||
padding: calc(var(--spacer) / 1.5) var(--spacer) calc(var(--spacer) / 2)
|
|
||||||
var(--spacer);
|
|
||||||
border-bottom: 1px solid var(--brand-grey-lighter);
|
|
||||||
margin-left: -2rem;
|
|
||||||
margin-right: -2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tokens {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
grid-auto-flow: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
font-size: var(--font-size-base);
|
|
||||||
margin-bottom: calc(var(--spacer) / 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.totalLiquidity {
|
.totalLiquidity {
|
||||||
composes: token from './Token.module.css';
|
composes: token from './Token.module.css';
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
@ -13,6 +13,7 @@ import Conversion from '../../../atoms/Price/Conversion'
|
|||||||
import EtherscanLink from '../../../atoms/EtherscanLink'
|
import EtherscanLink from '../../../atoms/EtherscanLink'
|
||||||
import PoolStatistics from './PoolStatistics'
|
import PoolStatistics from './PoolStatistics'
|
||||||
import Token from './Token'
|
import Token from './Token'
|
||||||
|
import TokenList from './TokenList'
|
||||||
|
|
||||||
export interface Balance {
|
export interface Balance {
|
||||||
ocean: number
|
ocean: number
|
||||||
@ -145,19 +146,18 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.tokeninfo}>
|
<TokenList
|
||||||
<h3 className={styles.title}>
|
title={
|
||||||
|
<>
|
||||||
Your Liquidity
|
Your Liquidity
|
||||||
<Tooltip content="Explain what this represents, advantage of providing liquidity..." />
|
<Tooltip content="Explain what this represents, advantage of providing liquidity..." />
|
||||||
</h3>
|
</>
|
||||||
|
}
|
||||||
<div className={styles.tokens}>
|
highlight
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<Token symbol="OCEAN" balance={`${userLiquidity.ocean}`} />
|
<Token symbol="OCEAN" balance={`${userLiquidity.ocean}`} />
|
||||||
<Token
|
<Token symbol={dtSymbol} balance={`${userLiquidity.datatoken}`} />
|
||||||
symbol={dtSymbol}
|
|
||||||
balance={`${userLiquidity.datatoken}`}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Token symbol="pool shares" balance={poolTokens} noIcon />
|
<Token symbol="pool shares" balance={poolTokens} noIcon />
|
||||||
@ -167,8 +167,7 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
price={`${totalUserLiquidityInOcean}`}
|
price={`${totalUserLiquidityInOcean}`}
|
||||||
className={styles.totalLiquidity}
|
className={styles.totalLiquidity}
|
||||||
/>
|
/>
|
||||||
</div>
|
</TokenList>
|
||||||
</div>
|
|
||||||
|
|
||||||
<PoolStatistics
|
<PoolStatistics
|
||||||
price={`${price.value}`}
|
price={`${price.value}`}
|
||||||
|
Loading…
Reference in New Issue
Block a user