market/src/components/@shared/AssetType/index.tsx

40 lines
1.1 KiB
TypeScript
Raw Normal View History

import React, { ReactElement } from 'react'
2021-10-18 20:44:33 +02:00
import styles from './index.module.css'
import Compute from '@images/compute.svg'
import Download from '@images/download.svg'
import Lock from '@images/lock.svg'
2021-02-25 09:55:38 +01:00
export default function AssetType({
type,
2021-02-25 09:55:38 +01:00
accessType,
2022-07-05 19:49:47 +02:00
className,
totalSales
}: {
type: string
accessType: string
2021-02-25 09:55:38 +01:00
className?: string
2022-07-05 19:49:47 +02:00
totalSales?: number
}): ReactElement {
return (
<div className={className || null}>
{accessType === 'access' ? (
<Download role="img" aria-label="Download" className={styles.icon} />
) : accessType === 'compute' && type === 'algorithm' ? (
<Lock role="img" aria-label="Private" className={styles.icon} />
) : (
<Compute role="img" aria-label="Compute" className={styles.icon} />
)}
2021-05-27 12:51:47 +02:00
<div className={styles.typeLabel}>
2022-08-15 15:57:53 +02:00
{type === 'dataset' ? 'dataset' : 'algorithm'}
2021-05-27 12:51:47 +02:00
</div>
2022-07-05 19:49:47 +02:00
{totalSales ? (
<div className={styles.typeLabel}>
{`${totalSales} ${totalSales === 1 ? 'sale' : 'sales'}`}
</div>
) : null}
2021-02-25 09:55:38 +01:00
</div>
)
}