Restructuring for better layout and code reuse

This commit is contained in:
April Eaton 2026-01-12 17:41:57 +01:00
parent 7294793125
commit e85d93270b
Signed by: AprilEaton
GPG key ID: 0BCF829D48AE5C9D
6 changed files with 73 additions and 36 deletions

View file

@ -39,12 +39,29 @@
} }
html { html {
display: flex;
align-items: center;
justify-content: center;
} }
body { body {
height: 100%; min-height: 100svh;
width: 100%; height: fit-content;
display: flex;
flex-direction: column;
align-items: center;
margin: 0;
}
#app {
height: 100%;
min-width: 100%;
display: flex;
flex-direction: column;
align-items: center;
align-content: center;
justify-content: center;
}
#body {
max-width: 40rem;
width: 100%;
height: 100%;
} }

View file

@ -1,8 +1,14 @@
header { header {
--margin: 0.25rem;
--padding: 0.25rem;
border-width: 2px; border-width: 2px;
border-style: solid; border-style: solid;
position: sticky top; position: sticky;
margin: var(--margin);
padding: var(--padding);
width: calc(100% - (2 * var(--margin)) - (2 * var(--padding)) - 4px);
} }
nav { nav {

View file

@ -1,16 +1,15 @@
import { Header } from "/src/components/header"; import { Page } from "/src/pages/page";
import "/src/App.css"; import "/src/App.css";
export function About() { export function About() {
return ( return (
<> <Page>
<Header />
<h1>About Starve Me Now!</h1> <h1>About Starve Me Now!</h1>
<p> <p>
Firstly, this is intended for those who have a starvation/diet control Firstly, this is intended for those who have a starvation/diet control
fetish. This is <b>not</b> intended to help with weight loss or similar fetish. This is <b>not</b> intended to help with weight loss or similar
reasons to fast. reasons to fast.
</p> </p>
</> </Page>
); );
} }

11
client/src/pages/page.tsx Normal file
View file

@ -0,0 +1,11 @@
import { Header } from "@/components/header";
import "@/App.css";
export function Page(props: { children: React.ReactNode }) {
return (
<>
<Header />
<article id="body">{props.children}</article>
</>
);
}

View file

@ -1,14 +1,13 @@
import { Header } from "/src/components/header"; import { Page } from "/src/pages/page";
import "/src/App.css"; import "/src/App.css";
export function Root() { export function Root() {
return ( return (
<> <Page>
<Header />
<h1>Starve Me Now!</h1> <h1>Starve Me Now!</h1>
<p> <p>
Edit <code>src/App.tsx</code> to get started! Edit <code>src/App.tsx</code> to get started!
</p> </p>
</> </Page>
); );
} }

View file

@ -1,29 +1,34 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */ /* Visit https://aka.ms/tsconfig to read more about this file */
"target": "ES2020", "target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx", "jsx": "react-jsx",
"useDefineForClassFields": true, "useDefineForClassFields": true,
/* Modules */ /* Modules */
"module": "ESNext", "module": "ESNext",
"moduleResolution": "bundler", "moduleResolution": "bundler",
/* Emit */ /* Emit */
"noEmit": true, "noEmit": true,
/* Interop Constraints */ /* Interop Constraints */
"isolatedModules": true, "isolatedModules": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
/* Type Checking */ /* Type Checking */
"strict": true, "strict": true,
/* Completeness */ /* Completeness */
"skipLibCheck": true "skipLibCheck": true,
}
"baseUrl": "./src",
"paths": {
"@/*": ["*"]
}
}
} }