增加基础应用结构。

This commit is contained in:
徐涛 2024-12-25 09:31:46 +08:00
parent ea5803ce7a
commit 97773db59e
4 changed files with 38 additions and 73 deletions

View File

@ -1,42 +0,0 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}

View File

@ -1,35 +1,14 @@
import { useState } from 'react' import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import reactLogo from './assets/react.svg' import { Notifications } from './components/Notifications';
import viteLogo from '/vite.svg' import { MainLayout } from './pages/MainLayout';
import './App.css'
function App() { const routes = createBrowserRouter([{ path: '/', element: <MainLayout /> }]);
const [count, setCount] = useState(0)
export function App() {
return ( return (
<> <Notifications>
<div> <title>Color Lab</title>
<a href="https://vite.dev" target="_blank"> <RouterProvider router={routes}></RouterProvider>
<img src={viteLogo} className="logo" alt="Vite logo" /> </Notifications>
</a> );
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
} }
export default App

View File

@ -0,0 +1,14 @@
@layer pages {
.main_layout {
height: 100%;
width: 100%;
overflow: hidden;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: stretch;
}
.content {
flex: 1 0;
}
}

14
src/pages/MainLayout.tsx Normal file
View File

@ -0,0 +1,14 @@
import { Outlet } from 'react-router-dom';
import { NavigationMenu } from '../page-components/navigation/NavigationMenu';
import styles from './MainLayout.module.css';
export function MainLayout() {
return (
<div className={styles.main_layout}>
<NavigationMenu />
<div className={styles.content}>
<Outlet />
</div>
</div>
);
}