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

add conversion, tweak default values

This commit is contained in:
Matthias Kretschmann 2020-07-24 09:13:38 +02:00
parent 6e33ad92cb
commit ef02919e5e
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,6 @@
.conversion { .conversion {
display: inline-block; display: inline-block;
font-size: var(--font-size-mini); font-size: var(--font-size-small);
margin-left: calc(var(--spacer) / 6); margin-left: calc(var(--spacer) / 6);
color: var(--color-secondary); color: var(--color-secondary);
} }

View File

@ -25,6 +25,7 @@
.simpleInput { .simpleInput {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center;
margin-bottom: calc(var(--spacer) / 2); margin-bottom: calc(var(--spacer) / 2);
} }
@ -35,6 +36,7 @@
.prefix { .prefix {
border: 1px solid var(--brand-grey-lighter); border: 1px solid var(--brand-grey-lighter);
min-height: 43px;
display: flex; display: flex;
align-items: center; align-items: center;
padding-left: calc(var(--spacer) / 2); padding-left: calc(var(--spacer) / 2);

View File

@ -7,6 +7,7 @@ import { useFormikContext } from 'formik'
import { MetadataPublishForm } from '../../../../@types/MetaData' import { MetadataPublishForm } from '../../../../@types/MetaData'
import Tabs from '../../../atoms/Tabs' import Tabs from '../../../atoms/Tabs'
import FormHelp from '../../../atoms/Input/Help' import FormHelp from '../../../atoms/Input/Help'
import Conversion from '../../../atoms/Price/Conversion'
export default function Price(props: InputProps): ReactElement { export default function Price(props: InputProps): ReactElement {
const { values } = useFormikContext() const { values } = useFormikContext()
@ -21,11 +22,14 @@ export default function Price(props: InputProps): ReactElement {
value={ value={
((values as MetadataPublishForm).price && ((values as MetadataPublishForm).price &&
(values as MetadataPublishForm).price.cost) || (values as MetadataPublishForm).price.cost) ||
'' 0
} }
name="price.cost" name="price.cost"
type="number" type="number"
/> />
<Conversion
price={(values as MetadataPublishForm).price.cost.toString()}
/>
</div> </div>
<FormHelp>{props.help}</FormHelp> <FormHelp>{props.help}</FormHelp>
</div> </div>
@ -38,9 +42,8 @@ export default function Price(props: InputProps): ReactElement {
<InputElement <InputElement
{...props.field} {...props.field}
value={ value={
((values as MetadataPublishForm).price && (values as MetadataPublishForm).price &&
(values as MetadataPublishForm).price.cost) || ((values as MetadataPublishForm).price.cost || 1)
''
} }
name="price.cost" name="price.cost"
type="number" type="number"
@ -51,9 +54,8 @@ export default function Price(props: InputProps): ReactElement {
<InputElement <InputElement
{...props.field} {...props.field}
value={ value={
((values as MetadataPublishForm).price && (values as MetadataPublishForm).price &&
(values as MetadataPublishForm).price.tokensToMint) || ((values as MetadataPublishForm).price.tokensToMint || 1)
''
} }
name="price.tokensToMint" name="price.tokensToMint"
type="number" type="number"

View File

@ -28,7 +28,7 @@ export const initialValues: MetadataPublishForm = {
name: '', name: '',
author: '', author: '',
price: { price: {
cost: 0, cost: 1,
tokensToMint: null tokensToMint: null
}, },
files: '', files: '',