basic routing, <Nav> component
This commit is contained in:
parent
ae1193e6ce
commit
0620207877
19
src/app.rs
19
src/app.rs
@ -5,7 +5,17 @@ use leptos_router::{
|
|||||||
StaticSegment, WildcardSegment,
|
StaticSegment, WildcardSegment,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{ prelude::*, components::{ sidebar::Sidebar, header::Header, Dash } };
|
use crate::{
|
||||||
|
components::{
|
||||||
|
header::Header,
|
||||||
|
nav::Nav,
|
||||||
|
sidebar::Sidebar,
|
||||||
|
Character,
|
||||||
|
Inventories,
|
||||||
|
Wiki
|
||||||
|
},
|
||||||
|
prelude::*
|
||||||
|
};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn App() -> impl IntoView {
|
pub fn App() -> impl IntoView {
|
||||||
@ -20,7 +30,7 @@ pub fn App() -> impl IntoView {
|
|||||||
<Stylesheet id="leptos" href="/pkg/aex.css"/>
|
<Stylesheet id="leptos" href="/pkg/aex.css"/>
|
||||||
|
|
||||||
// sets the document title
|
// sets the document title
|
||||||
<Title text="Welcome to Leptos"/>
|
<Title text="aex"/>
|
||||||
|
|
||||||
// content for this welcome page
|
// content for this welcome page
|
||||||
<Router>
|
<Router>
|
||||||
@ -28,8 +38,11 @@ pub fn App() -> impl IntoView {
|
|||||||
<Header />
|
<Header />
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
<main>
|
<main>
|
||||||
|
<Nav />
|
||||||
<Routes fallback=move || "Not found.">
|
<Routes fallback=move || "Not found.">
|
||||||
<Route path=StaticSegment("") view=Dash/>
|
<Route path=StaticSegment("") view=Character/>
|
||||||
|
<Route path=StaticSegment("inv") view=Inventories/>
|
||||||
|
<Route path=StaticSegment("wiki") view=Wiki />
|
||||||
<Route path=WildcardSegment("any") view=NotFound/>
|
<Route path=WildcardSegment("any") view=NotFound/>
|
||||||
</Routes>
|
</Routes>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@ -6,13 +6,28 @@ use crate::prelude::*;
|
|||||||
|
|
||||||
pub mod header;
|
pub mod header;
|
||||||
pub mod sidebar;
|
pub mod sidebar;
|
||||||
|
pub mod nav;
|
||||||
pub mod numput;
|
pub mod numput;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Dash () -> impl IntoView {
|
pub fn Character () -> impl IntoView {
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
main
|
character
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Inventories () -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="inventories">
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Wiki () -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
books
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
src/components/nav.rs
Normal file
14
src/components/nav.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
use crate::prelude::*;
|
||||||
|
use leptos::prelude::*;
|
||||||
|
use leptos_router::components::A;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn Nav () -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<nav class="main-nav">
|
||||||
|
<A href="/">Персонаж</A>
|
||||||
|
<A href="/inv">Инвентарь</A>
|
||||||
|
<A href="/wiki">Информация</A>
|
||||||
|
</nav>
|
||||||
|
}
|
||||||
|
}
|
||||||
17
style/_nav.scss
Normal file
17
style/_nav.scss
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
@use 'mixins';
|
||||||
|
|
||||||
|
nav.main-nav {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
a {
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin: 30px;
|
||||||
|
color: white;
|
||||||
|
transition: border-bottom-width .1s ease;
|
||||||
|
&[aria-current="page"], &:hover {
|
||||||
|
border-bottom: 3px solid crimson;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: border-bottom-width .1s ease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,9 +1,10 @@
|
|||||||
@use 'sass:list';
|
@use 'sass:list';
|
||||||
|
|
||||||
@use 'mixins';
|
|
||||||
@use 'reset';
|
@use 'reset';
|
||||||
|
@use 'mixins';
|
||||||
@use 'header';
|
@use 'header';
|
||||||
@use 'sidebar';
|
@use 'sidebar';
|
||||||
|
@use 'nav';
|
||||||
@use 'vars';
|
@use 'vars';
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@ -53,6 +54,8 @@ main {
|
|||||||
z-index: 8;
|
z-index: 8;
|
||||||
grid-row: 2/3;
|
grid-row: 2/3;
|
||||||
grid-column: 2/3;
|
grid-column: 2/3;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user