From 2ff91389e0ae2e67ce1a2f5d11a941fe8a0e3a93 Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Tue, 16 Feb 2021 12:33:37 +0100 Subject: [PATCH] feature(components): prop-type CopyButton --- components/common/CopyButton.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/components/common/CopyButton.js b/components/common/CopyButton.js index 460c68ac..b300ef31 100644 --- a/components/common/CopyButton.js +++ b/components/common/CopyButton.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import PropTypes from 'prop-types'; import Button from './Button'; import { FormattedMessage } from 'react-intl'; @@ -6,7 +7,7 @@ const defaultText = ( ); -export default function CopyButton({ element, ...props }) { +function CopyButton({ element, ...props }) { const [text, setText] = useState(defaultText); function handleClick() { @@ -24,3 +25,13 @@ export default function CopyButton({ element, ...props }) { ); } + +CopyButton.propTypes = { + element: PropTypes.shape({ + current: PropTypes.shape({ + select: PropTypes.func.isRequired, + }), + }), +}; + +export default CopyButton;