🐛 Fixed display issue in SampleConfigurator
This commit is contained in:
parent
9a839e415c
commit
13d39f2bae
4 changed files with 70 additions and 58 deletions
|
@ -2,7 +2,9 @@ Unreleased:
|
||||||
date:
|
date:
|
||||||
Added:
|
Added:
|
||||||
i18n:
|
i18n:
|
||||||
- Added translations for Penelope and Waralee
|
- Added translations for Penelope, Waralee, and Simone
|
||||||
|
simone:
|
||||||
|
- Added the Simone shirt pattern
|
||||||
penelope:
|
penelope:
|
||||||
- Added the Penelope Pencil Skirt pattern by @woutervdub
|
- Added the Penelope Pencil Skirt pattern by @woutervdub
|
||||||
utils:
|
utils:
|
||||||
|
@ -29,6 +31,8 @@ Unreleased:
|
||||||
package has been deprecated. Please import our patterns individually.
|
package has been deprecated. Please import our patterns individually.
|
||||||
Removed:
|
Removed:
|
||||||
Fixed:
|
Fixed:
|
||||||
|
components:
|
||||||
|
- Fixed display of nested option in SampleConfigurator
|
||||||
simon:
|
simon:
|
||||||
- Fixed an issue where the store wasn't properly initialized causing hips and waist ease
|
- Fixed an issue where the store wasn't properly initialized causing hips and waist ease
|
||||||
to be set incorrectly
|
to be set incorrectly
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
**Note:** Version bump only for package components
|
### Changed
|
||||||
|
|
||||||
|
|
||||||
|
- Added Penelope and Waralee linedrawings
|
||||||
## 2.0.4 (2019-09-27)
|
## 2.0.4 (2019-09-27)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -1,47 +1,54 @@
|
||||||
import React from "react";
|
import React from 'react'
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from 'prop-types'
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from 'react-intl'
|
||||||
import { injectIntl } from "react-intl";
|
import { injectIntl } from 'react-intl'
|
||||||
|
|
||||||
const OptionGroup = props => {
|
const OptionGroup = props => {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{props.options.map(name => {
|
{props.options.map(name => {
|
||||||
let output = [];
|
let output = []
|
||||||
if (typeof name === "object") {
|
if (typeof name === 'object') {
|
||||||
// Subgroup
|
// Subgroup
|
||||||
for (let subGroup of Object.keys(name)) {
|
for (let subGroup of Object.keys(name)) {
|
||||||
output.push(
|
output.push(
|
||||||
<h5 key={subGroup + "-title"} className="subheading">
|
<h5 key={subGroup + '-title'} className="subheading">
|
||||||
<FormattedMessage id={"optiongroups." + subGroup} />
|
<FormattedMessage id={'optiongroups.' + subGroup} />
|
||||||
</h5>
|
</h5>
|
||||||
);
|
)
|
||||||
let children = [];
|
let children = []
|
||||||
for (let option of name[subGroup]) children.push(<p>{option}</p>);
|
for (let option of name[subGroup])
|
||||||
output.push(<ul style={{ paddingLeft: "1rem" }}>{children}</ul>);
|
children.push(
|
||||||
|
<li>
|
||||||
|
<a href="#logo" onClick={() => props.sampleOption(option)}>
|
||||||
|
<FormattedMessage
|
||||||
|
id={'options.' + props.config.name + '.' + option + '.title'}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
output.push(<ul style={{ paddingLeft: '1rem' }}>{children}</ul>)
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
output.push(
|
output.push(
|
||||||
<li>
|
<li>
|
||||||
<a href="#logo" onClick={() => props.sampleOption(name)}>
|
<a href="#logo" onClick={() => props.sampleOption(name)}>
|
||||||
<FormattedMessage
|
<FormattedMessage id={'options.' + props.config.name + '.' + name + '.title'} />
|
||||||
id={"options." + props.config.name + "." + name + ".title"}
|
|
||||||
/>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
);
|
)
|
||||||
|
|
||||||
return output;
|
return output
|
||||||
})}
|
})}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
||||||
OptionGroup.propTypes = {
|
OptionGroup.propTypes = {
|
||||||
config: PropTypes.object.isRequired,
|
config: PropTypes.object.isRequired,
|
||||||
options: PropTypes.array.isRequired
|
options: PropTypes.array.isRequired
|
||||||
};
|
}
|
||||||
|
|
||||||
OptionGroup.defaultProps = {};
|
OptionGroup.defaultProps = {}
|
||||||
|
|
||||||
export default injectIntl(OptionGroup);
|
export default injectIntl(OptionGroup)
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from 'react'
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from 'react-intl'
|
||||||
import PatternOptions from "./PatternOptions";
|
import PatternOptions from './PatternOptions'
|
||||||
import { withoutBreasts } from "@freesewing/models";
|
import { withBreasts, withoutBreasts } from '@freesewing/models'
|
||||||
|
|
||||||
const SampleConfigurator = props => {
|
const SampleConfigurator = props => {
|
||||||
const [expanded, setExpanded] = useState([]);
|
const [expanded, setExpanded] = useState([])
|
||||||
|
|
||||||
const sampleOption = option => {
|
const sampleOption = option => {
|
||||||
props.updateGist(
|
props.updateGist(
|
||||||
{
|
{
|
||||||
type: "option",
|
type: 'option',
|
||||||
option
|
option
|
||||||
},
|
},
|
||||||
"settings",
|
'settings',
|
||||||
"sample"
|
'sample'
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
||||||
const sampleMeasurement = measurement => {
|
const sampleMeasurement = measurement => {
|
||||||
props.updateGist(
|
props.updateGist(
|
||||||
{
|
{
|
||||||
type: "measurement",
|
type: 'measurement',
|
||||||
measurement
|
measurement
|
||||||
},
|
},
|
||||||
"settings",
|
'settings',
|
||||||
"sample"
|
'sample'
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
||||||
const sampleModels = models => {
|
const sampleModels = models => {
|
||||||
props.updateGist(
|
props.updateGist(
|
||||||
{
|
{
|
||||||
type: "models",
|
type: 'models',
|
||||||
models
|
models
|
||||||
},
|
},
|
||||||
"settings",
|
'settings',
|
||||||
"sample"
|
'sample'
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
let antMan = {
|
let antMan = {
|
||||||
ant: {},
|
ant: {},
|
||||||
man: withoutBreasts.manSize42
|
man: withoutBreasts.manSize42
|
||||||
};
|
}
|
||||||
for (let m in withoutBreasts.manSize42) antMan.ant[m] = antMan.man[m] / 10;
|
for (let m in withoutBreasts.manSize42) antMan.ant[m] = antMan.man[m] / 10
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul className="links">
|
<ul className="links">
|
||||||
|
@ -50,21 +50,17 @@ const SampleConfigurator = props => {
|
||||||
<h4>
|
<h4>
|
||||||
<FormattedMessage id="app.patternOptions" />
|
<FormattedMessage id="app.patternOptions" />
|
||||||
</h4>
|
</h4>
|
||||||
<PatternOptions
|
<PatternOptions config={props.config} gist={props.gist} sampleOption={sampleOption} />
|
||||||
config={props.config}
|
|
||||||
gist={props.gist}
|
|
||||||
sampleOption={sampleOption}
|
|
||||||
/>
|
|
||||||
</li>
|
</li>
|
||||||
<li className="nodot">
|
<li className="nodot">
|
||||||
<h4>
|
<h4>
|
||||||
<FormattedMessage id="app.measurements" />
|
<FormattedMessage id="app.measurements" />
|
||||||
</h4>
|
</h4>
|
||||||
<ul style={{ paddingLeft: "1rem" }}>
|
<ul style={{ paddingLeft: '1rem' }}>
|
||||||
{props.config.measurements.map(m => (
|
{props.config.measurements.map(m => (
|
||||||
<li key={m}>
|
<li key={m}>
|
||||||
<a href="#logo" onClick={() => sampleMeasurement(m)}>
|
<a href="#logo" onClick={() => sampleMeasurement(m)}>
|
||||||
<FormattedMessage id={"measurements." + m} />
|
<FormattedMessage id={'measurements.' + m} />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
@ -74,7 +70,12 @@ const SampleConfigurator = props => {
|
||||||
<h4>
|
<h4>
|
||||||
<FormattedMessage id="app.models" />
|
<FormattedMessage id="app.models" />
|
||||||
</h4>
|
</h4>
|
||||||
<ul style={{ paddingLeft: "1rem" }}>
|
<ul style={{ paddingLeft: '1rem' }}>
|
||||||
|
<li>
|
||||||
|
<a href="#logo" onClick={() => sampleModels(withBreasts)}>
|
||||||
|
<FormattedMessage id="app.withBreasts" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#logo" onClick={() => sampleModels(withoutBreasts)}>
|
<a href="#logo" onClick={() => sampleModels(withoutBreasts)}>
|
||||||
<FormattedMessage id="app.withoutBreasts" />
|
<FormattedMessage id="app.withoutBreasts" />
|
||||||
|
@ -88,7 +89,7 @@ const SampleConfigurator = props => {
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
||||||
export default SampleConfigurator;
|
export default SampleConfigurator
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue