@massds/mayflower-react
Version:
React versions of Mayflower design system UI components
39 lines • 1.34 kB
JavaScript
/**
* ButtonTag module.
* @module @massds/mayflower-react/ButtonTag
* @requires module:@massds/mayflower-assets/scss/01-atoms/button-tag
*/
import React from "react";
import PropTypes from "prop-types";
const ButtonTag = _ref => {
let type = _ref.type,
value = _ref.value,
text = _ref.text,
description = _ref.description,
handleClick = _ref.handleClick;
return /*#__PURE__*/React.createElement("button", {
type: "button",
className: "ma__button-tag js-results-heading-tag",
"data-ma-filter-type": type,
"data-ma-filter-value": value,
onClick: handleClick
}, text, !!description && /*#__PURE__*/React.createElement("span", {
className: "visually-hidden"
}, description), /*#__PURE__*/React.createElement("span", {
className: "ma__button-tag__icon",
"aria-hidden": "true"
}, "+"));
};
ButtonTag.propTypes = process.env.NODE_ENV !== "production" ? {
/** The label text of the sort button */
type: PropTypes.string.isRequired,
/** The label text of the sort button */
value: PropTypes.string.isRequired,
/** The content of the button */
text: PropTypes.node.isRequired,
/** The visually hidden description of the button */
description: PropTypes.node,
/** An array of sort button objects */
handleClick: PropTypes.func.isRequired
} : {};
export default ButtonTag;