The write-to-clipboard + button-text-reset pattern is implemented separately in three places:
src/components/TypographyMapper.astro (copyTextToClipboard)
src/components/DarkModeGenerator.astro
src/components/PreviewCopy.astro (approximate)
Each implementation does the same thing: navigator.clipboard.writeText → set "Copied" → setTimeout → reset to "Copy".
Extracting this to a shared ES module (e.g. src/lib/clipboard.ts) would mean any future change to copy behaviour (delay, error feedback, aria-pressed state) only needs to happen once.
The current blocker is that these live inside <script> blocks in Astro components. A shared module import would resolve this cleanly.
The write-to-clipboard + button-text-reset pattern is implemented separately in three places:
src/components/TypographyMapper.astro(copyTextToClipboard)src/components/DarkModeGenerator.astrosrc/components/PreviewCopy.astro(approximate)Each implementation does the same thing:
navigator.clipboard.writeText→ set "Copied" →setTimeout→ reset to "Copy".Extracting this to a shared ES module (e.g.
src/lib/clipboard.ts) would mean any future change to copy behaviour (delay, error feedback,aria-pressedstate) only needs to happen once.The current blocker is that these live inside
<script>blocks in Astro components. A shared module import would resolve this cleanly.