Skip to content

Commit 0d3a6d1

Browse files
committed
Fix formatting
1 parent 184451c commit 0d3a6d1

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

src/app.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
use std::rc::Rc;
12
use yew::prelude::*;
23
use yew_router::prelude::*;
3-
use std::rc::Rc;
44

5+
use crate::components::layout::Layout;
56
use crate::pages::blog::Blog;
7+
use crate::pages::contact::Contact;
68
use crate::pages::home::Home;
79
use crate::pages::projects::Projects;
8-
use crate::pages::contact::Contact;
9-
use crate::components::layout::Layout;
1010

1111
// Theme context
1212
#[derive(Clone, Debug, PartialEq)]
@@ -31,7 +31,10 @@ impl Reducible for ThemeState {
3131

3232
fn reduce(self: Rc<Self>, action: Self::Action) -> Rc<Self> {
3333
match action {
34-
ThemeAction::Toggle => Self { dark_mode: !self.dark_mode }.into(),
34+
ThemeAction::Toggle => Self {
35+
dark_mode: !self.dark_mode,
36+
}
37+
.into(),
3538
}
3639
}
3740
}
@@ -88,4 +91,4 @@ pub fn switch(route: Route) -> Html {
8891
Route::Contact => html! { <Contact /> },
8992
Route::NotFound => html! { <div class="not-found"><h1>{"404 - Not Found"}</h1></div> },
9093
}
91-
}
94+
}

src/components/layout.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// src/components/layout.rs
2-
use yew::prelude::*;
3-
use crate::components::nav::Nav;
4-
use crate::components::footer::Footer;
52
use crate::app::ThemeContext;
3+
use crate::components::footer::Footer;
4+
use crate::components::nav::Nav;
5+
use yew::prelude::*;
66

77
#[derive(Properties, PartialEq)]
88
pub struct LayoutProps {
@@ -24,4 +24,4 @@ pub fn layout(props: &LayoutProps) -> Html {
2424
<Footer />
2525
</div>
2626
}
27-
}
27+
}

src/components/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod darkmode;
22
pub mod footer;
33
pub mod header;
4-
pub(crate) mod nav;
54
pub(crate) mod layout;
5+
pub(crate) mod nav;

src/components/nav.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// src/components/nav.rs
2-
use yew::prelude::*;
3-
use yew_router::prelude::*;
42
use crate::app::{Route, ThemeContext};
5-
use web_sys::HtmlElement;
63
use gloo::events::EventListener;
4+
use web_sys::HtmlElement;
5+
use yew::prelude::*;
6+
use yew_router::prelude::*;
77

88
#[function_component(Nav)]
99
pub fn nav() -> Html {
@@ -35,10 +35,10 @@ pub fn nav() -> Html {
3535
let icon_transform = if *collapsed { "" } else { "rotate-180" };
3636

3737
html! {
38-
<div ref={nav_ref.clone()} class={classes!("sidebar", sidebar_width, "transition-all", "duration-300", "ease-in-out",
39-
"h-screen", "fixed", "top-0", "left-0", "z-40", "flex", "flex-col",
38+
<div ref={nav_ref.clone()} class={classes!("sidebar", sidebar_width, "transition-all", "duration-300", "ease-in-out",
39+
"h-screen", "fixed", "top-0", "left-0", "z-40", "flex", "flex-col",
4040
"bg-gray-800", "dark:bg-gray-900", "text-white", "shadow-lg")}>
41-
41+
4242
// Logo and collapse button
4343
<div class="flex items-center justify-between p-4 border-b border-gray-700">
4444
<div class={classes!("logo", if *collapsed { "hidden" } else { "" })}>
@@ -55,15 +55,15 @@ pub fn nav() -> Html {
5555
</svg>
5656
</button>
5757
</div>
58-
58+
5959
// Navigation menu
6060
<div class="flex flex-col flex-grow py-4 overflow-y-auto">
6161
{
6262
menu_items.into_iter().map(|(route, label, icon)| {
6363
let to = route.clone();
6464
html! {
6565
<Link<Route> to={to} classes={classes!(
66-
"flex", "items-center", "px-4", "py-3", "text-lg",
66+
"flex", "items-center", "px-4", "py-3", "text-lg",
6767
"hover:bg-gray-700", "transition-colors", "duration-200",
6868
"focus:outline-none", "focus:bg-gray-700",
6969
)}>
@@ -78,7 +78,7 @@ pub fn nav() -> Html {
7878
}).collect::<Html>()
7979
}
8080
</div>
81-
81+
8282
// Theme toggle and user section
8383
<div class="p-4 border-t border-gray-700">
8484
<button
@@ -100,4 +100,4 @@ pub fn nav() -> Html {
100100
</div>
101101
</div>
102102
}
103-
}
103+
}

src/pages/contact.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// src/pages/contact.rs
2-
use yew::prelude::*;
32
use crate::app::ThemeContext;
3+
use yew::prelude::*;
44

55
#[function_component(Contact)]
66
pub fn contact() -> Html {
@@ -9,29 +9,29 @@ pub fn contact() -> Html {
99
html! {
1010
<div class="page-container p-8 ml-64">
1111
<h1 class="text-3xl font-bold mb-6">{"Contact Me"}</h1>
12-
12+
1313
<div class="bg-white dark:bg-gray-800 shadow-md rounded-lg p-6">
1414
<form class="space-y-4">
1515
<div>
1616
<label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{"Name"}</label>
1717
<input type="text" id="name" name="name" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-700 dark:border-gray-600 dark:text-white" />
1818
</div>
19-
19+
2020
<div>
2121
<label for="email" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{"Email"}</label>
2222
<input type="email" id="email" name="email" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-700 dark:border-gray-600 dark:text-white" />
2323
</div>
24-
24+
2525
<div>
2626
<label for="message" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{"Message"}</label>
2727
<textarea id="message" name="message" rows="4" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-700 dark:border-gray-600 dark:text-white"></textarea>
2828
</div>
29-
29+
3030
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
3131
{"Send Message"}
3232
</button>
3333
</form>
3434
</div>
3535
</div>
3636
}
37-
}
37+
}

src/pages/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub mod blog;
2+
pub(crate) mod contact;
23
pub mod home;
34
pub mod projects;
4-
pub(crate) mod contact;
55

66
pub use home::Home;

0 commit comments

Comments
 (0)