feat(web): set up React app shell with routing and layout

Adds react-router-dom with routes for ship list, dashboard, and rules pages.
Includes TopBar with navigation and mobile-first dark theme CSS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bas van Rossem
2026-02-19 16:20:22 +01:00
parent 76ad839abb
commit 5f275bfcc7
7 changed files with 182 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
import type { ReactNode } from 'react';
export default function PageContainer({ children }: { children: ReactNode }) {
return <main className="page-container">{children}</main>;
}

View File

@@ -0,0 +1,32 @@
import { useNavigate, useLocation } from 'react-router-dom';
export default function TopBar({ title }: { title?: string }) {
const navigate = useNavigate();
const location = useLocation();
const isHome = location.pathname === '/';
return (
<header className="top-bar">
<div className="top-bar-left">
{!isHome && (
<button className="top-bar-back" onClick={() => navigate(-1)}>
&larr;
</button>
)}
<h1 className="top-bar-title">{title || 'Spelljammer'}</h1>
</div>
<nav className="top-bar-right">
{location.pathname !== '/rules' && (
<button className="top-bar-link" onClick={() => navigate('/rules')}>
Rules
</button>
)}
{!isHome && location.pathname !== '/rules' && (
<button className="top-bar-link" onClick={() => navigate('/')}>
Ships
</button>
)}
</nav>
</header>
);
}