From cf87ec1ea524ef69c5ec238edae7aeee52030f08 Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Tue, 16 Feb 2021 13:27:03 +0100 Subject: [PATCH] feature(components): prop-type MenuButton --- components/common/MenuButton.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/components/common/MenuButton.js b/components/common/MenuButton.js index c3e2b0ec..40df2e0c 100644 --- a/components/common/MenuButton.js +++ b/components/common/MenuButton.js @@ -1,11 +1,12 @@ import React, { useState, useRef } from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import Menu from 'components/common/Menu'; import Button from 'components/common/Button'; import useDocumentClick from 'hooks/useDocumentClick'; import styles from './MenuButton.module.css'; -export default function MenuButton({ +function MenuButton({ icon, value, options, @@ -58,3 +59,25 @@ export default function MenuButton({ ); } + +MenuButton.propTypes = { + icon: PropTypes.node, + value: PropTypes.any, + options: PropTypes.arrayOf( + PropTypes.shape({ + label: PropTypes.node, + value: PropTypes.any, + className: PropTypes.string, + render: PropTypes.func, + divider: PropTypes.bool, + }), + ), + buttonClassName: PropTypes.string, + menuClassName: PropTypes.string, + menuPosition: PropTypes.oneOf(['top', 'bottom']), + menuAlign: PropTypes.oneOf(['left', 'right']), + onSelect: PropTypes.func, + renderValue: PropTypes.func, +}; + +export default MenuButton;