ui(admin): add CopyOnClick button to NodeConfigurationContainer
This commit is contained in:
parent
5d1568cf84
commit
e9546c70bd
2 changed files with 23 additions and 9 deletions
|
@ -19,7 +19,7 @@ const Toast = styled.div`
|
|||
}
|
||||
`;
|
||||
|
||||
const CopyOnClick: React.FC<{ text: any }> = ({ text, children }) => {
|
||||
const CopyOnClick: React.FC<{ text: any, hideTextInToast?: boolean }> = ({ text, hideTextInToast, children }) => {
|
||||
const [ copied, setCopied ] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -45,7 +45,11 @@ const CopyOnClick: React.FC<{ text: any }> = ({ text, children }) => {
|
|||
{copied ?
|
||||
<Toast>
|
||||
<div>
|
||||
<p>Copied "{text}" to clipboard.</p>
|
||||
{hideTextInToast ?
|
||||
<p>Copied text to clipboard.</p>
|
||||
:
|
||||
<p>Copied "{text}" to clipboard.</p>
|
||||
}
|
||||
</div>
|
||||
</Toast>
|
||||
:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue