feat(chess): scaffold Vite + React app (P3.9)
This commit is contained in:
parent
8436df7986
commit
0f891fa013
6 changed files with 90 additions and 1 deletions
12
packages/chess/index.html
Normal file
12
packages/chess/index.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Chess App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/app/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -8,7 +8,10 @@
|
|||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@paratype/rete": "workspace:*"
|
||||
"@paratype/rete": "workspace:*",
|
||||
"@tailwindcss/vite": "^4.2.2",
|
||||
"react-router-dom": "^7.14.1",
|
||||
"tailwindcss": "^4.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^6.0.0",
|
||||
|
|
|
|||
46
packages/chess/src/app/App.tsx
Normal file
46
packages/chess/src/app/App.tsx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { Routes, Route } from 'react-router-dom'
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<div data-testid="app-root">
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/game" element={<Game />} />
|
||||
<Route path="/rules" element={<Rules />} />
|
||||
<Route path="/save" element={<Save />} />
|
||||
</Routes>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function Home() {
|
||||
return (
|
||||
<main data-testid="page-home">
|
||||
<h1>Home</h1>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
function Game() {
|
||||
return (
|
||||
<main data-testid="page-game">
|
||||
<h1>Game</h1>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
function Rules() {
|
||||
return (
|
||||
<main data-testid="page-rules">
|
||||
<h1>Rules</h1>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
function Save() {
|
||||
return (
|
||||
<main data-testid="page-save">
|
||||
<h1>Save</h1>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
1
packages/chess/src/app/index.css
Normal file
1
packages/chess/src/app/index.css
Normal file
|
|
@ -0,0 +1 @@
|
|||
@import "tailwindcss";
|
||||
17
packages/chess/src/app/main.tsx
Normal file
17
packages/chess/src/app/main.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import './index.css'
|
||||
import { App } from './App'
|
||||
|
||||
const container = document.getElementById('root')
|
||||
if (!container) throw new Error('Failed to find the root element')
|
||||
|
||||
const root = createRoot(container)
|
||||
root.render(
|
||||
<StrictMode>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</StrictMode>
|
||||
)
|
||||
10
packages/chess/vite.config.ts
Normal file
10
packages/chess/vite.config.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
tailwindcss(),
|
||||
react()
|
||||
],
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue