Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com

Add a button to copy the currently viewed article's link #40

Mergedfukomerged 4 commits intomain fromrefs/pull/40/headmerged by fuko View on GitHub

Showing 3 changed files with 80 additions and 13 deletions.

x
0 of 3 viewed, 3 left
77 additions and 10 deletionssrc/components/tutorial/TutorialWindow.tsxModified
View file
@@ -1,6 +1,6 @@
import { Tabs, TabsContent } from "@radix-ui/react-tabs";
import { useNavigate, useRouter, useSearch } from "@tanstack/react-router";
-import { DatabaseZapIcon, XIcon } from "lucide-react";
+import { CheckIcon, DatabaseZapIcon, LinkIcon, XIcon } from "lucide-react";
import { AnimatePresence, motion } from "motion/react";
import {
useCallback,
@@ -9,7 +9,8 @@
useRef,
useState,
} from "react";
-import { steps } from "@/data/tutorial";
+import { toast } from "sonner";
+import { steps as articles } from "@/data/tutorial";
import { useScrollShadow } from "@/hooks/use-scroll-shadow";
import { cn } from "@/lib/utils";
import {
@@ -22,6 +23,65 @@
import { ScrollShadow } from "../ui/scroll-shadow";
import { TutorialTableOfContents } from "./TutorialTableOfContents";
​
+function CopyArticleLinkButton({ activeStep }: { activeStep: string | null }) {
+ const [copied, setCopied] = useState(false);