Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions src/components/Generator/MarkdownPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import rehypeRaw from 'rehype-raw'; // Add this
Expand All @@ -9,19 +9,14 @@ import { Copy, Check, FileCode, } from 'lucide-react';
export const MarkdownPreview = ({ content }: { content: string }) => {
const [view, setView] = useState<'code' | 'preview'>('preview');
const [copied, setCopied] = useState(false);
const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

const handleCopy = async () => {
await navigator.clipboard.writeText(content);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};

if (!content || !mounted) return null;
if (!content) return null;

return (
<div className="mt-12 w-full max-w-4xl mx-auto border border-zinc-800 rounded-xl bg-zinc-950 overflow-hidden shadow-2xl">
Expand Down
Loading