Skip to content

Commit

Permalink
docs: add solid-router basic example
Browse files Browse the repository at this point in the history
  • Loading branch information
oedotme committed Nov 5, 2022
1 parent 43ddea4 commit ec47881
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/solid-router/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
13 changes: 13 additions & 0 deletions examples/solid-router/basic/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Generouted - Basic example</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions examples/solid-router/basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "basic",
"version": "1.0.0",
"description": "Generated file-based routes for Solid Router and Vite basic example",
"author": "Omar Elhawary <[email protected]> (https://omarelhawary.me)",
"license": "MIT",
"scripts": {
"dev": "vite dev --port 3000",
"build": "vite build"
},
"dependencies": {
"@solidjs/router": "^0.5.0",
"generouted": "workspace:*",
"solid-js": "^1.6.1"
},
"devDependencies": {
"typescript": "^4.8.3",
"vite": "^3.1.2",
"vite-plugin-solid": "^2.3.10"
}
}
4 changes: 4 additions & 0 deletions examples/solid-router/basic/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { render } from 'solid-js/web'
import { Routes } from 'generouted/solid-router'

render(Routes, document.getElementById('app') as HTMLElement)
3 changes: 3 additions & 0 deletions examples/solid-router/basic/src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function NotFound() {
return <h1>404</h1>
}
15 changes: 15 additions & 0 deletions examples/solid-router/basic/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ParentProps } from 'solid-js'
import { A } from '@solidjs/router'

export default function App(props: ParentProps) {
return (
<section style={{ margin: '24px' }}>
<header style={{ display: 'flex', gap: '24px' }}>
<A href="/">Home</A>
<A href="/about">About</A>
</header>

<main>{props.children}</main>
</section>
)
}
3 changes: 3 additions & 0 deletions examples/solid-router/basic/src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function About() {
return <h1>About - Basic</h1>
}
3 changes: 3 additions & 0 deletions examples/solid-router/basic/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Home() {
return <h1>Home - Basic</h1>
}
21 changes: 21 additions & 0 deletions examples/solid-router/basic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "es2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"types": ["vite/client"]
},
"include": ["./src"]
}
4 changes: 4 additions & 0 deletions examples/solid-router/basic/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defineConfig } from 'vite'
import solid from 'vite-plugin-solid'

export default defineConfig({ plugins: [solid()] })
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
packages:
- examples/react-location/*
- examples/react-router/*
- examples/solid-router/*

0 comments on commit ec47881

Please sign in to comment.