conditionally output totalSales (#1578)

This commit is contained in:
Matthias Kretschmann 2022-07-06 13:59:38 +01:00 committed by GitHub
parent 6ae584212f
commit f8bbda0594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View File

@ -32,8 +32,8 @@ export default function AssetTeaser({
<a className={styles.link}> <a className={styles.link}>
<header className={styles.header}> <header className={styles.header}>
<div className={styles.symbol}>{datatokens[0]?.symbol}</div> <div className={styles.symbol}>{datatokens[0]?.symbol}</div>
<Dotdotdot clamp={3}> <Dotdotdot tagName="h1" clamp={3} className={styles.title}>
<h1 className={styles.title}>{name}</h1> {name}
</Dotdotdot> </Dotdotdot>
{!noPublisher && ( {!noPublisher && (
<Publisher account={owner} minimal className={styles.publisher} /> <Publisher account={owner} minimal className={styles.publisher} />

View File

@ -1,12 +1,9 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import styles from './index.module.css' import styles from './index.module.css'
import classNames from 'classnames/bind'
import Compute from '@images/compute.svg' import Compute from '@images/compute.svg'
import Download from '@images/download.svg' import Download from '@images/download.svg'
import Lock from '@images/lock.svg' import Lock from '@images/lock.svg'
const cx = classNames.bind(styles)
export default function AssetType({ export default function AssetType({
type, type,
accessType, accessType,
@ -18,11 +15,8 @@ export default function AssetType({
className?: string className?: string
totalSales?: number totalSales?: number
}): ReactElement { }): ReactElement {
const styleClasses = cx({
[className]: className
})
return ( return (
<div className={styleClasses}> <div className={className || null}>
{accessType === 'access' ? ( {accessType === 'access' ? (
<Download role="img" aria-label="Download" className={styles.icon} /> <Download role="img" aria-label="Download" className={styles.icon} />
) : accessType === 'compute' && type === 'algorithm' ? ( ) : accessType === 'compute' && type === 'algorithm' ? (
@ -35,9 +29,11 @@ export default function AssetType({
{type === 'dataset' ? 'data set' : 'algorithm'} {type === 'dataset' ? 'data set' : 'algorithm'}
</div> </div>
<div className={styles.typeLabel}> {totalSales ? (
{totalSales + ' ' + (totalSales === 1 ? 'sale' : 'sales')} <div className={styles.typeLabel}>
</div> {`${totalSales} ${totalSales === 1 ? 'sale' : 'sales'}`}
</div>
) : null}
</div> </div>
) )
} }