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}>
<header className={styles.header}>
<div className={styles.symbol}>{datatokens[0]?.symbol}</div>
<Dotdotdot clamp={3}>
<h1 className={styles.title}>{name}</h1>
<Dotdotdot tagName="h1" clamp={3} className={styles.title}>
{name}
</Dotdotdot>
{!noPublisher && (
<Publisher account={owner} minimal className={styles.publisher} />

View File

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