From fa2f77752f37b5b6bcf46d0c9c09dda4711ebe69 Mon Sep 17 00:00:00 2001 From: sagar Date: Wed, 22 Nov 2023 17:28:13 +0545 Subject: [PATCH] feat(docs): create clipboard copy component --- docs/src/components/ChallengeFooter.astro | 45 +----------- docs/src/components/ClipboardCopy.astro | 90 +++++++++++++++++++++++ 2 files changed, 94 insertions(+), 41 deletions(-) create mode 100644 docs/src/components/ClipboardCopy.astro diff --git a/docs/src/components/ChallengeFooter.astro b/docs/src/components/ChallengeFooter.astro index 154b10c..d0a71ae 100644 --- a/docs/src/components/ChallengeFooter.astro +++ b/docs/src/components/ChallengeFooter.astro @@ -1,5 +1,7 @@ --- import VideoButton from './VideoButton.astro' +import ClipboardCopy from './ClipboardCopy.astro' + const {author, challengeNumber, title, blogLink, videoLink, command} = Astro.props.entry.data; @@ -12,13 +14,10 @@ const npxCommand = `npx nx serve ${command}`;
-{command && +{npxCommand && } @@ -54,33 +53,6 @@ const npxCommand = `npx nx serve ${command}`; margin-bottom: 1rem; } - .copy-button { - fill: var(--sl-color-accent-high); - margin-left: 0.5rem; - cursor: pointer; - } - - .copy-container:hover .tooltipText{ - visibility: visible; - } - .copy-container { - position: relative; - } - - .tooltipText { - position: absolute; - visibility: hidden; - left: 0; - width: max-content; - background-color: white; - display: block; - color: black; - padding: 0.125rem 0.25rem; - border-radius: 0.25rem; - top: 130%; - font-size: 0.5rem; - } - .code { background-color: var(--sl-color-bg-inline-code); margin-block: -0.125rem; @@ -89,12 +61,3 @@ const npxCommand = `npx nx serve ${command}`; } - diff --git a/docs/src/components/ClipboardCopy.astro b/docs/src/components/ClipboardCopy.astro new file mode 100644 index 0000000..32ce419 --- /dev/null +++ b/docs/src/components/ClipboardCopy.astro @@ -0,0 +1,90 @@ +--- +const { copyText } = Astro.props; +--- + + + + + Copy + + + + +