mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
free price tweaks
This commit is contained in:
parent
5dca006832
commit
7c98659c86
@ -2,7 +2,8 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form * {
|
.form *,
|
||||||
|
.form label {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,3 +60,9 @@
|
|||||||
.conversion strong {
|
.conversion strong {
|
||||||
color: var(--color-secondary);
|
color: var(--color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.free {
|
||||||
|
text-align: center;
|
||||||
|
margin: calc(var(--spacer) / 2) 0;
|
||||||
|
font-size: var(--font-size-base);
|
||||||
|
}
|
||||||
|
@ -19,13 +19,13 @@ export default function Price({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.price}>
|
<div className={styles.price}>
|
||||||
|
{values.pricing.type === 'free' ? (
|
||||||
|
<h4 className={styles.free}>Free</h4>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<div className={styles.grid}>
|
<div className={styles.grid}>
|
||||||
<div className={styles.form}>
|
<div className={styles.form}>
|
||||||
{field.value === 0 ? (
|
|
||||||
<Input value="0" type="number" prefix="OCEAN" readOnly {...field} />
|
|
||||||
) : (
|
|
||||||
<Input type="number" prefix="OCEAN" {...field} />
|
<Input type="number" prefix="OCEAN" {...field} />
|
||||||
)}
|
|
||||||
<Error meta={meta} />
|
<Error meta={meta} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.datatoken}>
|
<div className={styles.datatoken}>
|
||||||
@ -45,6 +45,8 @@ export default function Price({
|
|||||||
/>
|
/>
|
||||||
</aside>
|
</aside>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ export default function PricingFields(): ReactElement {
|
|||||||
const type = tabName.toLowerCase()
|
const type = tabName.toLowerCase()
|
||||||
setFieldValue('pricing.type', type)
|
setFieldValue('pricing.type', type)
|
||||||
type === 'dynamic' && setFieldValue('pricing.amountDataToken', 1000)
|
type === 'dynamic' && setFieldValue('pricing.amountDataToken', 1000)
|
||||||
setFieldValue('pricing.price', type === 'free' ? 0 : 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always update everything when price value changes
|
// Always update everything when price value changes
|
||||||
|
@ -60,14 +60,7 @@ const validationPricing = {
|
|||||||
.required('Required'),
|
.required('Required'),
|
||||||
// https://github.com/jquense/yup#mixedwhenkeys-string--arraystring-builder-object--value-schema-schema-schema
|
// https://github.com/jquense/yup#mixedwhenkeys-string--arraystring-builder-object--value-schema-schema-schema
|
||||||
price: Yup.number()
|
price: Yup.number()
|
||||||
.when('type', (type, schema) =>
|
.min(1, (param: { min: number }) => `Must be more or equal to ${param.min}`)
|
||||||
type === 'free'
|
|
||||||
? schema
|
|
||||||
: schema.min(
|
|
||||||
1,
|
|
||||||
(param: { min: number }) => `Must be more or equal to ${param.min}`
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.required('Required'),
|
.required('Required'),
|
||||||
amountDataToken: Yup.number()
|
amountDataToken: Yup.number()
|
||||||
.min(50, (param) => `Must be more or equal to ${param.min}`)
|
.min(50, (param) => `Must be more or equal to ${param.min}`)
|
||||||
|
Loading…
Reference in New Issue
Block a user