Skip to content

Commit

Permalink
Base app
Browse files Browse the repository at this point in the history
  • Loading branch information
glesage committed Dec 1, 2024
1 parent 6c24f2a commit bd86587
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 119 deletions.
12 changes: 0 additions & 12 deletions web/components/Button.tsx

This file was deleted.

7 changes: 7 additions & 0 deletions web/components/Logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Logo() {
return (
<a href="/">
<img class="h-8" src="/logo.svg" alt="EVY" />
</a>
);
}
12 changes: 12 additions & 0 deletions web/components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Logo from "./Logo.tsx";

export default function Navbar() {
return (
<nav class="bg-gray-50 flex flex-wrap items-center justify-between p-4">
<Logo />
<a href="/about" class="navbar-solid-bg font-medium">
About
</a>
</nav>
);
}
69 changes: 32 additions & 37 deletions web/deno.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
{
"lock": false,
"tasks": {
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
"cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
"manifest": "deno task cli manifest $(pwd)",
"start": "deno run -A --watch=static/,routes/ dev.ts",
"build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"exclude": [
"**/_fresh/*"
],
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"tailwindcss": "npm:[email protected]",
"tailwindcss/": "npm:/[email protected]/",
"tailwindcss/plugin": "npm:/[email protected]/plugin.js",
"$std/": "https://deno.land/[email protected]/"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"nodeModulesDir": true
"lock": false,
"tasks": {
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
"cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
"manifest": "deno task cli manifest $(pwd)",
"start": "deno run -A --watch=static/,routes/ dev.ts",
"build": "deno run -A dev.ts build",
"preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
"lint": {
"rules": {
"tags": ["fresh", "recommended"]
}
},
"exclude": ["**/_fresh/*"],
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"tailwindcss": "npm:[email protected]",
"tailwindcss/": "npm:/[email protected]/",
"tailwindcss/plugin": "npm:/[email protected]/plugin.js",
"$std/": "https://deno.land/[email protected]/"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"nodeModulesDir": "auto"
}
8 changes: 2 additions & 6 deletions web/fresh.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import * as $_404 from "./routes/_404.tsx";
import * as $_app from "./routes/_app.tsx";
import * as $about_index from "./routes/about/index.tsx";
import * as $index from "./routes/index.tsx";
import * as $Counter from "./islands/Counter.tsx";
import * as $Logo from "./islands/Logo.tsx";

import type { Manifest } from "$fresh/server.ts";

const manifest = {
Expand All @@ -17,10 +16,7 @@ const manifest = {
"./routes/about/index.tsx": $about_index,
"./routes/index.tsx": $index,
},
islands: {
"./islands/Counter.tsx": $Counter,
"./islands/Logo.tsx": $Logo,
},
islands: {},
baseUrl: import.meta.url,
} satisfies Manifest;

Expand Down
16 changes: 0 additions & 16 deletions web/islands/Counter.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions web/islands/Logo.tsx

This file was deleted.

35 changes: 12 additions & 23 deletions web/routes/_404.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
import { Head } from "$fresh/runtime.ts";

export default function Error404() {
return (
<>
<Head>
<title>404 - Page not found</title>
</Head>
<div class="px-4 py-8 mx-auto bg-[#86efac]">
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
<img
class="my-6"
src="/logo.svg"
width="128"
height="128"
alt="the Fresh logo: a sliced lemon dripping with juice"
/>
<h1 class="text-4xl font-bold">404 - Page not found</h1>
<p class="my-4">
The page you were looking for doesn't exist.
</p>
<a href="/" class="underline">Go back home</a>
</div>
</div>
</>
);
return (
<>
<Head>
<title>404 - Page not found</title>
</Head>
<div class="px-4 py-8 mx-auto">
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
<h1 class="text-4xl font-bold">404 - Page not found</h1>
</div>
</div>
</>
);
}
11 changes: 9 additions & 2 deletions web/routes/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { type PageProps } from "$fresh/server.ts";
import { Partial } from "$fresh/runtime.ts";

import Navbar from "../components/Navbar.tsx";

export default function App({ Component }: PageProps) {
return (
<html>
Expand All @@ -11,8 +15,11 @@ export default function App({ Component }: PageProps) {
<title>EVY</title>
<link rel="stylesheet" href="/styles.css" />
</head>
<body>
<Component />
<body f-client-nav>
<Navbar />
<Partial name="body">
<Component />
</Partial>
</body>
</html>
);
Expand Down
2 changes: 0 additions & 2 deletions web/routes/about/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { PageProps } from "$fresh/server.ts";
import Logo from "../../islands/Logo.tsx";

export default function About(props: PageProps) {
return (
<div class="px-4 py-8">
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
<Logo />
<h1 class="text-4xl font-bold">Why we exist</h1>
<div class="pt-8">
<h4 class="text-xl font-bold text-left">- Data Privacy</h4>
Expand Down
7 changes: 0 additions & 7 deletions web/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { useSignal } from "@preact/signals";
import Counter from "../islands/Counter.tsx";
import Logo from "../islands/Logo.tsx";

export default function Home() {
const count = useSignal(3);
return (
<div class="px-4 py-8">
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
<Logo />
<h1 class="text-4xl font-bold">App builder</h1>
<Counter count={count} />
</div>
</div>
);
Expand Down
4 changes: 1 addition & 3 deletions web/static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bd86587

Please sign in to comment.