Skip to content

Commit 32d5c1f

Browse files
committed
Updated type for new code method
1 parent 7ac0b6a commit 32d5c1f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/components/CodePreview.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import CopyToClipboard from "./CopyToClipboard";
44

55
type Props = {
66
language: string;
7-
children: string[];
7+
code: string[];
88
};
99

10-
const CodePreview = ({ language = "markdown", children }: Props) => {
11-
const codeString = children.join("\n");
10+
const CodePreview = ({ language = "markdown", code }: Props) => {
11+
const codeString = code.join("\n");
1212

1313
return (
1414
<div className="code-preview">

src/components/SnippetModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const SnippetModal: React.FC<Props> = ({
2929
<CloseIcon />
3030
</Button>
3131
</div>
32-
<CodePreview language={slugify(language)}>{snippet.code}</CodePreview>
32+
<CodePreview language={slugify(language)} code={snippet.code} />
3333
<p>
3434
<b>Description: </b>
3535
{snippet.description}

src/types/index.ts

+1-1
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)