umami/components/common/FilterButtons.js

26 lines
622 B
JavaScript
Raw Normal View History

2020-10-13 01:31:51 +02:00
import React from 'react';
import PropTypes from 'prop-types';
2020-10-13 01:31:51 +02:00
import ButtonLayout from 'components/layout/ButtonLayout';
import ButtonGroup from './ButtonGroup';
function FilterButtons({ buttons, selected, onClick }) {
2020-10-13 01:31:51 +02:00
return (
<ButtonLayout>
<ButtonGroup size="xsmall" items={buttons} selectedItem={selected} onClick={onClick} />
</ButtonLayout>
);
}
FilterButtons.propTypes = {
buttons: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.node,
value: PropTypes.any.isRequired,
}),
),
selected: PropTypes.any,
onClick: PropTypes.func,
};
export default FilterButtons;