Skip to content

Commit 148a975

Browse files
Fix the frontend to support the change from of code from string[] to string
1 parent 4bc52a6 commit 148a975

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/CodePreview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useEffect, useState } from "react";
55

66
type Props = {
77
language: string;
8-
code: string[];
8+
code: string;
99
};
1010

1111
const CodePreview = ({ language = "markdown", code }: Props) => {
@@ -29,14 +29,14 @@ const CodePreview = ({ language = "markdown", code }: Props) => {
2929

3030
return (
3131
<div className="code-preview">
32-
<CopyToClipboard text={code.join("\n")} className="modal__copy" />
32+
<CopyToClipboard text={code} className="modal__copy" />
3333
<SyntaxHighlighter
3434
language={language}
3535
style={theme === "dark" ? oneDark : oneLight}
3636
wrapLines={true}
3737
customStyle={{ margin: "0", maxHeight: "20rem" }}
3838
>
39-
{code.join("\n")}
39+
{code}
4040
</SyntaxHighlighter>
4141
</div>
4242
);

src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type CategoryType = {
1111
export type SnippetType = {
1212
title: string;
1313
description: string;
14-
code: string[];
14+
code: string;
1515
tags: string[];
1616
author: string;
1717
};

0 commit comments

Comments
 (0)