diff --git a/README.md b/README.md index 161ada65..d5843b62 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@

-This is a static [Next.js](https://nextjs.org/) site providing a searchable library of all the algorithms in [The Algorithms](https://github.com/TheAlgorithms). All the data about the algorithms gets scraped directly from the git repositories. +This is a static [Next.js](https://nextjs.org/) site providing a searchable library of all the algorithms in [The Algorithms](https://github.com/TheAlgorithms). All the data about the algorithms gets scraped directly from the git repositories. Unlock the world of algorithms with a single click and explore the magic of code in action. ## Translating the website diff --git a/components/codePreview/index.tsx b/components/codePreview/index.tsx index 962d9d18..8c16a207 100644 --- a/components/codePreview/index.tsx +++ b/components/codePreview/index.tsx @@ -44,6 +44,16 @@ export default function CodePreview({ algorithm }: { algorithm: Algorithm }) { const theme = useTheme(); const fabRef = useRef(); const [mobileMoreMenuOpen, setMobileMoreMenuOpen] = useState(false); + const copyCode = () => + { + var str = document.querySelector(".style_pre__k555n").textContent; + const el = document.createElement('textarea'); + el.value = str; + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + }; return (
@@ -116,7 +126,7 @@ export default function CodePreview({ algorithm }: { algorithm: Algorithm }) { href={`/playground?algorithm=${algorithm.slug}&language=${selectedLanguague}`} passHref > -
)} diff --git a/styles/globals.css b/styles/globals.css index 5e76ecbc..13cc03fe 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -79,6 +79,7 @@ body { } .dark .section a { + margin-right: 6px; color: #00bcb4; }