wip(fs.lab): Work on workbench components
This commit is contained in:
parent
8703983f2f
commit
22b25c0c5d
5 changed files with 242 additions and 63 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { useState } from 'react'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
|
||||
/*
|
||||
* This is a single input for a measurements
|
||||
|
@ -11,7 +11,6 @@ import React, { useState } from 'react'
|
|||
const MeasurementInput = ({ m, gist, app, updateMeasurements }) => {
|
||||
const prefix = (app.site === 'org') ? '' : 'https://freesewing.org'
|
||||
const title = app.t(`measurements.${m}`)
|
||||
console.log('render', m)
|
||||
const isValid = input => {
|
||||
if (input === null || input === '') return null
|
||||
return !isNaN(input)
|
||||
|
@ -23,7 +22,7 @@ const MeasurementInput = ({ m, gist, app, updateMeasurements }) => {
|
|||
console.log({ok})
|
||||
if (ok) {
|
||||
setValid(true)
|
||||
updateMeasurements(evt.target.value, m)
|
||||
updateMeasurements(evt.target.value*10, m)
|
||||
} else setValid(false)
|
||||
}
|
||||
|
||||
|
@ -33,6 +32,11 @@ const MeasurementInput = ({ m, gist, app, updateMeasurements }) => {
|
|||
isValid(gist.measurements[m])
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
console.log(gist.measurements)
|
||||
if (gist?.measurements?.[m]) setVal(gist.measurements[m]/10)
|
||||
}, [gist])
|
||||
|
||||
if (!m) return null
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue