-
-
Notifications
You must be signed in to change notification settings - Fork 266
/
index.js
95 lines (89 loc) · 2.27 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import React, { useState } from 'react'
import { FormattedMessage } from 'react-intl'
import PatternOptions from './PatternOptions'
import { withBreasts, withoutBreasts } from '@freesewing/models'
const SampleConfigurator = props => {
const [expanded, setExpanded] = useState([])
const sampleOption = option => {
props.updateGist(
{
type: 'option',
option
},
'settings',
'sample'
)
}
const sampleMeasurement = measurement => {
props.updateGist(
{
type: 'measurement',
measurement
},
'settings',
'sample'
)
}
const sampleModels = models => {
props.updateGist(
{
type: 'models',
models
},
'settings',
'sample'
)
}
let antMan = {
ant: {},
man: withoutBreasts.manSize42
}
for (let m in withoutBreasts.manSize42) antMan.ant[m] = antMan.man[m] / 10
return (
<ul className="links">
<li className="nodot">
<h4>
<FormattedMessage id="app.patternOptions" />
</h4>
<PatternOptions config={props.config} gist={props.gist} sampleOption={sampleOption} />
</li>
<li className="nodot">
<h4>
<FormattedMessage id="app.measurements" />
</h4>
<ul style={{ paddingLeft: '1rem' }}>
{props.config.measurements.map(m => (
<li key={m}>
<a href="#logo" onClick={() => sampleMeasurement(m)}>
<FormattedMessage id={'measurements.' + m} />
</a>
</li>
))}
</ul>
</li>
<li className="nodot">
<h4>
<FormattedMessage id="app.models" />
</h4>
<ul style={{ paddingLeft: '1rem' }}>
<li>
<a href="#logo" onClick={() => sampleModels(withBreasts)}>
<FormattedMessage id="app.withBreasts" />
</a>
</li>
<li>
<a href="#logo" onClick={() => sampleModels(withoutBreasts)}>
<FormattedMessage id="app.withoutBreasts" />
</a>
</li>
<li>
<a href="#logo" onClick={() => sampleModels(antMan)}>
Antman
</a>
</li>
</ul>
</li>
</ul>
)
}
export default SampleConfigurator