refactor: run yarn format

This commit is contained in:
lucataglia 2023-08-23 11:42:39 +02:00
parent 6e71a04e8c
commit 2ccdf15bc9
4 changed files with 26 additions and 14 deletions

View File

@ -190,7 +190,12 @@ const App = () => (
Sort object keys with <code>sortObjectKeys</code> prop.
</p>
<div>
<JSONTree data={data} theme={theme} sortObjectKeys expandCollapseAll={{}}/>
<JSONTree
data={data}
theme={theme}
sortObjectKeys
expandCollapseAll={{}}
/>
</div>
<p>Collapsed root node</p>
<div>

View File

@ -177,7 +177,7 @@ export default function JSONNestedNode(props: Props) {
itemType,
createItemString(data, collectionLimit),
keyPath,
expandedRef.current,
expandedRef.current
);
const stylingArgs = [
keyPath,

View File

@ -123,30 +123,37 @@ function CollapseButton({
return <></>;
}
function CopyToClipboardButton({copyToClipboardIcon, copiedToClipboardIcon, value}:CopyToClipboardButtonProps) {
function CopyToClipboardButton({
copyToClipboardIcon,
copiedToClipboardIcon,
value,
}: CopyToClipboardButtonProps) {
const [isCopied, setIsCopied] = useState(false);
const handleOnCopyToClipboard = async () => {
await navigator.clipboard.writeText(JSON.stringify(value, null, 2));
setIsCopied(true)
}
setIsCopied(true);
};
useEffect(() => {
if(isCopied){
setTimeout(() => setIsCopied(false), 6000)
if (isCopied) {
setTimeout(() => setIsCopied(false), 6000);
}
}, [isCopied])
}, [isCopied]);
if(isCopied){
return (<div role="presentation" onClick={handleOnCopyToClipboard}>
{copiedToClipboardIcon || <FontAwesomeIcon icon={faCheck} />}
</div>);
if (isCopied) {
return (
<div role="presentation" onClick={handleOnCopyToClipboard}>
{copiedToClipboardIcon || <FontAwesomeIcon icon={faCheck} />}
</div>
);
}
return (
<div role="presentation" onClick={handleOnCopyToClipboard}>
{copyToClipboardIcon || <FontAwesomeIcon icon={faCopy} />}
</div>)
</div>
);
}
function DefaultButton({ defaultIcon }: DefaultButtonProps) {

View File

@ -11,7 +11,7 @@ export type GetItemString = (
itemType: React.ReactNode,
itemString: string,
keyPath: KeyPath,
isExpanded: boolean,
isExpanded: boolean
) => React.ReactNode;
export type LabelRenderer = (