create-thexjs-app 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1026 -0
- package/dist/index.js +224 -0
- package/package.json +30 -0
- package/templates/basic/components.json +21 -0
- package/templates/basic/content/blog/hello.md +8 -0
- package/templates/basic/public/favicon.ico +0 -0
- package/templates/basic/src/actions/dashboard/greet.ts +3 -0
- package/templates/basic/src/api/auth/login.ts +30 -0
- package/templates/basic/src/api/auth/logout.ts +12 -0
- package/templates/basic/src/api/placeholder/comments.ts +17 -0
- package/templates/basic/src/api/placeholder/posts.ts +20 -0
- package/templates/basic/src/api/placeholder/todos.ts +21 -0
- package/templates/basic/src/api/placeholder/users.ts +12 -0
- package/templates/basic/src/components/Head.tsx +21 -0
- package/templates/basic/src/components/Image.tsx +27 -0
- package/templates/basic/src/components/Link.tsx +16 -0
- package/templates/basic/src/components/ui/badge.tsx +49 -0
- package/templates/basic/src/components/ui/button.tsx +58 -0
- package/templates/basic/src/components/ui/card.tsx +88 -0
- package/templates/basic/src/components/ui/input.tsx +20 -0
- package/templates/basic/src/layouts/main.tsx +38 -0
- package/templates/basic/src/lib/auth.ts +70 -0
- package/templates/basic/src/lib/migrations/001_create_sessions.sql +9 -0
- package/templates/basic/src/lib/placeholder-data.ts +176 -0
- package/templates/basic/src/lib/utils.ts +6 -0
- package/templates/basic/src/pages/_404.tsx +17 -0
- package/templates/basic/src/pages/about.tsx +22 -0
- package/templates/basic/src/pages/blog.tsx +41 -0
- package/templates/basic/src/pages/dashboard/_middleware.ts +16 -0
- package/templates/basic/src/pages/dashboard/index.tsx +84 -0
- package/templates/basic/src/pages/index.tsx +54 -0
- package/templates/basic/src/pages/login.tsx +85 -0
- package/templates/basic/src/pages/placeholder.tsx +194 -0
- package/templates/basic/src/pages/posts/[id].tsx +17 -0
- package/templates/basic/src/styles/globals.css +90 -0
- package/templates/basic/src/x-routes.ts +29 -0
- package/templates/basic/tsconfig.json +11 -0
- package/templates/basic/x.config.ts +10 -0
- package/templates/blog/components.json +20 -0
- package/templates/blog/content/posts/getting-started.md +38 -0
- package/templates/blog/content/posts/hello-world.md +21 -0
- package/templates/blog/content/posts/tailwind-v4.md +31 -0
- package/templates/blog/public/favicon.ico +0 -0
- package/templates/blog/src/components/ui/avatar.tsx +91 -0
- package/templates/blog/src/components/ui/badge.tsx +49 -0
- package/templates/blog/src/components/ui/button.tsx +58 -0
- package/templates/blog/src/components/ui/card.tsx +88 -0
- package/templates/blog/src/components/ui/input.tsx +20 -0
- package/templates/blog/src/layouts/blog.tsx +46 -0
- package/templates/blog/src/layouts/main.tsx +32 -0
- package/templates/blog/src/lib/utils.ts +5 -0
- package/templates/blog/src/pages/about.tsx +36 -0
- package/templates/blog/src/pages/blog/[slug].tsx +56 -0
- package/templates/blog/src/pages/blog/index.tsx +70 -0
- package/templates/blog/src/pages/index.tsx +70 -0
- package/templates/blog/src/styles/globals.css +90 -0
- package/templates/blog/src/x-routes.ts +20 -0
- package/templates/blog/tsconfig.json +5 -0
- package/templates/blog/x.config.ts +6 -0
- package/templates/landing/components.json +20 -0
- package/templates/landing/public/favicon.ico +0 -0
- package/templates/landing/src/components/code-block.tsx +24 -0
- package/templates/landing/src/components/ui/avatar.tsx +91 -0
- package/templates/landing/src/components/ui/badge.tsx +49 -0
- package/templates/landing/src/components/ui/button.tsx +58 -0
- package/templates/landing/src/components/ui/card.tsx +88 -0
- package/templates/landing/src/components/ui/input.tsx +20 -0
- package/templates/landing/src/layouts/main.tsx +48 -0
- package/templates/landing/src/lib/syntax.tsx +366 -0
- package/templates/landing/src/lib/utils.ts +5 -0
- package/templates/landing/src/pages/contact.tsx +95 -0
- package/templates/landing/src/pages/docs/_layout.tsx +109 -0
- package/templates/landing/src/pages/docs/api-routes.tsx +113 -0
- package/templates/landing/src/pages/docs/build-deploy.tsx +124 -0
- package/templates/landing/src/pages/docs/configuration.tsx +121 -0
- package/templates/landing/src/pages/docs/content-collections.tsx +130 -0
- package/templates/landing/src/pages/docs/data-layer.tsx +142 -0
- package/templates/landing/src/pages/docs/getting-started.tsx +119 -0
- package/templates/landing/src/pages/docs/index.tsx +123 -0
- package/templates/landing/src/pages/docs/layouts.tsx +114 -0
- package/templates/landing/src/pages/docs/middleware.tsx +124 -0
- package/templates/landing/src/pages/docs/pages.tsx +135 -0
- package/templates/landing/src/pages/docs/routing.tsx +123 -0
- package/templates/landing/src/pages/docs/server-functions.tsx +123 -0
- package/templates/landing/src/pages/features.tsx +129 -0
- package/templates/landing/src/pages/index.tsx +175 -0
- package/templates/landing/src/styles/globals.css +100 -0
- package/templates/landing/src/x-routes.ts +31 -0
- package/templates/landing/tsconfig.json +5 -0
- package/templates/landing/x.config.ts +2 -0
- package/templates/saas/components.json +20 -0
- package/templates/saas/public/favicon.ico +0 -0
- package/templates/saas/src/actions/dashboard.ts +3 -0
- package/templates/saas/src/components/ui/avatar.tsx +91 -0
- package/templates/saas/src/components/ui/badge.tsx +49 -0
- package/templates/saas/src/components/ui/button.tsx +58 -0
- package/templates/saas/src/components/ui/card.tsx +88 -0
- package/templates/saas/src/components/ui/input.tsx +20 -0
- package/templates/saas/src/layouts/dashboard.tsx +67 -0
- package/templates/saas/src/layouts/main.tsx +38 -0
- package/templates/saas/src/lib/auth.ts +70 -0
- package/templates/saas/src/lib/migrations/001_create_sessions.sql +9 -0
- package/templates/saas/src/lib/utils.ts +5 -0
- package/templates/saas/src/pages/dashboard/_middleware.ts +9 -0
- package/templates/saas/src/pages/dashboard/analytics.tsx +68 -0
- package/templates/saas/src/pages/dashboard/index.tsx +86 -0
- package/templates/saas/src/pages/dashboard/settings.tsx +105 -0
- package/templates/saas/src/pages/index.tsx +110 -0
- package/templates/saas/src/pages/login.tsx +67 -0
- package/templates/saas/src/pages/pricing.tsx +121 -0
- package/templates/saas/src/styles/globals.css +90 -0
- package/templates/saas/src/x-routes.ts +22 -0
- package/templates/saas/tsconfig.json +5 -0
- package/templates/saas/x.config.ts +7 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
function Card({
|
|
6
|
+
className,
|
|
7
|
+
size = "default",
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
data-slot="card"
|
|
13
|
+
data-size={size}
|
|
14
|
+
className={cn(
|
|
15
|
+
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
data-slot="card-header"
|
|
27
|
+
className={cn(
|
|
28
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-slot="card-title"
|
|
40
|
+
className={cn(
|
|
41
|
+
"text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
data-slot="card-description"
|
|
53
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
data-slot="card-action"
|
|
63
|
+
className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
70
|
+
return (
|
|
71
|
+
<div data-slot="card-content" className={cn("px-(--card-spacing)", className)} {...props} />
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
76
|
+
return (
|
|
77
|
+
<div
|
|
78
|
+
data-slot="card-footer"
|
|
79
|
+
className={cn(
|
|
80
|
+
"flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
|
|
81
|
+
className,
|
|
82
|
+
)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
7
|
+
return (
|
|
8
|
+
<InputPrimitive
|
|
9
|
+
type={type}
|
|
10
|
+
data-slot="input"
|
|
11
|
+
className={cn(
|
|
12
|
+
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { Input };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export default function BlogLayout({ children }: { children: ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<div className="mx-auto max-w-4xl px-4 py-8">
|
|
6
|
+
<nav className="mb-8 text-sm text-muted-foreground">
|
|
7
|
+
<a href="/" className="transition-colors hover:text-foreground">
|
|
8
|
+
Home
|
|
9
|
+
</a>
|
|
10
|
+
<span className="mx-2">/</span>
|
|
11
|
+
<span className="text-foreground">Blog</span>
|
|
12
|
+
</nav>
|
|
13
|
+
<div className="grid gap-12 lg:grid-cols-[1fr_280px]">
|
|
14
|
+
<div>{children}</div>
|
|
15
|
+
<aside className="space-y-8">
|
|
16
|
+
<div className="rounded-lg border border-border bg-card p-6">
|
|
17
|
+
<h3 className="mb-4 text-sm font-semibold uppercase tracking-wider text-muted-foreground">
|
|
18
|
+
Categories
|
|
19
|
+
</h3>
|
|
20
|
+
<ul className="space-y-2 text-sm text-muted-foreground">
|
|
21
|
+
<li className="transition-colors hover:text-foreground">All Posts</li>
|
|
22
|
+
<li className="transition-colors hover:text-foreground">Tutorials</li>
|
|
23
|
+
<li className="transition-colors hover:text-foreground">Design</li>
|
|
24
|
+
<li className="transition-colors hover:text-foreground">Technology</li>
|
|
25
|
+
</ul>
|
|
26
|
+
</div>
|
|
27
|
+
<div className="rounded-lg border border-border bg-card p-6">
|
|
28
|
+
<h3 className="mb-4 text-sm font-semibold uppercase tracking-wider text-muted-foreground">
|
|
29
|
+
Tags
|
|
30
|
+
</h3>
|
|
31
|
+
<div className="flex flex-wrap gap-2">
|
|
32
|
+
{["welcome", "tutorial", "css", "tailwind", "x-framework"].map((tag) => (
|
|
33
|
+
<span
|
|
34
|
+
key={tag}
|
|
35
|
+
className="rounded-full border border-border bg-muted px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground"
|
|
36
|
+
>
|
|
37
|
+
{tag}
|
|
38
|
+
</span>
|
|
39
|
+
))}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</aside>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export default function MainLayout({ children }: { children: ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex min-h-screen flex-col bg-background">
|
|
6
|
+
<header className="sticky top-0 z-50 border-b border-border bg-background/80 backdrop-blur-sm">
|
|
7
|
+
<div className="mx-auto flex h-16 max-w-4xl items-center justify-between px-4">
|
|
8
|
+
<a href="/" className="text-xl font-bold tracking-tight text-foreground">
|
|
9
|
+
Blog
|
|
10
|
+
</a>
|
|
11
|
+
<nav className="flex items-center gap-8 text-sm font-medium text-muted-foreground">
|
|
12
|
+
<a href="/" className="transition-colors hover:text-foreground">
|
|
13
|
+
Home
|
|
14
|
+
</a>
|
|
15
|
+
<a href="/blog" className="transition-colors hover:text-foreground">
|
|
16
|
+
Blog
|
|
17
|
+
</a>
|
|
18
|
+
<a href="/about" className="transition-colors hover:text-foreground">
|
|
19
|
+
About
|
|
20
|
+
</a>
|
|
21
|
+
</nav>
|
|
22
|
+
</div>
|
|
23
|
+
</header>
|
|
24
|
+
<main className="flex-1">{children}</main>
|
|
25
|
+
<footer className="border-t border-border">
|
|
26
|
+
<div className="mx-auto max-w-4xl px-4 py-8 text-center text-sm text-muted-foreground">
|
|
27
|
+
© {new Date().getFullYear()} The Blog. Built with x framework.
|
|
28
|
+
</div>
|
|
29
|
+
</footer>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RouteProps } from "@thexjs/core";
|
|
2
|
+
|
|
3
|
+
export default function AboutPage(_props: RouteProps) {
|
|
4
|
+
return (
|
|
5
|
+
<div className="mx-auto max-w-prose px-4 py-16">
|
|
6
|
+
<h1 className="text-4xl font-bold tracking-tight">About This Blog</h1>
|
|
7
|
+
<div className="mt-8 space-y-6 text-base leading-relaxed text-muted-foreground">
|
|
8
|
+
<p>
|
|
9
|
+
The Blog is a showcase for the <strong className="text-foreground">x framework</strong> —
|
|
10
|
+
a Bun-based fullstack framework that combines static generation, server-side rendering,
|
|
11
|
+
and API routes in a single process. This example demonstrates file-based routing, content
|
|
12
|
+
collections, layouts, and more.
|
|
13
|
+
</p>
|
|
14
|
+
<p>
|
|
15
|
+
Built with Tailwind CSS v4 and shadcn/ui components, the design emphasizes readability,
|
|
16
|
+
modern aesthetics, and a dark theme out of the box. Every page is responsive, accessible,
|
|
17
|
+
and performant.
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
<div className="mt-12 rounded-2xl border border-border bg-card p-8">
|
|
21
|
+
<h2 className="text-xl font-semibold tracking-tight">Author</h2>
|
|
22
|
+
<div className="mt-4 flex items-center gap-4">
|
|
23
|
+
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-muted text-sm font-semibold text-muted-foreground">
|
|
24
|
+
X
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<p className="font-medium text-card-foreground">x Framework Team</p>
|
|
28
|
+
<p className="text-sm text-muted-foreground">
|
|
29
|
+
Building the future of fullstack development.
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { renderMarkdown, scanContent } from "@thexjs/core";
|
|
3
|
+
import type { LoaderArgs, RouteProps } from "@thexjs/core";
|
|
4
|
+
|
|
5
|
+
interface PostLoaderData {
|
|
6
|
+
html: string;
|
|
7
|
+
title: string;
|
|
8
|
+
date: string;
|
|
9
|
+
tags: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function loader({ params }: LoaderArgs) {
|
|
13
|
+
const contentDir = join(import.meta.dir, "..", "..", "..", "content");
|
|
14
|
+
const entries = scanContent(contentDir);
|
|
15
|
+
const entry = entries.find((e) => e.slug === params.slug);
|
|
16
|
+
if (!entry) return new Response(null, { status: 302, headers: { Location: "/blog" } });
|
|
17
|
+
const html = await renderMarkdown(entry.body);
|
|
18
|
+
return {
|
|
19
|
+
html,
|
|
20
|
+
title: entry.frontmatter.title ?? entry.slug,
|
|
21
|
+
date: entry.frontmatter.date ?? "",
|
|
22
|
+
tags: (entry.frontmatter.tags ?? []) as string[],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function BlogPostPage({ loaderData }: RouteProps) {
|
|
27
|
+
const data = loaderData as Record<string, unknown>;
|
|
28
|
+
const html = data.html as string;
|
|
29
|
+
const title = data.title as string;
|
|
30
|
+
const date = data.date as string;
|
|
31
|
+
const tags = Array.isArray(data.tags) ? (data.tags as string[]) : [];
|
|
32
|
+
return (
|
|
33
|
+
<article className="max-w-prose">
|
|
34
|
+
<h1 className="text-4xl font-bold tracking-tight">{title}</h1>
|
|
35
|
+
<div className="mt-4 flex flex-wrap items-center gap-4 text-sm text-muted-foreground">
|
|
36
|
+
{date && <time dateTime={date}>{date}</time>}
|
|
37
|
+
{tags.length > 0 && (
|
|
38
|
+
<div className="flex flex-wrap gap-2">
|
|
39
|
+
{tags.map((tag: string) => (
|
|
40
|
+
<span
|
|
41
|
+
key={tag}
|
|
42
|
+
className="rounded-full border border-border bg-muted px-2.5 py-0.5 text-xs text-muted-foreground"
|
|
43
|
+
>
|
|
44
|
+
{tag}
|
|
45
|
+
</span>
|
|
46
|
+
))}
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
<div
|
|
51
|
+
className="prose prose-invert mt-8 max-w-none prose-headings:scroll-m-20 prose-headings:font-semibold prose-headings:tracking-tight prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl prose-a:text-primary prose-a:no-underline hover:prose-a:underline prose-code:rounded prose-code:bg-muted prose-code:px-1.5 prose-code:py-0.5 prose-code:text-sm prose-pre:rounded-xl prose-pre:border prose-pre:border-border prose-pre:bg-card prose-img:rounded-xl"
|
|
52
|
+
dangerouslySetInnerHTML={{ __html: html }}
|
|
53
|
+
/>
|
|
54
|
+
</article>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { scanContent } from "@thexjs/core";
|
|
3
|
+
import type { LoaderArgs, RouteProps } from "@thexjs/core";
|
|
4
|
+
|
|
5
|
+
interface BlogEntry {
|
|
6
|
+
routePath: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
date: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface BlogLoaderData {
|
|
14
|
+
entries: BlogEntry[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function loader(_args: LoaderArgs) {
|
|
18
|
+
const contentDir = join(import.meta.dir, "..", "..", "..", "content");
|
|
19
|
+
const entries = scanContent(contentDir);
|
|
20
|
+
return {
|
|
21
|
+
entries: entries.map((e) => ({
|
|
22
|
+
routePath: e.routePath,
|
|
23
|
+
title: e.frontmatter.title ?? e.slug,
|
|
24
|
+
description: (e.frontmatter.description as string) ?? "",
|
|
25
|
+
date: (e.frontmatter.date as string) ?? "",
|
|
26
|
+
tags: Array.isArray(e.frontmatter.tags) ? (e.frontmatter.tags as string[]) : [],
|
|
27
|
+
})),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default function BlogPage({ loaderData }: RouteProps) {
|
|
32
|
+
const { entries } = loaderData as unknown as BlogLoaderData;
|
|
33
|
+
return (
|
|
34
|
+
<div>
|
|
35
|
+
<h1 className="mb-8 text-3xl font-bold tracking-tight">All Posts</h1>
|
|
36
|
+
{entries.length === 0 && (
|
|
37
|
+
<p className="text-muted-foreground">No posts yet. Check back soon!</p>
|
|
38
|
+
)}
|
|
39
|
+
<div className="space-y-6">
|
|
40
|
+
{entries.map((entry) => (
|
|
41
|
+
<a
|
|
42
|
+
key={entry.routePath}
|
|
43
|
+
href={entry.routePath}
|
|
44
|
+
className="group block rounded-xl border border-border bg-card p-6 transition-all duration-300 hover:-translate-y-0.5 hover:border-muted-foreground/30 hover:shadow-lg"
|
|
45
|
+
>
|
|
46
|
+
{entry.date && <p className="text-xs text-muted-foreground">{entry.date}</p>}
|
|
47
|
+
<h2 className="mt-1.5 text-xl font-semibold text-card-foreground transition-colors group-hover:text-primary">
|
|
48
|
+
{entry.title}
|
|
49
|
+
</h2>
|
|
50
|
+
{entry.description && (
|
|
51
|
+
<p className="mt-2 line-clamp-2 text-sm text-muted-foreground">{entry.description}</p>
|
|
52
|
+
)}
|
|
53
|
+
{Array.isArray(entry.tags) && entry.tags.length > 0 && (
|
|
54
|
+
<div className="mt-4 flex flex-wrap gap-2">
|
|
55
|
+
{entry.tags.map((tag: string) => (
|
|
56
|
+
<span
|
|
57
|
+
key={tag}
|
|
58
|
+
className="rounded-full border border-border bg-muted px-2.5 py-0.5 text-xs text-muted-foreground"
|
|
59
|
+
>
|
|
60
|
+
{tag}
|
|
61
|
+
</span>
|
|
62
|
+
))}
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
</a>
|
|
66
|
+
))}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const featuredPosts = [
|
|
2
|
+
{
|
|
3
|
+
slug: "hello-world",
|
|
4
|
+
title: "Hello World",
|
|
5
|
+
description:
|
|
6
|
+
"Welcome to our blog — a space for thoughts on web development, design, and technology.",
|
|
7
|
+
date: "Jul 27, 2026",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
slug: "getting-started",
|
|
11
|
+
title: "Getting Started with x Framework",
|
|
12
|
+
description: "Learn how to build your first fullstack application with x framework.",
|
|
13
|
+
date: "Jul 26, 2026",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
slug: "tailwind-v4",
|
|
17
|
+
title: "Tailwind CSS v4 — What's New",
|
|
18
|
+
description: "A comprehensive look at the changes in Tailwind CSS v4.",
|
|
19
|
+
date: "Jul 25, 2026",
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export default function HomePage() {
|
|
24
|
+
return (
|
|
25
|
+
<div className="space-y-24">
|
|
26
|
+
<section className="mx-auto max-w-4xl px-4 pt-24 text-center">
|
|
27
|
+
<h1 className="bg-gradient-to-r from-foreground via-foreground/80 to-muted-foreground bg-clip-text text-5xl font-bold tracking-tight text-transparent sm:text-6xl">
|
|
28
|
+
The Blog
|
|
29
|
+
</h1>
|
|
30
|
+
<p className="mt-6 text-lg text-muted-foreground sm:text-xl">
|
|
31
|
+
Thoughts on web development, design, and technology.
|
|
32
|
+
</p>
|
|
33
|
+
</section>
|
|
34
|
+
<section className="mx-auto max-w-4xl px-4">
|
|
35
|
+
<h2 className="mb-8 text-2xl font-semibold tracking-tight">Featured Posts</h2>
|
|
36
|
+
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
37
|
+
{featuredPosts.map((post) => (
|
|
38
|
+
<a
|
|
39
|
+
key={post.slug}
|
|
40
|
+
href={`/blog/${post.slug}`}
|
|
41
|
+
className="group rounded-xl border border-border bg-card p-6 transition-all duration-300 hover:-translate-y-1 hover:border-muted-foreground/30 hover:shadow-lg"
|
|
42
|
+
>
|
|
43
|
+
<p className="text-xs text-muted-foreground">{post.date}</p>
|
|
44
|
+
<h3 className="mt-2 text-lg font-semibold text-card-foreground transition-colors group-hover:text-primary">
|
|
45
|
+
{post.title}
|
|
46
|
+
</h3>
|
|
47
|
+
<p className="mt-2 line-clamp-2 text-sm text-muted-foreground">{post.description}</p>
|
|
48
|
+
</a>
|
|
49
|
+
))}
|
|
50
|
+
</div>
|
|
51
|
+
</section>
|
|
52
|
+
<section className="mx-auto max-w-4xl px-4 pb-24 text-center">
|
|
53
|
+
<div className="rounded-2xl border border-border bg-card p-12">
|
|
54
|
+
<h2 className="text-2xl font-semibold tracking-tight">Stay Updated</h2>
|
|
55
|
+
<p className="mt-2 text-muted-foreground">Get notified when new posts are published.</p>
|
|
56
|
+
<div className="mx-auto mt-6 flex max-w-md gap-3">
|
|
57
|
+
<input
|
|
58
|
+
type="email"
|
|
59
|
+
placeholder="Enter your email"
|
|
60
|
+
className="flex-1 rounded-lg border border-input bg-background px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
|
|
61
|
+
/>
|
|
62
|
+
<button className="rounded-lg bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90">
|
|
63
|
+
Subscribe
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</section>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
@theme inline {
|
|
7
|
+
--color-background: var(--background);
|
|
8
|
+
--color-foreground: var(--foreground);
|
|
9
|
+
--color-card: var(--card);
|
|
10
|
+
--color-card-foreground: var(--card-foreground);
|
|
11
|
+
--color-popover: var(--popover);
|
|
12
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
13
|
+
--color-primary: var(--primary);
|
|
14
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
15
|
+
--color-secondary: var(--secondary);
|
|
16
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
17
|
+
--color-muted: var(--muted);
|
|
18
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
19
|
+
--color-accent: var(--accent);
|
|
20
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
21
|
+
--color-destructive: var(--destructive);
|
|
22
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
23
|
+
--color-border: var(--border);
|
|
24
|
+
--color-input: var(--input);
|
|
25
|
+
--color-ring: var(--ring);
|
|
26
|
+
--color-chart-1: var(--chart-1);
|
|
27
|
+
--color-chart-2: var(--chart-2);
|
|
28
|
+
--color-chart-3: var(--chart-3);
|
|
29
|
+
--color-chart-4: var(--chart-4);
|
|
30
|
+
--color-chart-5: var(--chart-5);
|
|
31
|
+
--radius-sm: calc(var(--radius) * 0.6);
|
|
32
|
+
--radius-md: calc(var(--radius) * 0.8);
|
|
33
|
+
--radius-lg: var(--radius);
|
|
34
|
+
--radius-xl: calc(var(--radius) * 1.4);
|
|
35
|
+
--radius-2xl: calc(var(--radius) * 1.8);
|
|
36
|
+
--radius-3xl: calc(var(--radius) * 2.2);
|
|
37
|
+
--radius-4xl: calc(var(--radius) * 2.6);
|
|
38
|
+
--color-sidebar: var(--sidebar);
|
|
39
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
40
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
41
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
42
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
43
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
44
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
45
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:root {
|
|
49
|
+
--radius: 0.625rem;
|
|
50
|
+
--background: oklch(0.145 0 0);
|
|
51
|
+
--foreground: oklch(0.985 0 0);
|
|
52
|
+
--card: oklch(0.205 0 0);
|
|
53
|
+
--card-foreground: oklch(0.985 0 0);
|
|
54
|
+
--popover: oklch(0.205 0 0);
|
|
55
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
56
|
+
--primary: oklch(0.922 0 0);
|
|
57
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
58
|
+
--secondary: oklch(0.269 0 0);
|
|
59
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
60
|
+
--muted: oklch(0.269 0 0);
|
|
61
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
62
|
+
--accent: oklch(0.269 0 0);
|
|
63
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
64
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
65
|
+
--border: oklch(1 0 0 / 10%);
|
|
66
|
+
--input: oklch(1 0 0 / 15%);
|
|
67
|
+
--ring: oklch(0.556 0 0);
|
|
68
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
69
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
70
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
71
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
72
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
73
|
+
--sidebar: oklch(0.205 0 0);
|
|
74
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
75
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
76
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
77
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
78
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
79
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
80
|
+
--sidebar-ring: oklch(0.556 0 0);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@layer base {
|
|
84
|
+
* {
|
|
85
|
+
@apply border-border outline-ring/50;
|
|
86
|
+
}
|
|
87
|
+
body {
|
|
88
|
+
@apply bg-background text-foreground;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Auto-generated by @thexjs/core -- do not edit
|
|
2
|
+
export type RouteMap = {
|
|
3
|
+
"/": Record<string, never>;
|
|
4
|
+
"/blog": Record<string, never>;
|
|
5
|
+
"/blog/:slug": { slug: string };
|
|
6
|
+
"/about": Record<string, never>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function href<T extends keyof RouteMap & string>(
|
|
10
|
+
path: T,
|
|
11
|
+
...[params]: RouteMap[T] extends Record<string, never> ? [] : [RouteMap[T]]
|
|
12
|
+
): string {
|
|
13
|
+
if (!params) return path;
|
|
14
|
+
let result: string = path;
|
|
15
|
+
for (const [key, value] of Object.entries(params)) {
|
|
16
|
+
result = result.replace(new RegExp(`:${key}(?=/|$)`), encodeURIComponent(String(value)));
|
|
17
|
+
}
|
|
18
|
+
result = result.replace(/\*+$/, "");
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "base-nova",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/styles/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@/components",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"ui": "@/components/ui",
|
|
17
|
+
"lib": "@/lib"
|
|
18
|
+
},
|
|
19
|
+
"iconLibrary": "lucide"
|
|
20
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { highlight } from "../lib/syntax";
|
|
3
|
+
|
|
4
|
+
interface CodeBlockProps {
|
|
5
|
+
label: string;
|
|
6
|
+
code: string;
|
|
7
|
+
lang?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function CodeBlock({ label, code, lang = "tsx" }: CodeBlockProps) {
|
|
11
|
+
return (
|
|
12
|
+
<div className="mt-6 overflow-hidden rounded-xl border border-border/60 bg-[#0d1117] shadow-lg">
|
|
13
|
+
<div className="flex items-center gap-1.5 border-b border-white/5 bg-[#161b22] px-4 py-2.5">
|
|
14
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#ff5f56]" />
|
|
15
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#ffbd2e]" />
|
|
16
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#27c93f]" />
|
|
17
|
+
<span className="ml-2 text-xs text-[#8b949e]">{label}</span>
|
|
18
|
+
</div>
|
|
19
|
+
<pre className="overflow-x-auto p-5 text-sm leading-relaxed">
|
|
20
|
+
<code className="font-mono text-[#e6edf3]">{highlight(code, lang)}</code>
|
|
21
|
+
</pre>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|