Skip to content

Commit 5518528

Browse files
committed
chore: implement css fixture
1 parent 297cf1c commit 5518528

34 files changed

+925
-1578
lines changed

apps/fixtures/css/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SolidStart
2+
3+
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);
4+
5+
## Creating a project
6+
7+
```bash
8+
# create a new project in the current directory
9+
npm init solid@latest
10+
11+
# create a new project in my-app
12+
npm init solid@latest my-app
13+
```
14+
15+
## Developing
16+
17+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
18+
19+
```bash
20+
npm run dev
21+
22+
# or start the server and open the app in a new browser tab
23+
npm run dev -- --open
24+
```
25+
26+
## Building
27+
28+
Solid apps are built with _presets_, which optimise your project for deployment to different environments.
29+
30+
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`.

apps/fixtures/css/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "fixture-css",
3+
"type": "module",
4+
"scripts": {
5+
"dev": "vite dev",
6+
"build": "vite build",
7+
"start": "node .output/server/index.mjs"
8+
},
9+
"dependencies": {
10+
"@solidjs/meta": "^0.29.4",
11+
"@solidjs/router": "^0.15.0",
12+
"@solidjs/start": "workspace:*",
13+
"solid-js": "^1.9.9",
14+
"vite": "7.1.10"
15+
},
16+
"engines": {
17+
"node": ">=22"
18+
},
19+
"devDependencies": {
20+
"@tailwindcss/vite": "^4.1.12",
21+
"tailwindcss": "^4.1.12"
22+
}
23+
}
664 Bytes
Binary file not shown.

apps/fixtures/css/src/app.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@import "tailwindcss";
2+
3+
@theme {
4+
--color-success: var(--color-emerald-700);
5+
--color-error: var(--color-rose-700);
6+
--color-warn: var(--color-orange-500);
7+
}
8+
9+
@layer base {
10+
body {
11+
@apply bg-gray-800 text-gray-100;
12+
}
13+
14+
a {
15+
@apply text-sky-400 underline underline-offset-4 hover:no-underline;
16+
}
17+
18+
h1 {
19+
@apply text-2xl font-bold;
20+
}
21+
}

apps/fixtures/css/src/app.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { MetaProvider, Title } from "@solidjs/meta";
2+
import { Router } from "@solidjs/router";
3+
import { FileRoutes } from "@solidjs/start/router";
4+
import { Suspense } from "solid-js";
5+
import "./app.css";
6+
7+
export default function App() {
8+
return (
9+
<Router
10+
root={props => (
11+
<MetaProvider>
12+
<Title>SolidStart - CSS Fixture</Title>
13+
<div class="mx-auto max-w-5xl p-10 pt-3">
14+
<header class="flex gap-3 mb-4">
15+
<a href="/">Index</a>
16+
<a href="/empty">Empty</a>
17+
<a href="/unstyled">Unstyled</a>
18+
</header>
19+
20+
<Suspense>{props.children}</Suspense>
21+
</div>
22+
</MetaProvider>
23+
)}
24+
>
25+
<FileRoutes />
26+
</Router>
27+
);
28+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { createSignal, FlowProps, onMount } from "solid-js";
2+
import { getRequestEvent } from "solid-js/web";
3+
4+
const Badge = (props: FlowProps) => (
5+
<div class="text-base text-white bg-gray-700 rounded-lg px-2 font-medium">{props.children}</div>
6+
);
7+
8+
const Layout = (props: FlowProps<{ title: string }>) => {
9+
const [mounted, setMounted] = createSignal(false);
10+
onMount(() => setMounted(true));
11+
12+
return (
13+
<div class="flex gap-2 flex-col">
14+
<div class="flex items-center gap-2 flex-wrap">
15+
<h1>{props.title}</h1>
16+
<Badge>Environment: {import.meta.env.DEV ? "DEV" : "PROD"}</Badge>
17+
<Badge>Rendered: {!mounted() ? "Server" : "Server & Client"}</Badge>
18+
</div>
19+
20+
<div class="text-gray-500 text-sm font-medium">
21+
Agent:{" "}
22+
<span class="text-xs">
23+
{getRequestEvent()?.request.headers.get("user-agent") ?? navigator.userAgent}
24+
</span>
25+
</div>
26+
27+
<ul class="list-inside list-disc mb-4 text-gray-400 font-semibold text-xs">
28+
<li>
29+
Enable throttling & disable cache in the network tab to see eventual frames of unstyled
30+
content
31+
</li>
32+
<li>Click on routes to test client navigation</li>
33+
</ul>
34+
35+
<div class="grid grid-cols-[repeat(5,auto)] gap-4 gap-y-2">
36+
<div class="grid col-span-full grid-cols-subgrid px-4 text-gray-400 text-sm">
37+
<div>Component</div>
38+
<div>File</div>
39+
<div>Integration</div>
40+
<div>Lazy</div>
41+
<div>Comments</div>
42+
</div>
43+
44+
{props.children}
45+
</div>
46+
47+
<div class="flex justify-end gap-2 items-center text-sm uppercase font-bold text-white">
48+
<div class="grid content-center rounded-lg bg-success px-2">pass</div>
49+
<div class="grid content-center rounded-lg bg-error px-2">fail</div>
50+
<div class="grid content-center rounded-lg bg-warn px-2">not supported</div>
51+
</div>
52+
</div>
53+
);
54+
};
55+
56+
export default Layout;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import "../styles/lazy.css";
2+
3+
const Lazy = () => {
4+
return <></>
5+
}
6+
7+
export default Lazy;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import url from "../styles/lazyLink.css?url";
2+
3+
const Lazy = () => <link rel="stylesheet" href={url} />
4+
5+
export default Lazy;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import url from "../styles/lazyLinkTmp.css?url";
2+
3+
const Lazy = () => <link rel="stylesheet" href={url} />
4+
5+
export default Lazy;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { mountAssets } from "@solidjs/start/client";
2+
import url from "../styles/lazyMountAssets.css?url";
3+
4+
const Lazy = () => {
5+
mountAssets([
6+
{
7+
tag: "link",
8+
attrs: {
9+
href: url,
10+
rel: "stylesheet"
11+
}
12+
}
13+
]);
14+
15+
return <></>
16+
}
17+
18+
export default Lazy;

0 commit comments

Comments
 (0)