Skip to content

Commit 54f8a84

Browse files
committed
better card spacing and removal of shenanigans
1 parent 5a3dcec commit 54f8a84

File tree

1 file changed

+56
-64
lines changed

1 file changed

+56
-64
lines changed

apps/framework-docs-v2/src/components/mdx/template-card.tsx

Lines changed: 56 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -92,79 +92,71 @@ export function TemplateCard({ item, className }: TemplateCardProps) {
9292
className,
9393
)}
9494
>
95-
<CardHeader>
96-
<div className="flex items-start justify-between gap-2">
97-
<div className="flex-1 min-w-0">
98-
<div className="flex items-center gap-1 mb-2">
99-
{(() => {
100-
const labels: string[] = [];
101-
if (language) {
102-
labels.push(
103-
language === "typescript" ? "TypeScript" : "Python",
104-
);
105-
}
106-
if (isTemplate && template) {
107-
labels.push(categoryLabels[template.category]);
108-
}
109-
if (!isTemplate) {
110-
labels.push("Demo App");
111-
}
112-
return (
113-
<span className="text-xs text-muted-foreground">
114-
{labels.join(" • ")}
115-
</span>
116-
);
117-
})()}
118-
</div>
119-
<h3 className="text-xl text-foreground mb-1">
120-
{isTemplate ? formatTemplateName(name) : name}
121-
</h3>
122-
{allChips.length > 0 && (
123-
<div className="flex flex-wrap gap-1.5 justify-start w-full mt-2">
124-
{visibleChips.map((chip) => (
125-
<Badge
126-
key={`${chip.type}-${chip.value}`}
127-
variant={
128-
chip.type === "framework" ? "secondary" : "outline"
129-
}
130-
className="text-xs"
131-
>
132-
{chip.value}
133-
</Badge>
134-
))}
135-
{!chipsExpanded && hiddenCount > 0 && (
136-
<Badge
137-
variant="outline"
138-
className="text-xs cursor-pointer hover:bg-accent"
139-
onClick={() => setChipsExpanded(true)}
140-
>
141-
{hiddenCount} more
142-
</Badge>
143-
)}
144-
{chipsExpanded && (
145-
<Badge
146-
variant="outline"
147-
className="text-xs cursor-pointer hover:bg-accent"
148-
onClick={() => setChipsExpanded(false)}
149-
>
150-
Show less
151-
</Badge>
152-
)}
153-
</div>
95+
<CardHeader className="gap-2">
96+
<div className="flex items-center gap-1">
97+
{(() => {
98+
const labels: string[] = [];
99+
if (language) {
100+
labels.push(language === "typescript" ? "TypeScript" : "Python");
101+
}
102+
if (isTemplate && template) {
103+
labels.push(categoryLabels[template.category]);
104+
}
105+
if (!isTemplate) {
106+
labels.push("Demo App");
107+
}
108+
return (
109+
<span className="text-xs text-muted-foreground">
110+
{labels.join(" • ")}
111+
</span>
112+
);
113+
})()}
114+
</div>
115+
<h3 className="text-xl text-foreground ">
116+
{isTemplate ? formatTemplateName(name) : name}
117+
</h3>
118+
{allChips.length > 0 && (
119+
<div className="flex flex-wrap gap-1.5 justify-start w-full">
120+
{visibleChips.map((chip) => (
121+
<Badge
122+
key={`${chip.type}-${chip.value}`}
123+
variant={chip.type === "framework" ? "secondary" : "outline"}
124+
className="text-xs"
125+
>
126+
{chip.value}
127+
</Badge>
128+
))}
129+
{!chipsExpanded && hiddenCount > 0 && (
130+
<Badge
131+
variant="outline"
132+
className="text-xs cursor-pointer hover:bg-accent"
133+
onClick={() => setChipsExpanded(true)}
134+
>
135+
{hiddenCount} more
136+
</Badge>
137+
)}
138+
{chipsExpanded && (
139+
<Badge
140+
variant="outline"
141+
className="text-xs cursor-pointer hover:bg-accent"
142+
onClick={() => setChipsExpanded(false)}
143+
>
144+
Show less
145+
</Badge>
154146
)}
155147
</div>
156-
</div>
148+
)}
157149
</CardHeader>
158-
<CardContent className="flex-1 flex flex-col">
159-
<CardDescription className="mb-4 flex-1">{description}</CardDescription>
150+
<CardContent className="flex-1 flex flex-col gap-5">
151+
<CardDescription className="flex-1">{description}</CardDescription>
160152
{isTemplate && template && (
161153
<div className="w-full min-w-0">
162154
<ShellSnippet code={template.initCommand} />
163155
</div>
164156
)}
165157
</CardContent>
166-
<CardFooter className="flex flex-col gap-2 pt-4 w-full">
167-
<div className="flex w-full items-center justify-start gap-2 mt-auto pt-2">
158+
<CardFooter className="flex flex-col gap-2 w-full">
159+
<div className="flex w-full items-center justify-start gap-2 mt-auto">
168160
<Button variant="default" asChild>
169161
<Link
170162
href={`https://moose.dev/deploy?template=${isTemplate ? template!.slug : app!.slug}`}

0 commit comments

Comments
 (0)