2019-09-25 18:03:44 +02:00
|
|
|
import React, { useState } from 'react'
|
|
|
|
import { FormattedMessage } from 'react-intl'
|
|
|
|
import PatternOptions from './PatternOptions'
|
|
|
|
import { withBreasts, withoutBreasts } from '@freesewing/models'
|
2019-05-07 16:57:41 +02:00
|
|
|
|
|
|
|
const SampleConfigurator = props => {
|
2019-09-25 18:03:44 +02:00
|
|
|
const [expanded, setExpanded] = useState([])
|
2019-05-07 16:57:41 +02:00
|
|
|
|
|
|
|
const sampleOption = option => {
|
|
|
|
props.updateGist(
|
|
|
|
{
|
2019-09-25 18:03:44 +02:00
|
|
|
type: 'option',
|
2019-05-07 16:57:41 +02:00
|
|
|
option
|
|
|
|
},
|
2019-09-25 18:03:44 +02:00
|
|
|
'settings',
|
|
|
|
'sample'
|
|
|
|
)
|
|
|
|
}
|
2019-05-07 16:57:41 +02:00
|
|
|
|
|
|
|
const sampleMeasurement = measurement => {
|
|
|
|
props.updateGist(
|
|
|
|
{
|
2019-09-25 18:03:44 +02:00
|
|
|
type: 'measurement',
|
2019-05-07 16:57:41 +02:00
|
|
|
measurement
|
|
|
|
},
|
2019-09-25 18:03:44 +02:00
|
|
|
'settings',
|
|
|
|
'sample'
|
|
|
|
)
|
|
|
|
}
|
2019-05-07 16:57:41 +02:00
|
|
|
|
|
|
|
const sampleModels = models => {
|
|
|
|
props.updateGist(
|
|
|
|
{
|
2019-09-25 18:03:44 +02:00
|
|
|
type: 'models',
|
2019-05-07 16:57:41 +02:00
|
|
|
models
|
|
|
|
},
|
2019-09-25 18:03:44 +02:00
|
|
|
'settings',
|
|
|
|
'sample'
|
|
|
|
)
|
|
|
|
}
|
2019-05-07 16:57:41 +02:00
|
|
|
let antMan = {
|
|
|
|
ant: {},
|
2019-07-14 11:35:51 +02:00
|
|
|
man: withoutBreasts.manSize42
|
2019-09-25 18:03:44 +02:00
|
|
|
}
|
|
|
|
for (let m in withoutBreasts.manSize42) antMan.ant[m] = antMan.man[m] / 10
|
2019-05-07 16:57:41 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<ul className="links">
|
|
|
|
<li className="nodot">
|
2019-05-27 07:52:34 +02:00
|
|
|
<h4>
|
2019-05-07 16:57:41 +02:00
|
|
|
<FormattedMessage id="app.patternOptions" />
|
2019-05-27 07:52:34 +02:00
|
|
|
</h4>
|
2019-09-25 18:03:44 +02:00
|
|
|
<PatternOptions config={props.config} gist={props.gist} sampleOption={sampleOption} />
|
2019-05-07 16:57:41 +02:00
|
|
|
</li>
|
|
|
|
<li className="nodot">
|
2019-05-27 07:52:34 +02:00
|
|
|
<h4>
|
2019-05-07 16:57:41 +02:00
|
|
|
<FormattedMessage id="app.measurements" />
|
2019-05-27 07:52:34 +02:00
|
|
|
</h4>
|
2019-09-25 18:03:44 +02:00
|
|
|
<ul style={{ paddingLeft: '1rem' }}>
|
2019-05-07 16:57:41 +02:00
|
|
|
{props.config.measurements.map(m => (
|
|
|
|
<li key={m}>
|
|
|
|
<a href="#logo" onClick={() => sampleMeasurement(m)}>
|
2019-09-25 18:03:44 +02:00
|
|
|
<FormattedMessage id={'measurements.' + m} />
|
2019-05-07 16:57:41 +02:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li className="nodot">
|
2019-05-27 07:52:34 +02:00
|
|
|
<h4>
|
2019-05-07 16:57:41 +02:00
|
|
|
<FormattedMessage id="app.models" />
|
2019-05-27 07:52:34 +02:00
|
|
|
</h4>
|
2019-09-25 18:03:44 +02:00
|
|
|
<ul style={{ paddingLeft: '1rem' }}>
|
|
|
|
<li>
|
|
|
|
<a href="#logo" onClick={() => sampleModels(withBreasts)}>
|
|
|
|
<FormattedMessage id="app.withBreasts" />
|
|
|
|
</a>
|
|
|
|
</li>
|
2019-05-07 16:57:41 +02:00
|
|
|
<li>
|
2019-07-14 11:35:51 +02:00
|
|
|
<a href="#logo" onClick={() => sampleModels(withoutBreasts)}>
|
2019-05-07 16:57:41 +02:00
|
|
|
<FormattedMessage id="app.withoutBreasts" />
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="#logo" onClick={() => sampleModels(antMan)}>
|
|
|
|
Antman
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2019-09-25 18:03:44 +02:00
|
|
|
)
|
|
|
|
}
|
2019-05-07 16:57:41 +02:00
|
|
|
|
2019-09-25 18:03:44 +02:00
|
|
|
export default SampleConfigurator
|