mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
created AssetTypeDetails component and added it to asset details
This commit is contained in:
parent
4a35d08880
commit
80ae4d2bd5
24
src/components/atoms/AssetTypeDetails.module.css
Normal file
24
src/components/atoms/AssetTypeDetails.module.css
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
.typeDetails {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(var(--spacer) / 3);
|
||||||
|
right: calc(var(--spacer) / 3);
|
||||||
|
width: auto;
|
||||||
|
font-size: var(--font-size-mini);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
fill: var(--brand-grey-light);
|
||||||
|
width: 1.1em;
|
||||||
|
height: 1.1em;
|
||||||
|
vertical-align: baseline;
|
||||||
|
margin-bottom: -0.2em;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.typeLabel {
|
||||||
|
display: inline-block;
|
||||||
|
text-transform: uppercase;
|
||||||
|
border-right: 1px solid var(--border-color);
|
||||||
|
padding-right: calc(var(--spacer) / 3.5);
|
||||||
|
margin-right: calc(var(--spacer) / 4);
|
||||||
|
}
|
25
src/components/atoms/AssetTypeDetails.tsx
Normal file
25
src/components/atoms/AssetTypeDetails.tsx
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import React, { ReactElement } from 'react'
|
||||||
|
import styles from './AssetTypeDetails.module.css'
|
||||||
|
import { ReactComponent as Compute } from '../../images/compute.svg'
|
||||||
|
import { ReactComponent as Download } from '../../images/download.svg'
|
||||||
|
|
||||||
|
export default function AssetTypeDetails({
|
||||||
|
type,
|
||||||
|
accessType
|
||||||
|
}: {
|
||||||
|
type: string
|
||||||
|
accessType: string
|
||||||
|
}): ReactElement {
|
||||||
|
return (
|
||||||
|
<aside className={styles.typeDetails}>
|
||||||
|
<div className={styles.typeLabel}>
|
||||||
|
{type === 'dataset' ? 'data set' : 'algorithm'}
|
||||||
|
</div>
|
||||||
|
{accessType === 'access' ? (
|
||||||
|
<Download role="img" aria-label="Download" className={styles.icon} />
|
||||||
|
) : (
|
||||||
|
<Compute role="img" aria-label="Compute" className={styles.icon} />
|
||||||
|
)}
|
||||||
|
</aside>
|
||||||
|
)
|
||||||
|
}
|
@ -61,28 +61,3 @@
|
|||||||
font-size: var(--font-size-mini);
|
font-size: var(--font-size-mini);
|
||||||
margin-top: calc(var(--spacer) / 2);
|
margin-top: calc(var(--spacer) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.typeDetails {
|
|
||||||
position: absolute;
|
|
||||||
top: calc(var(--spacer) / 3);
|
|
||||||
right: calc(var(--spacer) / 3);
|
|
||||||
width: auto;
|
|
||||||
font-size: var(--font-size-mini);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
fill: var(--brand-grey-light);
|
|
||||||
width: 1.1em;
|
|
||||||
height: 1.1em;
|
|
||||||
vertical-align: baseline;
|
|
||||||
margin-bottom: -0.2em;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.typeLabel {
|
|
||||||
display: inline-block;
|
|
||||||
text-transform: uppercase;
|
|
||||||
border-right: 1px solid var(--border-color);
|
|
||||||
padding-right: calc(var(--spacer) / 3.5);
|
|
||||||
margin-right: calc(var(--spacer) / 4);
|
|
||||||
}
|
|
||||||
|
@ -8,8 +8,7 @@ import removeMarkdown from 'remove-markdown'
|
|||||||
import Publisher from '../atoms/Publisher'
|
import Publisher from '../atoms/Publisher'
|
||||||
import { useMetadata } from '@oceanprotocol/react'
|
import { useMetadata } from '@oceanprotocol/react'
|
||||||
import Time from '../atoms/Time'
|
import Time from '../atoms/Time'
|
||||||
import { ReactComponent as Compute } from '../../images/compute.svg'
|
import AssetTypeDetails from '../atoms/AssetTypeDetails'
|
||||||
import { ReactComponent as Download } from '../../images/download.svg'
|
|
||||||
|
|
||||||
declare type AssetTeaserProps = {
|
declare type AssetTeaserProps = {
|
||||||
ddo: DDO
|
ddo: DDO
|
||||||
@ -33,20 +32,7 @@ const AssetTeaser: React.FC<AssetTeaserProps> = ({ ddo }: AssetTeaserProps) => {
|
|||||||
<Publisher account={owner} minimal className={styles.publisher} />
|
<Publisher account={owner} minimal className={styles.publisher} />
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<aside className={styles.typeDetails}>
|
<AssetTypeDetails type={type} accessType={accessType} />
|
||||||
<div className={styles.typeLabel}>
|
|
||||||
{type === 'dataset' ? 'data set' : 'algorithm'}
|
|
||||||
</div>
|
|
||||||
{accessType === 'access' ? (
|
|
||||||
<Download
|
|
||||||
role="img"
|
|
||||||
aria-label="Download"
|
|
||||||
className={styles.icon}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Compute role="img" aria-label="Compute" className={styles.icon} />
|
|
||||||
)}
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<Dotdotdot tagName="p" clamp={3}>
|
<Dotdotdot tagName="p" clamp={3}>
|
||||||
|
@ -42,3 +42,7 @@
|
|||||||
margin-left: calc(var(--spacer) / 4);
|
margin-left: calc(var(--spacer) / 4);
|
||||||
margin-right: calc(var(--spacer) / 4);
|
margin-right: calc(var(--spacer) / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content [class*='typeDetails'] {
|
||||||
|
right: calc(var(--spacer) * 2) !important;
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@ import Button from '../../atoms/Button'
|
|||||||
import Edit from '../AssetActions/Edit'
|
import Edit from '../AssetActions/Edit'
|
||||||
import DebugOutput from '../../atoms/DebugOutput'
|
import DebugOutput from '../../atoms/DebugOutput'
|
||||||
import MetaMain from './MetaMain'
|
import MetaMain from './MetaMain'
|
||||||
|
import AssetTypeDetails from '../../atoms/AssetTypeDetails'
|
||||||
// import EditHistory from './EditHistory'
|
// import EditHistory from './EditHistory'
|
||||||
|
|
||||||
export interface AssetContentProps {
|
export interface AssetContentProps {
|
||||||
@ -46,8 +47,9 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
|
|||||||
const { owner, isInPurgatory, purgatoryData } = useAsset()
|
const { owner, isInPurgatory, purgatoryData } = useAsset()
|
||||||
const [showPricing, setShowPricing] = useState(false)
|
const [showPricing, setShowPricing] = useState(false)
|
||||||
const [showEdit, setShowEdit] = useState<boolean>()
|
const [showEdit, setShowEdit] = useState<boolean>()
|
||||||
const { ddo, price, metadata } = useAsset()
|
const { ddo, price, metadata, type } = useAsset()
|
||||||
const isOwner = accountId === owner
|
const isOwner = accountId === owner
|
||||||
|
const accessType = ddo.service[1].type
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!price) return
|
if (!price) return
|
||||||
@ -67,6 +69,7 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
|
|||||||
<div>
|
<div>
|
||||||
{showPricing && <Pricing ddo={ddo} />}
|
{showPricing && <Pricing ddo={ddo} />}
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
|
<AssetTypeDetails type={type} accessType={accessType} />
|
||||||
<MetaMain />
|
<MetaMain />
|
||||||
<Bookmark did={ddo.id} />
|
<Bookmark did={ddo.id} />
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user