mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
feat: add timer to restore copyToClipboard button state
This commit is contained in:
parent
25d7b5e8d4
commit
6e71a04e8c
|
@ -6,7 +6,7 @@ import {
|
|||
faCheck,
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import React, { ReactNode, useState } from 'react';
|
||||
import React, { ReactNode, useEffect, useState } from 'react';
|
||||
import { ExpandCollapseAll } from '.';
|
||||
import { useExpandCollapseAllContext } from './expandCollapseContext';
|
||||
import { StylingFunction } from 'react-base16-styling';
|
||||
|
@ -131,6 +131,12 @@ function CopyToClipboardButton({copyToClipboardIcon, copiedToClipboardIcon, valu
|
|||
setIsCopied(true)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if(isCopied){
|
||||
setTimeout(() => setIsCopied(false), 6000)
|
||||
}
|
||||
}, [isCopied])
|
||||
|
||||
if(isCopied){
|
||||
return (<div role="presentation" onClick={handleOnCopyToClipboard}>
|
||||
{copiedToClipboardIcon || <FontAwesomeIcon icon={faCheck} />}
|
||||
|
|
Loading…
Reference in New Issue
Block a user