Skip to content

Commit 341a9a4

Browse files
fix: copy correct code (#85)
1 parent 30411f2 commit 341a9a4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

apps/web/src/app/(main)/onboarding/form/code-example-step.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type CodeExampleStepProps = {
1616
};
1717

1818
export const CodeExampleStep = async ({ formId }: CodeExampleStepProps) => {
19-
const htmlCode = await highlightCode(`<form
19+
const rawHtmlCode = `<form
2020
action="https://formbase.dev/s/${formId ?? 'abcdefghijkl'}" method="POST"
2121
enctype="multipart/form-data"
2222
>
@@ -25,10 +25,9 @@ export const CodeExampleStep = async ({ formId }: CodeExampleStepProps) => {
2525
<textarea name="message"></textarea>
2626
2727
<button type="submit">Submit</button>
28-
</form>`);
28+
</form>`;
2929

30-
const reactCode =
31-
await highlightCode(`export default function FormbaseForm() {
30+
const rawReactCode = `export default function FormbaseForm() {
3231
return (
3332
<form
3433
action="https://formbase.dev/s/${formId ?? 'abcdefghijkl'}"
@@ -42,7 +41,10 @@ export const CodeExampleStep = async ({ formId }: CodeExampleStepProps) => {
4241
<button type="submit">Submit</button>
4342
</form>
4443
);
45-
}`);
44+
}`;
45+
46+
const htmlCode = await highlightCode(rawHtmlCode);
47+
const reactCode = await highlightCode(rawReactCode);
4648

4749
return (
4850
<div
@@ -68,7 +70,7 @@ export const CodeExampleStep = async ({ formId }: CodeExampleStepProps) => {
6870
}}
6971
/>
7072
<CopyButton
71-
text={htmlCode}
73+
text={rawHtmlCode}
7274
className="absolute top-4 text-white right-4"
7375
/>
7476
</TabsContent>
@@ -80,7 +82,7 @@ export const CodeExampleStep = async ({ formId }: CodeExampleStepProps) => {
8082
}}
8183
/>
8284
<CopyButton
83-
text={reactCode}
85+
text={rawReactCode}
8486
className="absolute top-4 text-white right-4"
8587
/>
8688
</TabsContent>

0 commit comments

Comments
 (0)