From bdaeed2736f74aaedee000f949d04feebbce8dbf Mon Sep 17 00:00:00 2001 From: NikolaBorislavovHristov Date: Fri, 19 Apr 2019 12:51:09 +0300 Subject: [PATCH] strict Popup proptypes defined --- src/common/Popup/Label.js | 13 +++++++++++-- src/common/Popup/Menu.js | 8 ++++++++ src/common/Popup/Popup.js | 6 +++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/common/Popup/Label.js b/src/common/Popup/Label.js index f37923013..5fce89cc0 100644 --- a/src/common/Popup/Label.js +++ b/src/common/Popup/Label.js @@ -1,9 +1,18 @@ const React = require('react'); +const PropTypes = require('prop-types'); -const Label = React.forwardRef(({ children, ...props }, ref) => { - return React.cloneElement(React.Children.only(children), { ...props, ref }); +const Label = React.forwardRef(({ children, onClick }, ref) => { + return React.cloneElement(React.Children.only(children), { ref, onClick }); }); Label.displayName = 'Popup.Label'; +Label.propTypes = { + onClick: PropTypes.func, + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node + ]) +}; + module.exports = Label; diff --git a/src/common/Popup/Menu.js b/src/common/Popup/Menu.js index e791c8e88..96fefccb6 100644 --- a/src/common/Popup/Menu.js +++ b/src/common/Popup/Menu.js @@ -1,4 +1,5 @@ const React = require('react'); +const PropTypes = require('prop-types'); const Menu = React.forwardRef(({ children }, ref) => (
@@ -8,4 +9,11 @@ const Menu = React.forwardRef(({ children }, ref) => ( Menu.displayName = 'Popup.Menu'; +Menu.propTypes = { + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node + ]) +}; + module.exports = Menu; diff --git a/src/common/Popup/Popup.js b/src/common/Popup/Popup.js index ff7eda0ab..2ef6ffcc4 100644 --- a/src/common/Popup/Popup.js +++ b/src/common/Popup/Popup.js @@ -290,7 +290,11 @@ Popup.Menu = Menu; Popup.propTypes = { modalContainerClassName: PropTypes.string, onOpen: PropTypes.func, - onClose: PropTypes.func + onClose: PropTypes.func, + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node + ]) }; module.exports = Popup;