diff options
author | 2021-09-06 01:31:10 -0700 | |
---|---|---|
committer | 2021-09-06 01:31:10 -0700 | |
commit | 9f06fb014bd3acd729325e681573d04089346561 (patch) | |
tree | 64ced5fe8080ef584a5ea1edfca598b7ff67e42e /docs/src/components/Examples/Codebar.tsx | |
parent | b4d1c9bc64f14971339a691f5d860e5a952f6e8b (diff) | |
download | astro-9f06fb014bd3acd729325e681573d04089346561.tar.gz astro-9f06fb014bd3acd729325e681573d04089346561.tar.zst astro-9f06fb014bd3acd729325e681573d04089346561.zip |
cleanup docs changes
Diffstat (limited to 'docs/src/components/Examples/Codebar.tsx')
-rw-r--r-- | docs/src/components/Examples/Codebar.tsx | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/docs/src/components/Examples/Codebar.tsx b/docs/src/components/Examples/Codebar.tsx deleted file mode 100644 index a1f1117b0..000000000 --- a/docs/src/components/Examples/Codebar.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import type { FunctionalComponent } from 'preact'; -import { h, Fragment } from 'preact'; -import { useState, useRef, useEffect } from 'preact/hooks'; - -export type CodeBar = { - content: string; - command: string; -}; - -const CodeBar: FunctionalComponent = ({ content, command }) => { - const [clicked, setClicked] = useState(false); - const [titleTxt, setTitleTxt] = useState('Copy Command to Clipboard'); - useEffect(() => { - const timeout = setTimeout(() => { - setClicked(false); - setTitleTxt('Copy Command to Clipboard'); - }, 1500); - return () => clearTimeout(timeout); - }, [clicked]); - /** - * - */ - function onClick(e) { - setClicked(true); - setTitleTxt('Copied to Clipboard!'); - const titleAttr = e.target; - const clipboard = navigator.clipboard; - return clipboard.writeText(`${command}`); - } - - return ( - <div style="cursor:pointer;" onClick={onClick} title={titleTxt}> - <code>{content}</code> - </div> - ); -}; - -export default CodeBar; |