Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
style: revert formatting back to standard
Browse files Browse the repository at this point in the history
  • Loading branch information
mazziechai committed Mar 27, 2024
1 parent 034ff4e commit 2cb5291
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 79 deletions.
1 change: 0 additions & 1 deletion rustfmt.toml

This file was deleted.

20 changes: 10 additions & 10 deletions src/components/counter_btn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use leptos::*;
/// A parameterized incrementing button
#[component]
pub fn Button(#[prop(default = 1)] increment: i32) -> impl IntoView {
let (count, set_count) = create_signal(0);
view! {
<button
on:click= move |_| {
set_count(count() + increment)
}
>
"Click me: " {count}
</button>
}
let (count, set_count) = create_signal(0);
view! {
<button
on:click= move |_| {
set_count(count() + increment)
}
>
"Click me: " {count}
</button>
}
}
30 changes: 15 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ mod pages;
/// An app router which renders the homepage and handles 404's
#[component]
pub fn App() -> impl IntoView {
// Provides context that manages stylesheets, titles, meta tags, etc.
provide_meta_context();
// Provides context that manages stylesheets, titles, meta tags, etc.
provide_meta_context();

view! {
<Html lang="en" dir="ltr" attr:data-theme="light"/>
view! {
<Html lang="en" dir="ltr" attr:data-theme="light"/>

// sets the document title
<Title text="Welcome to Leptos CSR"/>
// sets the document title
<Title text="Welcome to Leptos CSR"/>

// injects metadata in the <head> of the page
<Meta charset="UTF-8"/>
<Meta name="viewport" content="width=device-width, initial-scale=1.0"/>
// injects metadata in the <head> of the page
<Meta charset="UTF-8"/>
<Meta name="viewport" content="width=device-width, initial-scale=1.0"/>

<Router>
<Routes>
<Route path="/" view=Home/>
</Routes>
</Router>
}
<Router>
<Routes>
<Route path="/" view=Home/>
</Routes>
</Router>
}
}
16 changes: 8 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use leptos::*;
use nova_playground::App;

fn main() {
// set up logging
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
// set up logging
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();

mount_to_body(|| {
view! {
<App />
}
})
mount_to_body(|| {
view! {
<App />
}
})
}
90 changes: 45 additions & 45 deletions src/pages/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,49 @@ use crate::components::counter_btn::Button;
/// Default Home Page
#[component]
pub fn Home() -> impl IntoView {
view! {
<ErrorBoundary fallback=|errors| {
view! {
<h1>"Uh oh! Something went wrong!"</h1>

<p>"Errors: "</p>
// Render a list of errors as strings - good for development purposes
<ul>
{move || {
errors
.get()
.into_iter()
.map(|(_, e)| view! { <li>{e.to_string()}</li> })
.collect_view()
}}

</ul>
}
}>

<div class="container">

<picture>
<source
srcset="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_pref_dark_RGB.svg"
media="(prefers-color-scheme: dark)"
/>
<img
src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg"
alt="Leptos Logo"
height="200"
width="400"
/>
</picture>

<h1>"Welcome to Leptos"</h1>

<div class="buttons">
<Button/>
<Button increment=5/>
</div>

</div>
</ErrorBoundary>
}
view! {
<ErrorBoundary fallback=|errors| {
view! {
<h1>"Uh oh! Something went wrong!"</h1>

<p>"Errors: "</p>
// Render a list of errors as strings - good for development purposes
<ul>
{move || {
errors
.get()
.into_iter()
.map(|(_, e)| view! { <li>{e.to_string()}</li> })
.collect_view()
}}

</ul>
}
}>

<div class="container">

<picture>
<source
srcset="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_pref_dark_RGB.svg"
media="(prefers-color-scheme: dark)"
/>
<img
src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg"
alt="Leptos Logo"
height="200"
width="400"
/>
</picture>

<h1>"Welcome to Leptos"</h1>

<div class="buttons">
<Button/>
<Button increment=5/>
</div>

</div>
</ErrorBoundary>
}
}

0 comments on commit 2cb5291

Please sign in to comment.