Buckets:
| import { createSignal } from "solid-js" | |
| import { IconClipboard, IconCheckCircle } from "../icons" | |
| import { useShareMessages } from "./common" | |
| import styles from "./copy-button.module.css" | |
| interface CopyButtonProps { | |
| text: string | |
| } | |
| export function CopyButton(props: CopyButtonProps) { | |
| const [copied, setCopied] = createSignal(false) | |
| const messages = useShareMessages() | |
| function handleCopyClick() { | |
| if (props.text) { | |
| navigator.clipboard.writeText(props.text).catch((err) => console.error("Copy failed", err)) | |
| setCopied(true) | |
| setTimeout(() => setCopied(false), 2000) | |
| } | |
| } | |
| return ( | |
| <div data-component="copy-button" class={styles.root}> | |
| <button | |
| type="button" | |
| onClick={handleCopyClick} | |
| data-copied={copied() ? true : undefined} | |
| aria-label={copied() ? messages.copied : messages.copy} | |
| title={copied() ? messages.copied : messages.copy} | |
| > | |
| {copied() ? <IconCheckCircle width={16} height={16} /> : <IconClipboard width={16} height={16} />} | |
| </button> | |
| </div> | |
| ) | |
| } | |
Xet Storage Details
- Size:
- 1.07 kB
- Xet hash:
- 95185d164facca1586e2ca8b4cd065af20f6cdfd75d705c73ae96c812180d8ba
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.