diff --git a/src/app/docs/codes.ts b/src/app/docs/codes.ts
new file mode 100644
index 0000000..1a8388a
--- /dev/null
+++ b/src/app/docs/codes.ts
@@ -0,0 +1,87 @@
+export const basicApiFetchCode = {
+ js: `const res = await fetch("https://mock-data-generator-jet.vercel.app/api/generator", {
+ method: "POST",
+ body: JSON.stringify({
+ count: 10,
+ fields: ["firstName", "lastName"],
+ })
+});
+
+const data = await res.json();
+console.log(data.value);`,
+
+ py: `import requests
+
+response = requests.post("https://mock-data-generator-jet.vercel.app/api/generator", json={
+ "count": 10,
+ "fields": ["firstName", "lastName"],
+})
+
+data = response.json()
+print(data["value"])`,
+
+ res: `[
+ { firstName: 'Estelle', lastName: 'Turcotte' },
+ { firstName: 'Shaun', lastName: 'Wilkinson' },
+ { firstName: 'Archie', lastName: 'Russel' },
+ { firstName: 'Ruben', lastName: 'Emard' },
+ { firstName: 'Barbara', lastName: 'Hahn' },
+ { firstName: 'Nikki', lastName: 'Okuneva' },
+ { firstName: 'Johnnie', lastName: 'Howe' },
+ { firstName: 'Molly', lastName: 'Runolfsson' },
+ { firstName: 'Sherman', lastName: 'Schowalter' },
+ { firstName: 'Earl', lastName: 'Klein' }
+]`,
+};
+
+export const seedApiFetchCode = {
+ js: `const res = await fetch("https://mock-data-generator-jet.vercel.app/api/generator", {
+ method: "POST",
+ body: JSON.stringify({
+ count: 5,
+ fields: ["avatar", "email", "password"],
+ seed: 123,
+ })
+});
+
+const data = await res.json();
+console.log(data.value);`,
+ py: `import requests
+
+response = requests.post("https://mock-data-generator-jet.vercel.app/api/generator", json={
+ "count": 5,
+ "fields": ["avatar", "email", "password"],
+ "seed": 123,
+})
+
+data = response.json()
+print(data["value"])`,
+
+ res: `[
+ {
+ avatar: 'https://avatars.githubusercontent.com/u/28613933',
+ email: 'Chris84@gmail.com',
+ password: 'aqi83WueYU0cbUE'
+ },
+ {
+ avatar: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/male/512/71.jpg',
+ email: 'Gabriel.Murray@hotmail.com',
+ password: 'xpBFcBiYbF7AQ_q'
+ },
+ {
+ avatar: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/male/512/68.jpg',
+ email: 'Jeannie_Kuvalis11@hotmail.com',
+ password: 'UrEB1oAUWRw4Rv9'
+ },
+ {
+ avatar: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/34.jpg',
+ email: 'Jeffrey.Moore@hotmail.com',
+ password: 'VmFf0ZsI4KUyWLh'
+ },
+ {
+ avatar: 'https://avatars.githubusercontent.com/u/43857224',
+ email: 'Jasmine_Langosh@hotmail.com',
+ password: 'gdp0kucJJiVXnAy'
+ }
+]`
+}
diff --git a/src/app/docs/page.tsx b/src/app/docs/page.tsx
index 32a30e9..fa7372b 100644
--- a/src/app/docs/page.tsx
+++ b/src/app/docs/page.tsx
@@ -1,68 +1,133 @@
-import { CodeBlock, CodeGroup } from "@prose-ui/next";
+import { cn } from "@/utilities";
+import { CodeGroup, Card, CodeBlock, Callout } from "@prose-ui/next";
+import { basicApiFetchCode, seedApiFetchCode } from "./codes";
import * as Prism from "prismjs";
+import "prismjs/components/prism-python";
-export default function DocsPage() {
- const code = `const x = 'Hello world';
-console.log(x);
-
-const y = 'Hello world';
-console.log(y);
-
-const z = 'Hello world';
-console.log(z);`;
- const highlightedCode = Prism.highlight(code, Prism.languages.javascript, "javascript");
- const highlightedCodeWithLines = `${highlightedCode.split('\n').reduce((acc, line) => {
- return acc + `${line}`;
- }, '')}`;
+const highlightCode = (code: string, language: string) => {
+ return `
${Prism.highlight(code, Prism.languages[language], language).split("\n").reduce((acc, el) => {
+ return acc + `${el}`;
+ }, "")}`;
+};
- const secondCode = `typescript
-const x = 'Hello world';
-console.log(x);
+export default function DocsPage() {
+ return (
+ ${secondHighlightedCode.split('\n').reduce((acc, line) => {
- return acc + `${line}`;
- }, '')}`;
+ | Column name | +Column value | +
|---|---|
| "firstName" | +First name of user like "John" | +
| "lastName" | +Last name of user like "Doe" | +
| "fullName" | +Full name of user like "John Doe" | +
| "email" | +Email of user like "john.doe@example.com" | +
| "username" | +Username of user like "john_doe" | +
| "password" | +Password of user like "password123" | +
| "avatar" | +Avatar of user like "https://example.com/avatar.png" | +
| "phrase" | +Phrase of user with computer science terms | +
| "anytime" | +Random date and time | +