Skip to content

Commit ebcd52f

Browse files
authored
Merge pull request #26 from BeyteFlow/copilot/sub-pr-24-again
[WIP] Add preview option to enhance user experience
2 parents 8900d55 + f949eed commit ebcd52f

2 files changed

Lines changed: 25 additions & 20 deletions

File tree

package-lock.json

Lines changed: 23 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Generator/MarkdownPreview.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import React, { useState, useEffect } from 'react';
3+
import React, { useState } from 'react';
44
import ReactMarkdown from 'react-markdown';
55
import remarkGfm from 'remark-gfm';
66
import rehypeRaw from 'rehype-raw'; // Add this
@@ -9,19 +9,14 @@ import { Copy, Check, FileCode, } from 'lucide-react';
99
export const MarkdownPreview = ({ content }: { content: string }) => {
1010
const [view, setView] = useState<'code' | 'preview'>('preview');
1111
const [copied, setCopied] = useState(false);
12-
const [mounted, setMounted] = useState(false);
13-
14-
useEffect(() => {
15-
setMounted(true);
16-
}, []);
1712

1813
const handleCopy = async () => {
1914
await navigator.clipboard.writeText(content);
2015
setCopied(true);
2116
setTimeout(() => setCopied(false), 2000);
2217
};
2318

24-
if (!content || !mounted) return null;
19+
if (!content) return null;
2520

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

0 commit comments

Comments
 (0)