Merge pull request woocommerce/woocommerce-admin#512 from woocommerce/fix/Tag-remove-label
Tag: use label in removeLabel
This commit is contained in:
commit
d994d22c5d
|
@ -95,7 +95,6 @@ class Search extends Component {
|
|||
id={ item.id }
|
||||
label={ item.label }
|
||||
remove={ this.removeResult }
|
||||
removeLabel={ __( 'Remove product', 'wc-admin' ) }
|
||||
screenReaderLabel={ screenReaderLabel }
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { __, sprintf } from '@wordpress/i18n';
|
||||
import { Fragment } from '@wordpress/element';
|
||||
import classnames from 'classnames';
|
||||
import { Button, Dashicon, IconButton, Popover } from '@wordpress/components';
|
||||
|
@ -27,7 +27,6 @@ const Tag = ( {
|
|||
label,
|
||||
popoverContents,
|
||||
remove,
|
||||
removeLabel,
|
||||
screenReaderLabel,
|
||||
setState,
|
||||
className,
|
||||
|
@ -76,7 +75,7 @@ const Tag = ( {
|
|||
className="woocommerce-tag__remove"
|
||||
icon={ <Dashicon icon="dismiss" size={ 20 } /> }
|
||||
onClick={ remove( id ) }
|
||||
label={ removeLabel }
|
||||
label={ sprintf( __( 'Remove %s', 'wc-admin' ), label ) }
|
||||
aria-describedby={ labelId }
|
||||
/>
|
||||
) }
|
||||
|
@ -101,20 +100,12 @@ Tag.propTypes = {
|
|||
* A function called when the remove X is clicked. If not used, no X icon will display.
|
||||
*/
|
||||
remove: PropTypes.func,
|
||||
/**
|
||||
* The label for removing this item (shown when hovering on X, or read to screen reader users). Defaults to "Remove tag".
|
||||
*/
|
||||
removeLabel: PropTypes.string,
|
||||
/**
|
||||
* A more descriptive label for screen reader users. Defaults to the `name` prop.
|
||||
*/
|
||||
screenReaderLabel: PropTypes.string,
|
||||
};
|
||||
|
||||
Tag.defaultProps = {
|
||||
removeLabel: __( 'Remove tag', 'wc-admin' ),
|
||||
};
|
||||
|
||||
export default withState( {
|
||||
isVisible: false,
|
||||
} )( withInstanceId( Tag ) );
|
||||
|
|
Loading…
Reference in New Issue