1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

new price tabs UI

This commit is contained in:
Matthias Kretschmann 2020-07-23 13:00:06 +02:00
parent bc30a13597
commit 1b49413ec7
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 92 additions and 14 deletions

View File

@ -10,6 +10,7 @@
padding: calc(var(--spacer) / 12) var(--spacer); padding: calc(var(--spacer) / 12) var(--spacer);
border-radius: var(--border-radius); border-radius: var(--border-radius);
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
font-size: var(--font-size-small);
text-transform: uppercase; text-transform: uppercase;
cursor: pointer; cursor: pointer;
color: var(--brand-grey-light); color: var(--brand-grey-light);

View File

@ -1,23 +1,53 @@
.price { .price {
display: flex;
gap: calc(var(--spacer) / 2);
justify-content: center;
border: 1px solid var(--brand-grey-lighter); border: 1px solid var(--brand-grey-lighter);
background: var(--brand-grey-dimmed); background: var(--brand-grey-dimmed);
border-radius: var(--border-radius); border-radius: var(--border-radius);
padding: var(--spacer);
} }
.price > div { .content {
padding: 0 calc(var(--spacer) / 2);
text-align: center;
}
.content label {
color: var(--color-secondary);
}
.content input {
max-width: 8rem; max-width: 8rem;
text-align: center; text-align: center;
} }
.price label { .content p {
color: var(--color-secondary); margin-bottom: 0;
} }
.price input { .simpleInput {
width: 100%; display: flex;
text-align: center; justify-content: center;
margin-bottom: calc(var(--spacer) / 2);
}
.simpleInput input {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.prefix {
border: 1px solid var(--brand-grey-lighter);
display: flex;
align-items: center;
padding-left: calc(var(--spacer) / 2);
padding-right: calc(var(--spacer) / 2);
color: var(--color-secondary);
font-size: var(--font-size-small);
margin-right: -2px;
border-top-left-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
}
.advancedInput {
display: flex;
gap: calc(var(--spacer) / 2);
justify-content: center;
} }

View File

@ -5,17 +5,43 @@ import styles from './index.module.css'
import Label from '../../../atoms/Input/Label' import Label from '../../../atoms/Input/Label'
import { useFormikContext } from 'formik' import { useFormikContext } from 'formik'
import { MetadataPublishForm } from '../../../../@types/MetaData' import { MetadataPublishForm } from '../../../../@types/MetaData'
import Tabs from '../../../atoms/Tabs'
import FormHelp from '../../../atoms/Input/Help'
export default function Price(props: InputProps): ReactElement { export default function Price(props: InputProps): ReactElement {
const { values } = useFormikContext() const { values } = useFormikContext()
return ( const Simple = (
<div className={styles.price}> <div className={styles.content}>
<div className={styles.simpleInput}>
{/* <Label htmlFor="price.cost">Cost</Label> */}
<div className={styles.prefix}>OCEAN</div>
<InputElement
{...props.field}
value={
((values as MetadataPublishForm).price &&
(values as MetadataPublishForm).price.cost) ||
''
}
name="price.cost"
type="number"
/>
</div>
<FormHelp>{props.help}</FormHelp>
</div>
)
const Advanced = (
<div className={`${styles.content} ${styles.advancedInput}`}>
<div> <div>
<Label htmlFor="price.cost">Cost</Label> <Label htmlFor="price.cost">Cost</Label>
<InputElement <InputElement
{...props.field} {...props.field}
value={(values as MetadataPublishForm).price.cost} value={
((values as MetadataPublishForm).price &&
(values as MetadataPublishForm).price.cost) ||
''
}
name="price.cost" name="price.cost"
type="number" type="number"
/> />
@ -24,11 +50,32 @@ export default function Price(props: InputProps): ReactElement {
<Label htmlFor="price.tokensToMint">Tokens to Mint</Label> <Label htmlFor="price.tokensToMint">Tokens to Mint</Label>
<InputElement <InputElement
{...props.field} {...props.field}
value={(values as MetadataPublishForm).price.tokensToMint} value={
((values as MetadataPublishForm).price &&
(values as MetadataPublishForm).price.tokensToMint) ||
''
}
name="price.tokensToMint" name="price.tokensToMint"
type="number" type="number"
/> />
</div> </div>
</div> </div>
) )
const tabs = [
{
title: 'Simple',
content: Simple
},
{
title: 'Advanced',
content: Advanced
}
]
return (
<div className={styles.price}>
<Tabs items={tabs} />
</div>
)
} }