Basic page

This commit is contained in:
Luke Harding 2024-05-05 16:20:49 -04:00
parent b97e6ed468
commit 21c43715ce
3 changed files with 43 additions and 16 deletions

View File

@ -1,8 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8"/>
<title>Trunk Template</title> <meta content="width=device-width, initial-scale=1" name="viewport">
<title>Personal Tracker</title>
<link data-trunk href="index.scss" rel="scss">
</head> </head>
<body></body> <body>
<noscript>Javascript is required to use this website.</noscript>
</body>
</html> </html>

27
client/index.scss Normal file
View File

@ -0,0 +1,27 @@
html, body {
margin: 0;
height: 100%;
}
#container {
height: 100%;
display: flex;
flex-direction: column;
}
header {
text-align: center;
}
header > h1 {
margin: 0;
}
main {
flex: 1;
}
footer {
text-align: center;
}

View File

@ -2,23 +2,19 @@ use yew::prelude::*;
#[function_component] #[function_component]
fn App() -> Html { fn App() -> Html {
let counter = use_state(|| 0);
let onclick = {
let counter = counter.clone();
move |_| {
let value = *counter + 2;
counter.set(value);
}
};
html! { html! {
<div> <div id="container">
<button {onclick}>{ "+1" }</button> <header>
<p>{ *counter }</p> <h1>{ "Personal Tracker" }</h1>
</header>
<main>
<p>{ "Main" }</p>
</main>
<footer>{ "Personal Tracker v1" }</footer>
</div> </div>
} }
} }
fn main() { fn main() {
yew::Renderer::<App>::new().render(); yew::Renderer::<App>::new().render();
} }