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
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>
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue