2019-09-17 18:48:37 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-08-26 15:28:53 +00:00
|
|
|
import { withTranslation } from 'react-i18next';
|
|
|
|
|
2019-09-17 18:48:37 +00:00
|
|
|
|
2020-04-29 22:34:37 +00:00
|
|
|
import AddIcon from '../images/plus.svg';
|
|
|
|
import RemoveIcon from '../images/minus.svg';
|
2019-09-17 18:48:37 +00:00
|
|
|
|
2020-08-26 15:28:53 +00:00
|
|
|
const AddRemoveButton = ({ type, onClick, t }) => {
|
|
|
|
const alt = type === 'add' ? t('AddRemoveButton.AltAddARIA') : t('AddRemoveButton.AltRemoveARIA');
|
2020-04-29 22:34:37 +00:00
|
|
|
const Icon = type === 'add' ? AddIcon : RemoveIcon;
|
2019-09-17 18:48:37 +00:00
|
|
|
|
|
|
|
return (
|
2020-04-29 22:34:37 +00:00
|
|
|
<button
|
|
|
|
className="overlay__close-button"
|
|
|
|
onClick={onClick}
|
|
|
|
aria-label={alt}
|
|
|
|
>
|
|
|
|
<Icon focusable="false" aria-hidden="true" />
|
2019-09-17 18:48:37 +00:00
|
|
|
</button>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
AddRemoveButton.propTypes = {
|
|
|
|
type: PropTypes.oneOf(['add', 'remove']).isRequired,
|
|
|
|
onClick: PropTypes.func.isRequired,
|
2020-08-26 15:28:53 +00:00
|
|
|
t: PropTypes.func.isRequired
|
2019-09-17 18:48:37 +00:00
|
|
|
};
|
|
|
|
|
2020-08-26 15:28:53 +00:00
|
|
|
export default withTranslation()(AddRemoveButton);
|