From 8b5ecb3f1839808d5e88f635d286fcfdfffd4f86 Mon Sep 17 00:00:00 2001 From: Haishan Date: Sun, 1 Dec 2019 22:41:59 +0800 Subject: feat: support close all connections for https://github.com/haishanh/yacd/issues/338 --- src/components/Button.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/components/Button.js') diff --git a/src/components/Button.js b/src/components/Button.js index d7928c7..f56049e 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -1,20 +1,29 @@ import React from 'react'; -import PropTypes from 'prop-types'; import s0 from 'c/Button.module.css'; const noop = () => {}; -const Button = React.memo(function Button({ label, onClick = noop }) { +const { memo, forwardRef } = React; + +function Button({ children, label, onClick = noop }, ref) { + return ( + + ); +} + +function WithIcon({ text, icon, onClick = noop }, ref) { return ( - ); -}); +} -Button.propTypes = { - label: PropTypes.string.isRequired, - onClick: PropTypes.func -}; +export const ButtonWithIcon = memo(forwardRef(WithIcon)); -export default Button; +export default memo(forwardRef(Button)); -- cgit v1.3.1