Skip to content

Commit 24c8372

Browse files
committed
wip
1 parent 55d9eba commit 24c8372

12 files changed

Lines changed: 124 additions & 54 deletions

File tree

app/api/generateCode/route.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@ You are an expert frontend React engineer who is also a great UI/UX designer. Fo
2121
2222
There are some prestyled components available for use. Please use your best judgement to use any of these components if the app calls for one.
2323
24-
Here are the components that are available, along with how to use them:
24+
Here are the components that are available, along with how to import them, and how to use them:
2525
2626
${shadcnDocs
27-
.map(
28-
(component) => `
27+
.map((component) =>
28+
`
2929
<component>
3030
<name>
3131
${component.name}
3232
</name>
33-
<usage>
34-
${component.usage}
33+
<import-instructions>
34+
${component.importDocs}
35+
</import-instructions>
36+
<usage-instructions>
37+
${component.usageDocs}
38+
</usage-instructions>
3539
</component>
36-
`,
40+
`.trim(),
3741
)
3842
.join("\n")}
3943

utils/shadcn-docs/avatar.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
export const name = "Avatar";
22

3-
export const usage = `
3+
export const importDocs = `
44
import { Avatar, AvatarFallback, AvatarImage } from "/components/ui/avatar";
5-
6-
export function Demo() {
7-
return (
8-
<Avatar>
9-
<AvatarImage src="https://github.com/nutlope.png" />
10-
<AvatarFallback>CN</AvatarFallback>
11-
</Avatar>
12-
)
13-
}
5+
`;
6+
7+
export const usageDocs = `
8+
<Avatar>
9+
<AvatarImage src="https://github.com/nutlope.png" />
10+
<AvatarFallback>CN</AvatarFallback>
11+
</Avatar>
1412
`;

utils/shadcn-docs/button.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
export const name = "Button";
22

3-
export const usage = `
3+
export const importDocs = `
44
import { Button } from "/components/ui/button"
5-
6-
export function Demo() {
7-
return (
8-
<div>
9-
<Button>A normal button</Button>
10-
<Button variant='secondary'>Button</Button>
11-
<Button variant='destructive'>Button</Button>
12-
<Button variant='outline'>Button</Button>
13-
<Button variant='ghost'>Button</Button>
14-
<Button variant='link'>Button</Button>
15-
</div>
16-
)
17-
}
5+
`;
6+
7+
export const usageDocs = `
8+
<Button>A normal button</Button>
9+
<Button variant='secondary'>Button</Button>
10+
<Button variant='destructive'>Button</Button>
11+
<Button variant='outline'>Button</Button>
12+
<Button variant='ghost'>Button</Button>
13+
<Button variant='link'>Button</Button>
1814
`;

utils/shadcn-docs/card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const name = "Card";
22

3-
export const usage = `
3+
export const importDocs = `
44
import {
55
Card,
66
CardContent,
@@ -9,7 +9,9 @@ import {
99
CardHeader,
1010
CardTitle,
1111
} from "/components/ui/card"
12+
`;
1213

14+
export const usageDocs = `
1315
<Card>
1416
<CardHeader>
1517
<CardTitle>Card Title</CardTitle>

utils/shadcn-docs/checkbox.tsx

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
11
export const name = "Checkbox";
22

3-
export const usage = `
4-
import {
5-
Card,
6-
CardContent,
7-
CardDescription,
8-
CardFooter,
9-
CardHeader,
10-
CardTitle,
11-
} from "/components/ui/card"
3+
export const importDocs = `
4+
import { Checkbox } from "/components/ui/checkbox"
5+
`;
126

13-
<Card>
14-
<CardHeader>
15-
<CardTitle>Card Title</CardTitle>
16-
<CardDescription>Card Description</CardDescription>
17-
</CardHeader>
18-
<CardContent>
19-
<p>Card Content</p>
20-
</CardContent>
21-
<CardFooter>
22-
<p>Card Footer</p>
23-
</CardFooter>
24-
</Card>
7+
export const usageDocs = `
8+
<Checkbox />
259
`;

utils/shadcn-docs/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
import * as Avatar from "./avatar";
22
import * as Button from "./button";
33
import * as Card from "./card";
4+
import * as Checkbox from "./checkbox";
5+
import * as Input from "./input";
6+
import * as Label from "./label";
7+
import * as RadioGroup from "./radio-group";
8+
import * as Select from "./select";
9+
import * as Textarea from "./textarea";
410

5-
const shadcnDocs = [Avatar, Button, Card];
11+
const shadcnDocs = [
12+
Avatar,
13+
Button,
14+
Card,
15+
Checkbox,
16+
Input,
17+
Label,
18+
RadioGroup,
19+
Select,
20+
Textarea,
21+
];
622

723
export default shadcnDocs;

utils/shadcn-docs/input.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const name = "Input";
2+
3+
export const importDocs = `
4+
import { Input } from "/components/ui/input"
5+
`;
6+
7+
export const usageDocs = `
8+
<Input />
9+
`;

utils/shadcn-docs/label.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const name = "Label";
2+
3+
export const importDocs = `
4+
import { Label } from "/components/ui/label"
5+
`;
6+
7+
export const usageDocs = `
8+
<Label htmlFor="email">Your email address</Label>
9+
`;

utils/shadcn-docs/radio-group.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export const name = "RadioGroup";
2+
3+
export const importDocs = `
4+
import { Label } from "/components/ui/label"
5+
import { RadioGroup, RadioGroupItem } from "/components/ui/radio-group"
6+
`;
7+
8+
export const usageDocs = `
9+
<RadioGroup defaultValue="option-one">
10+
<div className="flex items-center space-x-2">
11+
<RadioGroupItem value="option-one" id="option-one" />
12+
<Label htmlFor="option-one">Option One</Label>
13+
</div>
14+
<div className="flex items-center space-x-2">
15+
<RadioGroupItem value="option-two" id="option-two" />
16+
<Label htmlFor="option-two">Option Two</Label>
17+
</div>
18+
</RadioGroup>
19+
`;

utils/shadcn-docs/select.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const name = "Select";
2+
3+
export const importDocs = `
4+
import {
5+
Select,
6+
SelectContent,
7+
SelectItem,
8+
SelectTrigger,
9+
SelectValue,
10+
} from "@/components/ui/select"
11+
`;
12+
13+
export const usageDocs = `
14+
<Select>
15+
<SelectTrigger className="w-[180px]">
16+
<SelectValue placeholder="Theme" />
17+
</SelectTrigger>
18+
<SelectContent>
19+
<SelectItem value="light">Light</SelectItem>
20+
<SelectItem value="dark">Dark</SelectItem>
21+
<SelectItem value="system">System</SelectItem>
22+
</SelectContent>
23+
</Select>
24+
`;

0 commit comments

Comments
 (0)