mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Remove FieldCustomAttributeSelect component
This commit is contained in:
parent
c2ecd93c88
commit
2e45cfebf1
4 changed files with 0 additions and 82 deletions
|
|
@ -1,4 +0,0 @@
|
||||||
@import '../../marketplace.css';
|
|
||||||
|
|
||||||
.root {
|
|
||||||
}
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import { string } from 'prop-types';
|
|
||||||
import { intlShape, injectIntl } from 'react-intl';
|
|
||||||
import classNames from 'classnames';
|
|
||||||
import config from '../../config';
|
|
||||||
import { required } from '../../util/validators';
|
|
||||||
import { SelectField } from '../../components';
|
|
||||||
|
|
||||||
import css from './FieldCustomAttributeSelect.css';
|
|
||||||
|
|
||||||
const FieldCustomAttributeSelect = props => {
|
|
||||||
const { className, rootClassName, id, customAttribute, intl } = props;
|
|
||||||
|
|
||||||
// Does custom attribute 'customAttribute' exists in current marketplace configuration
|
|
||||||
const ca = config.customAttributes && config.customAttributes[customAttribute];
|
|
||||||
const isSingleChoice = ca && ca.select === 'single' && ca.type === 'string';
|
|
||||||
|
|
||||||
// If custom attribute config for given 'customAttribute' doesn't exist, don't print SelectField
|
|
||||||
if (!isSingleChoice) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const caLabel = intl.formatMessage({ id: `FieldCustomAttributeSelect.${customAttribute}.label` });
|
|
||||||
const caPlaceholder = intl.formatMessage({
|
|
||||||
id: `FieldCustomAttributeSelect.${customAttribute}.placeholder`,
|
|
||||||
});
|
|
||||||
const caRequired = required(
|
|
||||||
intl.formatMessage({
|
|
||||||
id: `FieldCustomAttributeSelect.${customAttribute}.required`,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const classes = classNames(rootClassName || css.root, className);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SelectField
|
|
||||||
className={classes}
|
|
||||||
name={customAttribute}
|
|
||||||
id={id}
|
|
||||||
label={caLabel}
|
|
||||||
validate={caRequired}
|
|
||||||
>
|
|
||||||
<option value="">{caPlaceholder}</option>
|
|
||||||
{ca.values.map(c => (
|
|
||||||
<option key={c} value={c}>
|
|
||||||
{intl.formatMessage({ id: `FieldCustomAttributeSelect.${customAttribute}.option.${c}` })}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</SelectField>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
FieldCustomAttributeSelect.defaultProps = {
|
|
||||||
className: null,
|
|
||||||
rootClassName: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
FieldCustomAttributeSelect.propTypes = {
|
|
||||||
className: string,
|
|
||||||
rootClassName: string,
|
|
||||||
id: string.isRequired,
|
|
||||||
customAttribute: string.isRequired,
|
|
||||||
|
|
||||||
// From react-intl
|
|
||||||
intl: intlShape.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default injectIntl(FieldCustomAttributeSelect);
|
|
||||||
|
|
@ -31,9 +31,6 @@ export { default as ExpandingTextarea } from './ExpandingTextarea/ExpandingTexta
|
||||||
export { default as ExternalLink } from './ExternalLink/ExternalLink';
|
export { default as ExternalLink } from './ExternalLink/ExternalLink';
|
||||||
export { default as FilterPanel } from './FilterPanel/FilterPanel';
|
export { default as FilterPanel } from './FilterPanel/FilterPanel';
|
||||||
export { default as FieldCheckbox } from './FieldCheckbox/FieldCheckbox';
|
export { default as FieldCheckbox } from './FieldCheckbox/FieldCheckbox';
|
||||||
export {
|
|
||||||
default as FieldCustomAttributeSelect,
|
|
||||||
} from './FieldCustomAttributeSelect/FieldCustomAttributeSelect';
|
|
||||||
export { default as FieldGroupCheckbox } from './FieldGroupCheckbox/FieldGroupCheckbox';
|
export { default as FieldGroupCheckbox } from './FieldGroupCheckbox/FieldGroupCheckbox';
|
||||||
export { default as FieldReviewRating } from './FieldReviewRating/FieldReviewRating';
|
export { default as FieldReviewRating } from './FieldReviewRating/FieldReviewRating';
|
||||||
export { default as Footer } from './Footer/Footer';
|
export { default as Footer } from './Footer/Footer';
|
||||||
|
|
|
||||||
|
|
@ -194,13 +194,6 @@
|
||||||
"EnquiryForm.messageRequired": "A message is required",
|
"EnquiryForm.messageRequired": "A message is required",
|
||||||
"EnquiryForm.sendEnquiryError": "Whoops, something went wrong. Please try again.",
|
"EnquiryForm.sendEnquiryError": "Whoops, something went wrong. Please try again.",
|
||||||
"EnquiryForm.submitButtonText": "Send enquiry",
|
"EnquiryForm.submitButtonText": "Send enquiry",
|
||||||
"FieldCustomAttributeSelect.category.label": "Sauna type",
|
|
||||||
"FieldCustomAttributeSelect.category.option.mountain": "Mountain",
|
|
||||||
"FieldCustomAttributeSelect.category.option.other": "Other",
|
|
||||||
"FieldCustomAttributeSelect.category.option.road": "Road",
|
|
||||||
"FieldCustomAttributeSelect.category.option.track": "Track",
|
|
||||||
"FieldCustomAttributeSelect.category.placeholder": "Choose the type of your sauna…",
|
|
||||||
"FieldCustomAttributeSelect.category.required": "You need to select a category for your sauna.",
|
|
||||||
"FieldReviewRating.star1": "Bad experience - 1 star",
|
"FieldReviewRating.star1": "Bad experience - 1 star",
|
||||||
"FieldReviewRating.star2": "Not so nice - 2 stars",
|
"FieldReviewRating.star2": "Not so nice - 2 stars",
|
||||||
"FieldReviewRating.star3": "OK - 3 stars",
|
"FieldReviewRating.star3": "OK - 3 stars",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue