1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

output asset teasers, basic styling

This commit is contained in:
Matthias Kretschmann 2020-07-07 23:00:16 +02:00
parent 996bf9205b
commit 7980d2fa4b
Signed by: m
GPG Key ID: 606EEEF3C479A91F
25 changed files with 109 additions and 128 deletions

View File

@ -1,14 +1,16 @@
.box { .box {
display: block;
background: var(--brand-white); background: var(--brand-white);
padding: var(--spacer);
border-radius: var(--border-radius); border-radius: var(--border-radius);
border: 1px solid var(--brand-grey-light); border: 1px solid var(--brand-grey-lighter);
box-shadow: 0 6px 15px 0 rgba(0, 0, 0, 0.05);
overflow: hidden;
padding: var(--spacer);
} }
a.box:hover, a.box:hover,
a.box:focus { a.box:focus {
outline: 0; outline: 0;
border-color: var(--brand-pink); transform: translate3d(0, -0.1rem, 0);
/* box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); */ box-shadow: 0 10px 25px 0 rgba(0, 0, 0, 0.07);
/* transform: translate3d(0, -2px, 0); */
} }

View File

@ -1,12 +1,16 @@
.dropzone { .dropzone {
padding: 22px; padding: var(--spacer);
text-align: center; text-align: center;
color: var(--color-secondary); color: var(--color-secondary);
border: 2px dashed var(--color-primary); border: 0.1rem dashed var(--color-secondary);
font-size: var(--font-size-small);
border-radius: var(--border-radius);
} }
.dragover { .dragover {
border-color: var(--color-secondary); border-color: var(--color-primary);
} }
.disabled { .disabled {
} }

View File

@ -7,10 +7,10 @@
.price span { .price span {
font-weight: var(--font-weight-base); font-weight: var(--font-weight-base);
color: var(--color-secondary); color: var(--color-secondary);
font-size: var(--font-size-small); font-size: var(--font-size-base);
} }
.small { .small {
transform: scale(0.8); transform: scale(0.7);
transform-origin: left 80%; transform-origin: left 80%;
} }

View File

@ -1,7 +1,10 @@
import React from 'react' import React, { ReactElement } from 'react'
import Web3 from 'web3' import Web3 from 'web3'
import classNames from 'classnames/bind'
import styles from './Price.module.css' import styles from './Price.module.css'
const cx = classNames.bind(styles)
export default function Price({ export default function Price({
price, price,
className, className,
@ -10,11 +13,15 @@ export default function Price({
price: string price: string
className?: string className?: string
small?: boolean small?: boolean
}) { }): ReactElement {
const classes = small const styleClasses = cx({
? `${styles.price} ${styles.small} ${className}` price: true,
: `${styles.price} ${className}` small: small,
[className]: className
})
const isFree = price === '0' const isFree = price === '0'
const displayPrice = isFree ? ( const displayPrice = isFree ? (
'Free' 'Free'
) : ( ) : (
@ -23,5 +30,5 @@ export default function Price({
</> </>
) )
return <div className={classes}>{displayPrice}</div> return <div className={styleClasses}>{displayPrice}</div>
} }

View File

@ -1,10 +1,10 @@
/* default: success, green circle */ /* default: success, green circle */
.status { .status {
width: var(--font-size-small); width: var(--font-size-mini);
height: var(--font-size-small); height: var(--font-size-mini);
border-radius: 50%; border-radius: 50%;
display: inline-block; display: inline-block;
background: var(--green); background: var(--brand-alert-green);
} }
/* yellow triangle */ /* yellow triangle */
@ -14,15 +14,15 @@
background: none; background: none;
width: 0; width: 0;
height: 0; height: 0;
border-left: calc(var(--font-size-small) / 1.7) solid transparent; border-left: calc(var(--font-size-mini) / 1.7) solid transparent;
border-right: calc(var(--font-size-small) / 1.7) solid transparent; border-right: calc(var(--font-size-mini) / 1.7) solid transparent;
border-bottom: var(--font-size-small) solid var(--orange); border-bottom: var(--font-size-mini) solid var(--brand-alert-orange);
} }
/* red square */ /* red square */
.error { .error {
composes: status; composes: status;
border-radius: 0; border-radius: 0;
background: var(--red); background: var(--brand-alert-red);
text-transform: capitalize; text-transform: capitalize;
} }

View File

@ -1,7 +1,7 @@
import React from 'react' import React, { ReactElement } from 'react'
import styles from './Status.module.css' import styles from './Status.module.css'
export default function Status({ state }: { state?: string }) { export default function Status({ state }: { state?: string }): ReactElement {
const classes = const classes =
state === 'error' state === 'error'
? styles.error ? styles.error

View File

@ -7,7 +7,7 @@
composes: box from '../atoms/Box.module.css'; composes: box from '../atoms/Box.module.css';
font-size: var(--font-size-small); font-size: var(--font-size-small);
height: 100%; height: 100%;
color: var(--brand-grey-dark); color: var(--color-secondary);
position: relative; position: relative;
/* for sticking footer to bottom */ /* for sticking footer to bottom */
display: flex; display: flex;
@ -18,59 +18,35 @@
overflow-wrap: break-word; overflow-wrap: break-word;
word-wrap: break-word; word-wrap: break-word;
word-break: break-all; word-break: break-all;
margin-top: calc(var(--spacer) / 2);
/* for sticking footer to bottom */ /* for sticking footer to bottom */
flex: 1; flex: 1;
} }
.title { .title {
font-size: var(--font-size-h4); font-size: var(--font-size-large);
color: var(--color-primary); margin-bottom: calc(var(--spacer) / 4);
margin-bottom: calc(var(--spacer) / 6);
}
.tags > * {
font-size: var(--font-size-mini);
} }
.foot { .foot {
color: var(--color-secondary);
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
margin-top: calc(var(--spacer) / 1.5); margin-top: calc(var(--spacer) / 1.5);
border-top: 1px solid var(--brand-grey-light); border-top: 1px solid var(--brand-grey-lighter);
padding-top: calc(var(--spacer) / 3); padding-top: calc(var(--spacer) / 3);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
} }
.foot p { .foot p {
margin: 0; margin: 0;
} }
.price {
text-align: right;
}
p.copyright {
width: 100%;
font-weight: var(--font-weight-base);
margin-bottom: 0;
font-size: var(--font-size-mini);
text-align: center;
margin-top: calc(var(--spacer) / 3);
}
.accessLabel { .accessLabel {
font-size: var(--font-size-small); font-size: var(--font-size-mini);
width: auto; width: auto;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
color: var(--brand-black); color: var(--brand-black);
background: var(--brand-grey-lighter); background: var(--brand-grey-lighter);
padding: 0.1px 0.5px 0.1px 0.5px; padding: 0.2rem 0.5rem;
border-radius: 2px; border-bottom-left-radius: var(--border-radius);
} }

View File

@ -48,13 +48,7 @@ const AssetTeaser: React.FC<AssetTeaserProps> = ({
</div> </div>
<footer className={styles.foot}> <footer className={styles.foot}>
{categories && <p className={styles.type}>{categories[0]}</p>} <Price price={price} small />
<Price price={price} className={styles.price} />
<p className={styles.copyright}>
Provided by <strong>{copyrightHolder}</strong>
</p>
</footer> </footer>
</Link> </Link>
</article> </article>

View File

@ -4,6 +4,7 @@
} }
.title { .title {
font-size: var(--font-size-h2);
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
} }

View File

@ -1,15 +1,23 @@
import React from 'react' import React, { ReactElement } from 'react'
import classNames from 'classnames/bind'
import styles from './PageHeader.module.css' import styles from './PageHeader.module.css'
const cx = classNames.bind(styles)
export default function PageHeader({ export default function PageHeader({
title, title,
description description
}: { }: {
title: string title: string
description?: string description?: string
}) { center?: boolean
}): ReactElement {
const styleClasses = cx({
header: true
})
return ( return (
<header className={styles.header}> <header className={styleClasses}>
<h1 className={styles.title}>{title}</h1> <h1 className={styles.title}>{title}</h1>
{description && <p className={styles.description}>{description}</p>} {description && <p className={styles.description}>{description}</p>}
</header> </header>

View File

@ -10,9 +10,6 @@
.statuscontainer { .statuscontainer {
flex-grow: 1; flex-grow: 1;
} }
.statuscontainer h3 {
margin-top: 0;
}
.walletcontainer { .walletcontainer {
width: 35%; width: 35%;

View File

@ -3,7 +3,7 @@
font-size: var(--font-size-small); font-size: var(--font-size-small);
padding: var(--spacer); padding: var(--spacer);
border-radius: var(--border-radius); border-radius: var(--border-radius);
border: 1px solid var(--brand-grey-light); background: var(--brand-grey-dimmed);
display: grid; display: grid;
gap: var(--spacer); gap: var(--spacer);
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
@ -11,5 +11,5 @@
.metaFull code { .metaFull code {
/* magic number cause the code font has a bigger visual weight */ /* magic number cause the code font has a bigger visual weight */
font-size: 0.7rem; font-size: 0.8rem;
} }

View File

@ -2,6 +2,7 @@
display: grid; display: grid;
gap: calc(var(--spacer) * 1.5); gap: calc(var(--spacer) * 1.5);
position: relative; position: relative;
margin-top: -1rem;
} }
@media (min-width: 55rem) { @media (min-width: 55rem) {
@ -27,11 +28,6 @@
margin-bottom: 0; margin-bottom: 0;
} }
.sectionTitle {
font-size: var(--font-size-large);
color: var(--color-secondary);
}
.buttonGroup { .buttonGroup {
margin-top: var(--spacer); margin-top: var(--spacer);
margin-bottom: var(--spacer); margin-bottom: var(--spacer);

View File

@ -51,10 +51,7 @@ export default function AssetContent({
<article className={styles.grid}> <article className={styles.grid}>
<div> <div>
<aside className={styles.meta}> <aside className={styles.meta}>
<p> <p>{datePublished && <Time date={datePublished} />}</p>
<span title="Copyright Holder">{copyrightHolder}</span> -{' '}
{datePublished && <Time date={datePublished} />}
</p>
{categories && ( {categories && (
<p> <p>
<Link to={`/search?categories=["${categories[0]}"]`}> <Link to={`/search?categories=["${categories[0]}"]`}>
@ -65,7 +62,6 @@ export default function AssetContent({
{/* <Rating curation={{ rating, numVotes }} readonly /> */} {/* <Rating curation={{ rating, numVotes }} readonly /> */}
</aside> </aside>
<h2 className={styles.sectionTitle}>Summary</h2>
<Markdown text={description || ''} /> <Markdown text={description || ''} />
{tags && tags.length > 0 && <Tags items={tags} />} {tags && tags.length > 0 && <Tags items={tags} />}

View File

@ -38,7 +38,7 @@ const AssetList: React.FC<AssetListProps> = ({ queryResult }) => {
return ( return (
<> <>
<div className={styles.assetList}> <div className={styles.assetList}>
{queryResult.results && {queryResult &&
queryResult.results.map((ddo: DDO) => { queryResult.results.map((ddo: DDO) => {
const { attributes }: MetaDataMarket = new DDO( const { attributes }: MetaDataMarket = new DDO(
ddo ddo

View File

@ -6,7 +6,7 @@
width: 100%; width: 100%;
margin-top: var(--spacer); margin-top: var(--spacer);
padding-top: var(--spacer); padding-top: var(--spacer);
border-top: 1px solid var(--color-secondary); border-top: 1px solid var(--brand-grey-lighter);
} }
.compute { .compute {
@ -14,22 +14,18 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.compute button { .compute button {
margin-left: var(--spacer); margin-left: var(--spacer);
} }
.compute button:first { .compute button:first {
margin-left: 0px; margin-left: 0px;
} }
.price {
font-size: var(--font-size-h2);
/* padding-bottom: var(--spacer); */
}
.info { .info {
margin-top: var(--spacer);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
/* padding-top: calc(var(--spacer) * 0.5);
padding-bottom: var(--spacer);
border-top: 1px solid var(--color-secondary); */
} }

View File

@ -96,7 +96,7 @@ export default function Compute({
return ( return (
<div className={styles.compute}> <div className={styles.compute}>
<Price price={price} className={styles.price} /> <Price price={price} />
<div className={styles.info}> <div className={styles.info}>
<div className={styles.selectType}> <div className={styles.selectType}>

View File

@ -13,9 +13,6 @@
flex-shrink: 0; flex-shrink: 0;
} }
.pricewrapper {
}
.consume button { .consume button {
margin-left: calc(var(--spacer) / 4); margin-left: calc(var(--spacer) / 4);
} }
@ -25,18 +22,13 @@
} }
.price { .price {
font-size: var(--font-size-h2);
margin-top: calc(var(--spacer) / 4); margin-top: calc(var(--spacer) / 4);
margin-bottom: calc(var(--spacer) / 2); margin-bottom: calc(var(--spacer) / 2);
} }
.price span {
font-size: var(--font-size-large);
}
.feedback { .feedback {
width: 100%; width: 100%;
margin-top: calc(var(--spacer) / 1.5); margin-top: calc(var(--spacer) / 1.5);
padding-top: calc(var(--spacer) / 1.5); padding-top: calc(var(--spacer) / 1.5);
border-top: 1px solid var(--brand-grey-light); border-top: 1px solid var(--brand-grey-lighter);
} }

View File

@ -1,11 +1,11 @@
import React from 'react' import React, { ReactElement } from 'react'
import { Link } from 'gatsby' import { Link } from 'gatsby'
import Menu from '../molecules/Menu' import Menu from '../molecules/Menu'
import styles from './Header.module.css' import styles from './Header.module.css'
import { ReactComponent as Logo } from '@oceanprotocol/art/logo/logo.svg' import { ReactComponent as Logo } from '@oceanprotocol/art/logo/logo.svg'
import { useSiteMetadata } from '../../hooks/useSiteMetadata' import { useSiteMetadata } from '../../hooks/useSiteMetadata'
export default function Header() { export default function Header(): ReactElement {
const { siteTitle } = useSiteMetadata() const { siteTitle } = useSiteMetadata()
return ( return (

View File

@ -0,0 +1,3 @@
.grid {
composes: assetList from '../organisms/AssetList.module.css';
}

View File

@ -1,9 +1,9 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import SearchBar from '../molecules/SearchBar' import SearchBar from '../molecules/SearchBar'
import { DID } from '@oceanprotocol/squid'
import { Link } from 'gatsby'
import shortid from 'shortid' import shortid from 'shortid'
import { OceanAsset } from '../../@types/MetaData' import { OceanAsset } from '../../@types/MetaData'
import AssetTeaser from '../molecules/AssetTeaser'
import styles from './Home.module.css'
export default function HomePage({ export default function HomePage({
assets assets
@ -16,13 +16,15 @@ export default function HomePage({
<> <>
<SearchBar large /> <SearchBar large />
{assets && ( {assets && (
<ul> <div className={styles.grid}>
{assets.map(({ node }: { node: { did: DID } }) => ( {assets.map(({ node }: { node: OceanAsset }) => (
<li key={shortid.generate()}> <AssetTeaser
<Link to={`/asset/${node.did}`}>{node.did}</Link> key={shortid.generate()}
</li> did={node.did}
metadata={node}
/>
))} ))}
</ul> </div>
)} )}
</> </>
) )

View File

@ -25,11 +25,11 @@ export default function SearchPage({
useEffect(() => { useEffect(() => {
async function initSearch() { async function initSearch() {
const results = await getResults(parsed) const queryResult = await getResults(parsed)
setQueryResult(results) setQueryResult(queryResult)
} }
initSearch() initSearch()
}, []) }, [parsed])
return ( return (
<section className={styles.grid}> <section className={styles.grid}>

View File

@ -25,7 +25,7 @@ export function getSearchQuery(
created: -1 created: -1
} }
// Something in squid-js is weird when using 'categories: [type]' // Something in squid-js is weird when using 'tags: [tag]'
// which is the only way the query actually returns desired results. // which is the only way the query actually returns desired results.
// But it doesn't follow 'SearchQuery' interface so we have to assign // But it doesn't follow 'SearchQuery' interface so we have to assign
// it here. // it here.

View File

@ -18,7 +18,6 @@
--brand-alert-orange: #b35f36; --brand-alert-orange: #b35f36;
--brand-alert-yellow: #eac146; --brand-alert-yellow: #eac146;
/* Buttons */
--color-primary: #ff4092; --color-primary: #ff4092;
--color-secondary: #8b98a9; --color-secondary: #8b98a9;
@ -34,30 +33,26 @@
--font-size-large: 1.2rem; --font-size-large: 1.2rem;
--font-size-small: 0.85rem; --font-size-small: 0.85rem;
--font-size-mini: 0.65rem; --font-size-mini: 0.65rem;
--font-size-text: 1rem; --font-size-text: 1rem;
--font-size-label: 1rem; --font-size-label: 1rem;
--font-size-title: 1.4rem; --font-size-title: 1.4rem;
--font-size-h1: 3rem; --font-size-h1: 3rem;
--font-size-h2: 1.7rem; --font-size-h2: 2.5rem;
--font-size-h3: 1.4rem; --font-size-h3: 1.7rem;
--font-size-h4: 1.2rem; --font-size-h4: 1.3rem;
--font-size-h5: 1.1rem; --font-size-h5: 1.1rem;
--font-weight-base: 500;
--font-weight-base: 400;
--font-weight-bold: 600; --font-weight-bold: 600;
--line-height: 1.6; --line-height: 1.6;
--break-point--small: 640px;
--break-point--medium: 860px;
--break-point--large: 1140px;
--break-point--huge: 1400px;
--spacer: 2rem; --spacer: 2rem;
--border-radius: 0.2rem; --border-radius: 0.2rem;
--layout-max-width: 85rem; --layout-max-width: 85rem;
--checkbox-size: 1.6em; --checkbox-size: 1.6em;
--break-point--small: 640px;
--break-point--medium: 860px;
--break-point--large: 1140px;
--break-point--huge: 1400px;
} }

View File

@ -21,6 +21,18 @@ export const pageQuery = graphql`
edges { edges {
node { node {
did did
main {
type
name
dateCreated
author
price
datePublished
}
additionalInformation {
description
access
}
} }
} }
} }