From 3f6d32498043c0998801017914e2a64f7bc22e34 Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Sun, 13 Apr 2025 16:05:56 +0200 Subject: [PATCH] chore: Rename CSRFence to CSRSnippet and add toast in Fence --- .../syntax/{CSRFence.tsx => CSRSnippet.tsx} | 5 +- app/components/syntax/Fence.tsx | 6 +- app/components/syntax/Snippet.tsx | 58 ++++++++++++++++++ app/data/docs/react/usereducer/page.md | 13 +--- .../docs/react/usereducer/reducer-example.jsx | 10 +++ app/fastify-entry.ts | 4 -- app/layouts/LayoutDefault.tsx | 2 + app/markdoc/tags.tsx | 54 ++++++++++++++++ app/pages/docs/+data.ts | 8 ++- app/services/DocsService.ts | 59 ++++++++++++------ app/services/SnippetsService.ts | 61 +++++++++++++++++++ 11 files changed, 240 insertions(+), 40 deletions(-) rename app/components/syntax/{CSRFence.tsx => CSRSnippet.tsx} (96%) create mode 100644 app/components/syntax/Snippet.tsx create mode 100644 app/data/docs/react/usereducer/reducer-example.jsx create mode 100644 app/services/SnippetsService.ts diff --git a/app/components/syntax/CSRFence.tsx b/app/components/syntax/CSRSnippet.tsx similarity index 96% rename from app/components/syntax/CSRFence.tsx rename to app/components/syntax/CSRSnippet.tsx index 2b3bc93..3d5513e 100644 --- a/app/components/syntax/CSRFence.tsx +++ b/app/components/syntax/CSRSnippet.tsx @@ -3,9 +3,9 @@ import { prismThemes } from "@/data/themes/prism"; import { Highlight } from "prism-react-renderer"; import { useTheme } from "@/hooks/useTheme"; import { Fragment, useMemo } from "react"; +import { toast } from "react-toastify"; import { Button } from "./Button"; import Prism from "prismjs"; -import { toast } from "react-toastify"; export default function CSRFence({ children, language }: { children: string; language: string }) { const { theme } = useTheme(); @@ -16,7 +16,7 @@ export default function CSRFence({ children, language }: { children: string; lan const copyToClipboard = () => { navigator.clipboard.writeText(children.trimEnd()); - toast.success("Code copied to clipboard!"); + toast.success("Code copié dans le presse-papier"); }; return ( @@ -39,6 +39,7 @@ export default function CSRFence({ children, language }: { children: string; lan )} +