1
0
Fork 0
freesewing/packages/components/src/SampleConfigurator/index.js

95 lines
2.1 KiB
JavaScript
Raw Normal View History

import React, { useState } from "react";
import { FormattedMessage } from "react-intl";
import PatternOptions from "./PatternOptions";
import models 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: models.manSize42
};
for (let m in models.manSize42) antMan.ant[m] = antMan.man[m] / 10;
return (
<ul className="links">
<li className="nodot">
2019-05-27 07:52:34 +02:00
<h4>
<FormattedMessage id="app.patternOptions" />
2019-05-27 07:52:34 +02:00
</h4>
<PatternOptions
config={props.config}
gist={props.gist}
sampleOption={sampleOption}
/>
</li>
<li className="nodot">
2019-05-27 07:52:34 +02:00
<h4>
<FormattedMessage id="app.measurements" />
2019-05-27 07:52:34 +02:00
</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">
2019-05-27 07:52:34 +02:00
<h4>
<FormattedMessage id="app.models" />
2019-05-27 07:52:34 +02:00
</h4>
<ul style={{ paddingLeft: "1rem" }}>
<li>
<a href="#logo" onClick={() => sampleModels(models)}>
<FormattedMessage id="app.withoutBreasts" />
</a>
</li>
<li>
<a href="#logo" onClick={() => sampleModels(antMan)}>
Antman
</a>
</li>
</ul>
</li>
</ul>
);
};
export default SampleConfigurator;