1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

price display tweaks

This commit is contained in:
Matthias Kretschmann 2020-10-30 14:10:21 +01:00
parent 0134610dbe
commit 24cd36b2be
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 36 additions and 28 deletions

View File

@ -3,7 +3,11 @@
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
font-size: var(--font-size-large); font-size: var(--font-size-large);
color: var(--brand-grey-dark); color: var(--brand-grey-dark);
line-height: 1; line-height: 1.2;
}
.price > div:firt-child {
white-space: nowrap;
} }
.price span:first-child { .price span:first-child {
@ -20,3 +24,8 @@
.price.small span:first-child { .price.small span:first-child {
font-size: var(--font-size-small); font-size: var(--font-size-small);
} }
.badge {
vertical-align: middle;
margin-left: calc(var(--spacer) / 6);
}

View File

@ -4,6 +4,7 @@ import classNames from 'classnames/bind'
import Conversion from './Conversion' import Conversion from './Conversion'
import styles from './PriceUnit.module.css' import styles from './PriceUnit.module.css'
import { useUserPreferences } from '../../../providers/UserPreferences' import { useUserPreferences } from '../../../providers/UserPreferences'
import Badge from '../Badge'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)
@ -12,9 +13,11 @@ export default function PriceUnit({
className, className,
small, small,
conversion, conversion,
symbol symbol,
type
}: { }: {
price: string price: string
type?: string
className?: string className?: string
small?: boolean small?: boolean
conversion?: boolean conversion?: boolean
@ -30,6 +33,7 @@ export default function PriceUnit({
return ( return (
<div className={styleClasses}> <div className={styleClasses}>
<div>
{Number.isNaN(Number(price)) {Number.isNaN(Number(price))
? '-' ? '-'
: formatCurrency(Number(price), '', locale, false, { : formatCurrency(Number(price), '', locale, false, {
@ -39,6 +43,11 @@ export default function PriceUnit({
significantFigures: 4 significantFigures: 4
})}{' '} })}{' '}
<span>{symbol || 'OCEAN'}</span> <span>{symbol || 'OCEAN'}</span>
{type && type === 'pool' && (
<Badge label="pool" className={styles.badge} />
)}
</div>
{conversion && <Conversion price={price} />} {conversion && <Conversion price={price} />}
</div> </div>
) )

View File

@ -2,8 +2,3 @@
color: var(--color-secondary); color: var(--color-secondary);
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
} }
.badge {
vertical-align: middle;
margin-left: calc(var(--spacer) / 6);
}

View File

@ -5,7 +5,6 @@ import { DDO } from '@oceanprotocol/lib'
import Loader from '../Loader' import Loader from '../Loader'
import Tooltip from '../Tooltip' import Tooltip from '../Tooltip'
import PriceUnit from './PriceUnit' import PriceUnit from './PriceUnit'
import Badge from '../Badge'
export default function Price({ export default function Price({
ddo, ddo,
@ -21,17 +20,13 @@ export default function Price({
const { price } = useMetadata(ddo) const { price } = useMetadata(ddo)
return price?.value ? ( return price?.value ? (
<>
<PriceUnit <PriceUnit
price={`${price.value}`} price={`${price.value}`}
className={className} className={className}
small={small} small={small}
conversion={conversion} conversion={conversion}
type={price.type}
/> />
{price?.type === 'pool' && (
<Badge label="pool" className={styles.badge} />
)}
</>
) : !price || price?.value === 0 ? ( ) : !price || price?.value === 0 ? (
<div className={styles.empty}> <div className={styles.empty}>
No price found{' '} No price found{' '}