refactor(components): Removed prop-types dependency
This commit is contained in:
parent
8cf8424437
commit
cda9b03713
44 changed files with 559 additions and 1026 deletions
|
@ -1,11 +1,25 @@
|
|||
import React, { useState } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import React from 'react'
|
||||
import { FormattedMessage } from 'react-intl'
|
||||
import PatternOptions from './PatternOptions'
|
||||
import DraftSettings from './DraftSettings'
|
||||
|
||||
const DraftConfigurator = props => {
|
||||
const [expanded, setExpanded] = useState([])
|
||||
const DraftConfigurator = ({
|
||||
noDocs = false,
|
||||
units = 'metric',
|
||||
config = {},
|
||||
data = {},
|
||||
pattern,
|
||||
updatePatternData,
|
||||
raiseEvent
|
||||
}) => {
|
||||
let childProps = {
|
||||
noDocs,
|
||||
units,
|
||||
config,
|
||||
data,
|
||||
pattern,
|
||||
raiseEvent
|
||||
}
|
||||
return (
|
||||
<ul className="config l1">
|
||||
<li>
|
||||
|
@ -13,13 +27,8 @@ const DraftConfigurator = props => {
|
|||
<FormattedMessage id="app.designOptions" />
|
||||
</span>
|
||||
<PatternOptions
|
||||
noDocs={props.noDocs}
|
||||
config={props.config}
|
||||
data={props.data}
|
||||
pattern={props.pattern}
|
||||
updateValue={(name, value) => props.updatePatternData(value, 'settings', 'options', name)}
|
||||
raiseEvent={props.raiseEvent}
|
||||
units={props.units}
|
||||
{...childProps}
|
||||
updateValue={(name, value) => updatePatternData(value, 'settings', 'options', name)}
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -27,25 +36,12 @@ const DraftConfigurator = props => {
|
|||
<FormattedMessage id="app.patternOptions" />
|
||||
</span>
|
||||
<DraftSettings
|
||||
noDocs={props.noDocs}
|
||||
config={props.config}
|
||||
data={props.data}
|
||||
pattern={props.pattern}
|
||||
updateValue={(name, value) => props.updatePatternData(value, 'settings', name)}
|
||||
raiseEvent={props.raiseEvent}
|
||||
units={props.units}
|
||||
{...childProps}
|
||||
updateValue={(name, value) => updatePatternData(value, 'settings', name)}
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
DraftConfigurator.propTypes = {
|
||||
units: PropTypes.oneOf(['metric', 'imperial']).isRequired
|
||||
}
|
||||
|
||||
DraftConfigurator.defaultProps = {
|
||||
noDocs: false
|
||||
}
|
||||
|
||||
export default DraftConfigurator
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue