Initial Commit + GUI 1. Counter

This commit is contained in:
2025-03-24 21:06:51 +01:00
commit 3b55648ad3
17 changed files with 6031 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
dist
.wrangler
.output
.vercel
.netlify
.vinxi
app.config.timestamp_*.js
# Environment
.env
.env*.local
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
*.launch
.settings/
# Temp
gitignore
# System Files
.DS_Store
Thumbs.db

32
README.md Normal file
View File

@@ -0,0 +1,32 @@
# SolidStart
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);
## Creating a project
```bash
# create a new project in the current directory
npm init solid@latest
# create a new project in my-app
npm init solid@latest my-app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
Solid apps are built with _presets_, which optimise your project for deployment to different environments.
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.
## This project was created with the [Solid CLI](https://solid-cli.netlify.app)

8
app.config.ts Normal file
View File

@@ -0,0 +1,8 @@
import { defineConfig } from "@solidjs/start/config";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
vite: {
plugins: [tailwindcss()]
}
});

29
package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "example-with-tailwindcss",
"type": "module",
"scripts": {
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start"
},
"dependencies": {
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.1.0",
"solid-js": "^1.9.5",
"vinxi": "^0.5.3"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.7",
"daisyui": "^5.0.9",
"tailwindcss": "^4.0.7"
},
"engines": {
"node": ">=22"
},
"pnpm": {
"onlyBuiltDependencies": [
"@parcel/watcher",
"esbuild"
]
}
}

5788
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

3
src/app.css Normal file
View File

@@ -0,0 +1,3 @@
@import "tailwindcss";
@plugin "daisyui";

23
src/app.tsx Normal file
View File

@@ -0,0 +1,23 @@
import { Router } from "@solidjs/router";
import { FileRoutes } from "@solidjs/start/router";
import { Suspense } from "solid-js";
import "./app.css";
import Drawer from "~/components/Drawer";
export default function App() {
return (
<Router
root={props => (
<Drawer>
<main class="flex flex-col w-full h-full items-center justify-center bg-slate-900">
<div class="w-fit h-fit">
<Suspense>{props.children}</Suspense>
</div>
</main>
</Drawer>
)}
>
<FileRoutes/>
</Router>
);
}

26
src/components/Drawer.tsx Normal file
View File

@@ -0,0 +1,26 @@
// noinspection HtmlUnknownTarget
import { children, JSX } from "solid-js";
import { A } from "@solidjs/router";
export default function Drawer(props: { children: JSX.Element }) {
const c = children(() => props.children);
return (
<div class="drawer drawer-open">
<input id="nav-drawer-toggle" type="checkbox" class="drawer-toggle"/>
<div class="drawer-content">
{c()}
</div>
<div class="drawer-side">
<ul class="menu text-base-content min-h-full w-80 p-4 bg-gradient-to-r from-sky-700 to-slate-800 font-bold">
<li><A href="/1_counter"
class="[&.active]:bg-slate-800 [&.active]:shadow-md [&.active]:shadow-slate-800">
1. Counter</A></li>
<li><A href="/2_temperature_converter"
class="[&.active]:bg-slate-800 [&.active]:shadow-md [&.active]:shadow-slate-800">
2. WIP</A></li>
</ul>
</div>
</div>
);
}

4
src/entry-client.tsx Normal file
View File

@@ -0,0 +1,4 @@
// @refresh reload
import { mount, StartClient } from "@solidjs/start/client";
mount(() => <StartClient />, document.getElementById("app")!);

21
src/entry-server.tsx Normal file
View File

@@ -0,0 +1,21 @@
// @refresh reload
import { createHandler, StartServer } from "@solidjs/start/server";
export default createHandler(() => (
<StartServer
document={({ assets, children, scripts }) => (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
<div id="app">{children}</div>
{scripts}
</body>
</html>
)}
/>
));

1
src/global.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="@solidjs/start/env" />

18
src/routes/1_counter.tsx Normal file
View File

@@ -0,0 +1,18 @@
import { createSignal } from "solid-js";
export default function Counter() {
const [count, setCount] = createSignal(0);
return (
<div class="card w-96 bg-base-100 card-md shadow-sm">
<div class="card-body">
<h2 class="card-title">1. Counter</h2>
<div class="text-center w-full">
<p>Count: {count()}</p>
</div>
<div class="justify-center card-actions">
<button class="btn btn-primary grow" onClick={() => setCount((c) => c + 1)}>Count!</button>
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,5 @@
export default function TemperatureConverter() {
return (
<p>heh</p>
);
}

16
src/routes/[...404].tsx Normal file
View File

@@ -0,0 +1,16 @@
import { A } from "@solidjs/router";
export default function NotFound() {
return (
<main class="text-center mx-auto text-gray-700 p-4">
<h1 class="max-6-xs text-6xl text-sky-700 font-thin uppercase my-16">Not Found</h1>
<p class="mt-8">
Visit{" "}
<a href="https://solidjs.com" target="_blank" class="text-sky-600 hover:underline">
solidjs.com
</a>{" "}
to learn how to build Solid apps and compensate your <span class="font-bold">SKILL ISSUE</span>.
</p>
</main>
);
}

10
src/routes/index.tsx Normal file
View File

@@ -0,0 +1,10 @@
export default function Home() {
return (
<div class="card w-96 bg-base-100 card-md shadow-sm">
<div class="card-body">
<h2 class="card-title">Solid.js 7GUIs</h2>
<p>Select in the sidebar the exercise you want to see.</p>
</div>
</div>
);
}

19
tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"noEmit": true,
"strict": true,
"types": ["vinxi/types/client"],
"isolatedModules": true,
"paths": {
"~/*": ["./src/*"]
}
}
}