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:
5
web/src/components/layout/PageContainer.tsx
Normal file
5
web/src/components/layout/PageContainer.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export default function PageContainer({ children }: { children: ReactNode }) {
|
||||
return <main className="page-container">{children}</main>;
|
||||
}
|
||||
32
web/src/components/layout/TopBar.tsx
Normal file
32
web/src/components/layout/TopBar.tsx
Normal 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)}>
|
||||
←
|
||||
</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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user