feature(components): prop-type ButtonGroup component

This commit is contained in:
Alexander Klein 2021-02-16 11:51:17 +01:00
parent 3d910c2367
commit 244fd6e494

View File

@ -1,16 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Button from './Button';
import styles from './ButtonGroup.module.css';
export default function ButtonGroup({
items = [],
selectedItem,
className,
size,
icon,
onClick = () => {},
}) {
function ButtonGroup({ items = [], selectedItem, className, size, icon, onClick = () => {} }) {
return (
<div className={classNames(styles.group, className)}>
{items.map(item => {
@ -30,3 +24,19 @@ export default function ButtonGroup({
</div>
);
}
ButtonGroup.propTypes = {
items: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.node,
value: PropTypes.any.isRequired,
}),
),
selectedItem: PropTypes.any,
className: PropTypes.string,
size: PropTypes.oneOf(['xlarge', 'large', 'medium', 'small', 'xsmall']),
icon: PropTypes.node,
onClick: PropTypes.func,
};
export default ButtonGroup;