From 2e45cfebf122cd2e4384d8daf34baaa62d4de416 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Fri, 26 Jan 2018 11:36:34 +0200 Subject: [PATCH] Remove FieldCustomAttributeSelect component --- .../FieldCustomAttributeSelect.css | 4 -- .../FieldCustomAttributeSelect.js | 68 ------------------- src/components/index.js | 3 - src/translations/en.json | 7 -- 4 files changed, 82 deletions(-) delete mode 100644 src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.css delete mode 100644 src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.js diff --git a/src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.css b/src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.css deleted file mode 100644 index 93adba15..00000000 --- a/src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.css +++ /dev/null @@ -1,4 +0,0 @@ -@import '../../marketplace.css'; - -.root { -} diff --git a/src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.js b/src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.js deleted file mode 100644 index bb15a85c..00000000 --- a/src/components/FieldCustomAttributeSelect/FieldCustomAttributeSelect.js +++ /dev/null @@ -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 ( - - - {ca.values.map(c => ( - - ))} - - ); -}; - -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); diff --git a/src/components/index.js b/src/components/index.js index 9fa3a22e..91c3f887 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -31,9 +31,6 @@ export { default as ExpandingTextarea } from './ExpandingTextarea/ExpandingTexta export { default as ExternalLink } from './ExternalLink/ExternalLink'; export { default as FilterPanel } from './FilterPanel/FilterPanel'; export { default as FieldCheckbox } from './FieldCheckbox/FieldCheckbox'; -export { - default as FieldCustomAttributeSelect, -} from './FieldCustomAttributeSelect/FieldCustomAttributeSelect'; export { default as FieldGroupCheckbox } from './FieldGroupCheckbox/FieldGroupCheckbox'; export { default as FieldReviewRating } from './FieldReviewRating/FieldReviewRating'; export { default as Footer } from './Footer/Footer'; diff --git a/src/translations/en.json b/src/translations/en.json index 8f7d63af..fb73b05c 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -194,13 +194,6 @@ "EnquiryForm.messageRequired": "A message is required", "EnquiryForm.sendEnquiryError": "Whoops, something went wrong. Please try again.", "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.star2": "Not so nice - 2 stars", "FieldReviewRating.star3": "OK - 3 stars",