-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store: Update ProductSearch
component for better variation support, multiple selections
#19531
Changes from 1 commit
766b65a
e02af8f
4c79b30
d123a70
7421d53
7a8b10a
ead4472
dd7df28
1e04682
8f1f4b8
988d6ac
1dafc04
c87bba0
74ee098
3ecada0
aa5733b
ecebc67
ae3e2d9
94a3b97
3a4188f
c05afa8
6e14d29
5528e92
24a6c25
69a0cea
a3370f8
d488f4b
fd909c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,9 @@ import FormLegend from 'components/forms/form-legend'; | |
import FormSelect from 'components/forms/form-select'; | ||
import Notice from 'components/notice'; | ||
|
||
// Use a constant for the default attribute state. | ||
const DEFAULT_ATTR = 'any'; | ||
|
||
class ProductVariations extends Component { | ||
static propTypes = { | ||
onChange: PropTypes.func, | ||
|
@@ -27,7 +30,7 @@ class ProductVariations extends Component { | |
this.state = {}; | ||
const attributes = filter( props.product.attributes, { variation: true } ); | ||
forEach( attributes, attr => { | ||
this.state[ attr.name ] = 'any'; // Values default to any. | ||
this.state[ attr.name ] = DEFAULT_ATTR; | ||
} ); | ||
} | ||
|
||
|
@@ -47,8 +50,8 @@ class ProductVariations extends Component { | |
id={ `select-${ kebabCase( attribute.name ) }` } | ||
onChange={ this.onChange( attribute.name ) } | ||
> | ||
<option key={ 'any' } value="any"> | ||
{ translate( 'Any' ) } | ||
<option key={ DEFAULT_ATTR } value={ DEFAULT_ATTR }> | ||
{ translate( 'Select one' ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi! I've found a possible matching string that has already been translated 15 times: Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented). |
||
</option> | ||
{ attribute.options.map( ( opt, i ) => <option key={ i }>{ opt }</option> ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange, I'm not. But I'll update it regardless, seems like a good idea. |
||
</FormSelect> | ||
|
@@ -71,7 +74,7 @@ class ProductVariations extends Component { | |
<FormLegend> | ||
<Notice showDismiss={ false }> | ||
{ translate( | ||
'%(product)s has variations. Select a specific customization, or add the base product.', | ||
'%(product)s has variations. Choose a specific customization to select.', | ||
{ args: { product: product.name } } | ||
) } | ||
</Notice> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! I've found a possible matching string that has already been translated 15 times:
translate( 'Select one...' )
ES Score: 11Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, who forgot to use the … character?