chore: remove unused demo app (#2442)
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
# Fresh project
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Start the project:
|
|
||||||
|
|
||||||
```
|
|
||||||
deno task start
|
|
||||||
```
|
|
||||||
|
|
||||||
This will watch the project directory and restart as necessary.
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"lock": false,
|
|
||||||
"tasks": {
|
|
||||||
"start": "deno run -A --watch=static/,routes/ dev.ts"
|
|
||||||
},
|
|
||||||
"imports": {
|
|
||||||
"$fresh/": "../",
|
|
||||||
"preact": "https://esm.sh/preact@10.22.0",
|
|
||||||
"preact/": "https://esm.sh/preact@10.22.0/",
|
|
||||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
|
|
||||||
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.5.1"
|
|
||||||
},
|
|
||||||
"compilerOptions": {
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"jsxImportSource": "preact"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env -S deno run -A --watch=static/,routes/
|
|
||||||
|
|
||||||
import dev from "$fresh/dev.ts";
|
|
||||||
|
|
||||||
await dev(import.meta.url, "./main.ts");
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
// DO NOT EDIT. This file is generated by Fresh.
|
|
||||||
// This file SHOULD be checked into source version control.
|
|
||||||
// This file is automatically updated during development when running `dev.ts`.
|
|
||||||
|
|
||||||
import * as $0 from "./routes/index.tsx";
|
|
||||||
import * as $1 from "./routes/passthrough.tsx";
|
|
||||||
import * as $$0 from "./islands/Counter.tsx";
|
|
||||||
import * as $$1 from "./islands/Passthrough.tsx";
|
|
||||||
|
|
||||||
const manifest = {
|
|
||||||
routes: {
|
|
||||||
"./routes/index.tsx": $0,
|
|
||||||
"./routes/passthrough.tsx": $1,
|
|
||||||
},
|
|
||||||
islands: {
|
|
||||||
"./islands/Counter.tsx": $$0,
|
|
||||||
"./islands/Passthrough.tsx": $$1,
|
|
||||||
},
|
|
||||||
baseUrl: import.meta.url,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default manifest;
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { Signal } from "@preact/signals";
|
|
||||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
|
||||||
|
|
||||||
interface CounterProps {
|
|
||||||
count: Signal<number>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Counter({ count }: CounterProps) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<p>{count}</p>
|
|
||||||
<button onClick={() => count.value -= 1} disabled={!IS_BROWSER}>
|
|
||||||
-1
|
|
||||||
</button>
|
|
||||||
<button onClick={() => count.value += 1} disabled={!IS_BROWSER}>
|
|
||||||
+1
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
import { useState } from "preact/hooks";
|
|
||||||
import { ComponentChildren } from "preact";
|
|
||||||
|
|
||||||
interface PassthroughProps {
|
|
||||||
children: ComponentChildren;
|
|
||||||
n: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Passthrough({ children, n }: PassthroughProps) {
|
|
||||||
const [v, set] = useState(0);
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
class="pass-through"
|
|
||||||
style="background: #85efac; padding: 1rem; border: 4px solid blue; border-radius: .5rem; margin: 1rem;"
|
|
||||||
>
|
|
||||||
<h2>This is an Island #{n}</h2>
|
|
||||||
<button
|
|
||||||
onClick={() => set((v2) => v2 + 1)}
|
|
||||||
>
|
|
||||||
update {v}
|
|
||||||
</button>
|
|
||||||
<div style="padding: 1rem 0">{children}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/// <reference no-default-lib="true" />
|
|
||||||
/// <reference lib="dom" />
|
|
||||||
/// <reference lib="dom.iterable" />
|
|
||||||
/// <reference lib="dom.asynciterable" />
|
|
||||||
/// <reference lib="deno.ns" />
|
|
||||||
|
|
||||||
import { start } from "$fresh/server.ts";
|
|
||||||
import manifest from "./fresh.gen.ts";
|
|
||||||
|
|
||||||
await start(manifest);
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import { useSignal } from "@preact/signals";
|
|
||||||
import Counter from "../islands/Counter.tsx";
|
|
||||||
|
|
||||||
export default function Home() {
|
|
||||||
const count = useSignal(3);
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
Welcome to Fresh. Try to update this message in the ./routes/index.tsx
|
|
||||||
file, and refresh.
|
|
||||||
</p>
|
|
||||||
<Counter count={count} />
|
|
||||||
<Counter count={count} />
|
|
||||||
<Counter count={count} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import { ComponentChildren } from "preact";
|
|
||||||
import Passthrough from "../islands/Passthrough.tsx";
|
|
||||||
|
|
||||||
export interface FooProps {
|
|
||||||
children?: ComponentChildren;
|
|
||||||
n: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Foo(props: FooProps) {
|
|
||||||
return (
|
|
||||||
<div style="background: #e6afaf; border: 4px solid red; border-radius: .5rem; padding: 1rem; margin: 1rem;">
|
|
||||||
<h2 class="foobar">This is static server content: #{props.n}</h2>
|
|
||||||
<h3 class="foobar">This is static server content: #{props.n}</h3>
|
|
||||||
{props.children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function PassthroughPage() {
|
|
||||||
return (
|
|
||||||
<div style="padding: 2rem">
|
|
||||||
<h2>Single</h2>
|
|
||||||
<Passthrough n={1}>
|
|
||||||
<Foo n={1} />
|
|
||||||
</Passthrough>
|
|
||||||
|
|
||||||
<h2>Nested</h2>
|
|
||||||
<Passthrough n={2}>
|
|
||||||
<Foo n={2}>
|
|
||||||
<Passthrough n={3}>
|
|
||||||
<Foo n={3}>
|
|
||||||
<Passthrough n={4}>
|
|
||||||
<Foo n={4} />
|
|
||||||
</Passthrough>
|
|
||||||
</Foo>
|
|
||||||
</Passthrough>
|
|
||||||
<Passthrough n={5}>
|
|
||||||
<Foo n={5}>
|
|
||||||
<Passthrough n={6}>
|
|
||||||
<Foo n={6} />
|
|
||||||
</Passthrough>
|
|
||||||
</Foo>
|
|
||||||
</Passthrough>
|
|
||||||
</Foo>
|
|
||||||
</Passthrough>
|
|
||||||
|
|
||||||
<h2>Island in Island</h2>
|
|
||||||
<Passthrough n={4}>
|
|
||||||
<Passthrough n={5}>
|
|
||||||
<Foo n={4} />
|
|
||||||
</Passthrough>
|
|
||||||
</Passthrough>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user