1
0
Fork 0

feat(components): Added antwomen test to SampleConfigurator

This commit is contained in:
Joost De Cock 2020-06-01 13:55:36 +02:00
parent 4d5f02b86e
commit 796976aaf7

View file

@ -2,11 +2,12 @@ import React, { useState } from 'react'
import { FormattedMessage } from 'react-intl'
import PatternOptions from './PatternOptions'
import { withBreasts, withoutBreasts } from '@freesewing/models'
import neckstimate from '@freesewing/utils/neckstimate'
const SampleConfigurator = props => {
const SampleConfigurator = (props) => {
const [expanded, setExpanded] = useState([])
const sampleOption = option => {
const sampleOption = (option) => {
props.updateGist(
{
type: 'option',
@ -17,7 +18,7 @@ const SampleConfigurator = props => {
)
}
const sampleMeasurement = measurement => {
const sampleMeasurement = (measurement) => {
props.updateGist(
{
type: 'measurement',
@ -28,7 +29,7 @@ const SampleConfigurator = props => {
)
}
const sampleModels = models => {
const sampleModels = (models) => {
props.updateGist(
{
type: 'models',
@ -38,11 +39,22 @@ const SampleConfigurator = props => {
'sample'
)
}
let antMan = {
ant: {},
man: withoutBreasts.manSize42
const antMan = { ant: {}, b: {}, c: {}, man: {} }
const antWoman = { ant: {}, b: {}, c: {}, woman: {} }
for (let m in withoutBreasts.size42) {
let val = neckstimate(420, m, false)
antMan.ant[m] = val / 10
antMan.b[m] = val / 5
antMan.c[m] = val / 2
antMan.man[m] = val
}
for (let m in withBreasts.size36) {
let val = neckstimate(360, m, true)
antWoman.ant[m] = val / 10
antWoman.b[m] = val / 5
antWoman.c[m] = val / 2
antWoman.woman[m] = val
}
for (let m in withoutBreasts.manSize42) antMan.ant[m] = antMan.man[m] / 10
return (
<ul className="links">
@ -57,7 +69,7 @@ const SampleConfigurator = props => {
<FormattedMessage id="app.measurements" />
</h4>
<ul style={{ paddingLeft: '1rem' }}>
{props.config.measurements.map(m => (
{props.config.measurements.map((m) => (
<li key={m}>
<a href="#logo" onClick={() => sampleMeasurement(m)}>
<FormattedMessage id={'measurements.' + m} />
@ -81,6 +93,11 @@ const SampleConfigurator = props => {
<FormattedMessage id="app.withoutBreasts" />
</a>
</li>
<li>
<a href="#logo" onClick={() => sampleModels(antWoman)}>
Antwoman
</a>
</li>
<li>
<a href="#logo" onClick={() => sampleModels(antMan)}>
Antman