feat(web): togglable menu, footer

This commit is contained in:
əlemi 2024-04-17 05:39:45 +02:00
parent 663cea79ad
commit a83b557513
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 35 additions and 19 deletions

View file

@ -19,16 +19,33 @@
} }
body { body {
margin: 0; margin: 0;
padding-bottom: 1.2em;
} }
nav { nav {
top: 0; top: 0;
position: sticky; position: sticky;
background-color: var(--background);
padding-top: .05em; padding-top: .05em;
background-color: var(--background);
} }
hr.nav { footer {
width: 100%;
position: fixed;
bottom: 0;
background-color: var(--background);
text-align: center;
padding-bottom: 0;
line-height: 1rem;
}
span.footer {
padding: .1em;
font-size: .6em;
color: var(--secondary);
}
hr.sep {
margin-top: 0; margin-top: 0;
padding-top: 0; padding-top: 0;
margin-bottom: 0;
padding-bottom: 0;
border: 1px solid #bf616a70; border: 1px solid #bf616a70;
top: 1.65rem; top: 1.65rem;
position: sticky; position: sticky;
@ -36,8 +53,8 @@
div.sticky { div.sticky {
top: 4em; top: 4em;
position: sticky; position: sticky;
background-color: var(--background);
} }
.hidden { display: none; }
a.upub-title { a.upub-title {
color: var(--primary); color: var(--primary);
text-decoration: none; text-decoration: none;
@ -53,8 +70,6 @@
max-height: 2em; max-height: 2em;
border-radius: 50%; border-radius: 50%;
} }
div.boxscroll {
}
div.tl-header { div.tl-header {
background-color: #bf616a55; background-color: #bf616a55;
color: #bf616a; color: #bf616a;
@ -62,20 +77,13 @@
table.post-table { table.post-table {
border-collapse: collapse; border-collapse: collapse;
} }
tr.post-table { table p {
border: 1px dashed #bf616a; margin: .5em;
} }
tr.post-table,
td.post-table { td.post-table {
border: 1px dashed #bf616a; border: 1px dashed #bf616a;
} }
@media screen and (max-width: 786px) {
div.boxscroll {
max-height: 100%;
}
}
table.align {
line-height: 1rem;
}
td.top { td.top {
vertical-align: top; vertical-align: top;
} }

View file

@ -17,6 +17,8 @@ fn main() {
let home_tl = Timeline::new(format!("{URL_BASE}/users/{}/inbox/page", username.get().unwrap_or_default())); let home_tl = Timeline::new(format!("{URL_BASE}/users/{}/inbox/page", username.get().unwrap_or_default()));
let server_tl = Timeline::new(format!("{URL_BASE}/inbox/page")); let server_tl = Timeline::new(format!("{URL_BASE}/inbox/page"));
let (menu, set_menu) = create_signal(false);
spawn_local(async move { spawn_local(async move {
if let Err(e) = server_tl.more(cookie).await { if let Err(e) = server_tl.more(cookie).await {
console_error(&format!("error populating timeline: {e}")); console_error(&format!("error populating timeline: {e}"));
@ -37,9 +39,9 @@ fn main() {
<code class="color ml-3" ><a class="upub-title" href=move || if cookie.get().present() { "/web/home" } else { "/web/server" } >μpub</a></code> <code class="color ml-3" ><a class="upub-title" href=move || if cookie.get().present() { "/web/home" } else { "/web/server" } >μpub</a></code>
<small class="ml-1 mr-1" ><a class="clean" href="/web/server" >micro social network, federated</a></small> <small class="ml-1 mr-1" ><a class="clean" href="/web/server" >micro social network, federated</a></small>
/* TODO kinda jank with the float but whatever, will do for now */ /* TODO kinda jank with the float but whatever, will do for now */
<small class="mr-1" style="float: right" ><a href="https://git.alemi.dev/upub.git" >src</a></small> <input type="submit" class="mr-2 rev" on:click=move |_| set_menu.set(!menu.get()) value="menu" style="float: right" />
</nav> </nav>
<hr class="nav" /> <hr class="sep" />
<div class="container mt-2 pt-2" > <div class="container mt-2 pt-2" >
<Router // TODO maybe set base="/web" ? <Router // TODO maybe set base="/web" ?
trailing_slash=TrailingSlash::Redirect trailing_slash=TrailingSlash::Redirect
@ -58,7 +60,7 @@ fn main() {
view! { view! {
<main> <main>
<div class="two-col" > <div class="two-col" >
<div class="col-side sticky" > <div class="col-side sticky" class:hidden=move || menu.get() >
<LoginBox <LoginBox
token_tx=set_cookie token_tx=set_cookie
token=cookie token=cookie
@ -71,7 +73,7 @@ fn main() {
<hr class="mt-1 mb-1" /> <hr class="mt-1 mb-1" />
<PostBox /> <PostBox />
</div> </div>
<div class="col-main" > <div class="col-main" class:w-100=move || menu.get() >
<Routes> <Routes>
<Route path="/web" view=About /> <Route path="/web" view=About />
@ -90,6 +92,12 @@ fn main() {
}} }}
</Router> </Router>
</div> </div>
<footer>
<div>
<hr class="sep" />
<span class="footer" >"\u{26fc} woven under moonlight :: "<a href="https://git.alemi.dev/upub.git" target="_blank" >src</a>" :: wip by alemi "</span>
</div>
</footer>
} }
); );
} }