@epicabdou/create-linkrjs-app 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -42,7 +42,9 @@ The template produces a minimal but complete Vite + React + TypeScript app with
42
42
  |------|-------------|
43
43
  | `src/main.tsx` | Entry: imports CSS, builds routes with `createRoutes` + `import.meta.glob("./pages/**/*.tsx")`, creates React root and `RouterProvider`. |
44
44
  | `src/index.css` | Tailwind + design system: `@import "tailwindcss"`, `@import "linkr-design-system/theme"`, `@import "linkr-design-system/base"`. |
45
- | `src/pages/index.tsx` | Home page at `/` (sample content using design-system classes). |
45
+ | `src/layouts/Layout.tsx` | Layout example (Astro-style): nav + `children`. Import and wrap page content with `<Layout>…</Layout>` only on pages that need it. |
46
+ | `src/pages/index.tsx` | Home page at `/` — wraps content in `<Layout>`. |
47
+ | `src/pages/about.tsx` | About page at `/about` — same `<Layout>` wrapper. |
46
48
  | `src/pages/404.tsx` | Not-found page (catch-all route). |
47
49
  | `src/config/protect.tsx` | Example `ProtectConfig` for route protection (optional use with `<Protect>`). |
48
50
  | `src/vite-env.d.ts` | Vite client types. |
@@ -61,7 +63,7 @@ The template produces a minimal but complete Vite + React + TypeScript app with
61
63
  - `blog/index.tsx` → `/blog`
62
64
  - `blog/[id].tsx` → `/blog/:id`
63
65
  - `docs/[...slug].tsx` → `/docs/*`
64
- 2. **Add layouts** — Either add `_layout.tsx` in a page folder, or use a separate `src/layouts/` folder with `layoutsGlob` and `layoutMap` in `main.tsx` (see [linkr README](../linkr/README.md#layouts-in-a-separate-folder)).
66
+ 2. **Add layouts** — Astro-style: add components in `src/layouts/` (e.g. `Layout.tsx`) that accept `children`, then import and wrap specific pages with `<Layout>…</Layout>`. No router config each page chooses its layout.
65
67
  3. **Protect routes** — Use the `protect` export on a page/layout or wrap content with `<Protect>` and the config from `src/config/protect.tsx`.
66
68
  4. **Styling** — Use Tailwind utilities and design-system tokens (e.g. `bg-primary-500`, `text-neutral-600`, `rounded-lg`, `font-sans`). See [design-system README](../design-system/README.md).
67
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epicabdou/create-linkrjs-app",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Scaffold a new linkr.js app (Vite + React + React Router + file-based routing)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"name":"my-linkrjs-app","private":true,"version":"0.0.1","type":"module","scripts":{"dev":"vite","build":"tsc -b && vite build","preview":"vite preview"},"dependencies":{"@epicabdou/linkr":"^0.0.4","linkr-design-system":"^0.0.1","react":"^18.2.0","react-dom":"^18.2.0","react-router":"^7.0.0"},"devDependencies":{"@tailwindcss/vite":"^4.0.0","@types/react":"^18.2.0","@types/react-dom":"^18.2.0","@vitejs/plugin-react":"^4.2.0","tailwindcss":"^4.0.0","typescript":"^5.3.0","vite":"^5.0.0"}}
1
+ {"name":"my-linkrjs-app","private":true,"version":"0.0.1","type":"module","scripts":{"dev":"vite","build":"tsc -b && vite build","preview":"vite preview"},"dependencies":{"@epicabdou/linkr":"^0.0.6","linkr-design-system":"^0.0.1","react":"^18.2.0","react-dom":"^18.2.0","react-router":"^7.0.0"},"devDependencies":{"@tailwindcss/vite":"^4.0.0","@types/react":"^18.2.0","@types/react-dom":"^18.2.0","@vitejs/plugin-react":"^4.2.0","tailwindcss":"^4.0.0","typescript":"^5.3.0","vite":"^5.0.0"}}
@@ -0,0 +1,28 @@
1
+ import { Link } from "react-router";
2
+ import type { ReactNode } from "react";
3
+
4
+ type LayoutProps = { children: ReactNode };
5
+
6
+ export default function Layout({ children }: LayoutProps) {
7
+ return (
8
+ <div className="min-h-screen font-sans flex flex-col">
9
+ <nav className="border-b border-neutral-200 bg-white/80 backdrop-blur-sm sticky top-0 z-10">
10
+ <div className="max-w-4xl mx-auto px-6 py-4 flex gap-6">
11
+ <Link
12
+ to="/"
13
+ className="text-neutral-600 hover:text-primary-600 font-medium transition-colors"
14
+ >
15
+ Home
16
+ </Link>
17
+ <Link
18
+ to="/about"
19
+ className="text-neutral-600 hover:text-primary-600 font-medium transition-colors"
20
+ >
21
+ About
22
+ </Link>
23
+ </div>
24
+ </nav>
25
+ <main className="flex-1">{children}</main>
26
+ </div>
27
+ );
28
+ }
@@ -0,0 +1,14 @@
1
+ import Layout from "../layouts/Layout";
2
+
3
+ export default function About() {
4
+ return (
5
+ <Layout>
6
+ <div className="max-w-4xl mx-auto px-6 py-8">
7
+ <h1 className="text-3xl font-bold text-neutral-900">About</h1>
8
+ <p className="mt-2 text-neutral-600">
9
+ This page uses the same <code className="rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-sm">{"<Layout />"}</code> as Home. Add layouts in <code className="rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-sm">src/layouts/</code> and wrap only the pages that need them (Astro-style).
10
+ </p>
11
+ </div>
12
+ </Layout>
13
+ );
14
+ }
@@ -1,6 +1,9 @@
1
+ import Layout from "../layouts/Layout";
2
+
1
3
  export default function Home() {
2
4
  return (
3
- <div className="min-h-screen font-sans p-8">
5
+ <Layout>
6
+ <div className="max-w-4xl mx-auto px-6 py-8">
4
7
  <h1 className="text-3xl font-bold text-neutral-900">Welcome to linkr.js</h1>
5
8
  <p className="mt-2 text-neutral-600">
6
9
  Edit <code className="rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-sm">src/pages/index.tsx</code> to get started.
@@ -9,5 +12,6 @@ export default function Home() {
9
12
  Tailwind v4 + linkr design system are included. Use utilities like <code className="text-primary-600">bg-primary-500</code>, <code className="text-primary-600">rounded-lg</code>, <code className="text-primary-600">font-sans</code>.
10
13
  </p>
11
14
  </div>
15
+ </Layout>
12
16
  );
13
17
  }