-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alvin Januar
committed
Sep 16, 2024
1 parent
b3001fd
commit d4e6da8
Showing
11 changed files
with
184 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub mod badge; | ||
pub mod input; | ||
pub mod switch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use leptos::*; | ||
|
||
#[component] | ||
pub fn Badge(children: Children) -> impl IntoView { | ||
view! { | ||
<div class="inline-flex items-center py-0.5 px-2.5 text-xs font-semibold text-black bg-white rounded-full border transition-colors hover:bg-gray-300 focus:ring-2 focus:ring-offset-2 focus:outline-none focus:ring-ring"> | ||
{children()} | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use leptos::*; | ||
|
||
#[component] | ||
pub fn Input() -> impl IntoView { | ||
view! { | ||
<input | ||
class="flex py-2 px-3 w-full h-10 text-sm rounded-md border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:opacity-50 disabled:cursor-not-allowed border-zinc-800 bg-zinc-950 ring-offset-zinc-950 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-white placeholder:text-muted-white focus-visible:ring-ring" | ||
placeholder="placeholder" | ||
/> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use leptos::*; | ||
|
||
#[component] | ||
pub fn Switch() -> impl IntoView { | ||
let (checked, set_checked) = create_signal(false); | ||
let state = create_memo(move |_| if checked() { "checked" } else { "unchecked" }); | ||
|
||
view! { | ||
<button | ||
data-state=state | ||
class="inline-flex items-center w-11 h-6 rounded-full border-2 border-transparent transition-colors cursor-pointer focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:opacity-50 disabled:cursor-not-allowed peer shrink-0 data-[state=checked]:bg-white data-[state=unchecked]:bg-zinc-800 focus-visible:ring-ring focus-visible:ring-offset-background" | ||
on:click=move |_| set_checked.set(!checked()) | ||
> | ||
<span | ||
data-state=state | ||
class="block w-5 h-5 bg-black rounded-full ring-0 shadow-lg transition-transform pointer-events-none data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0" | ||
/> | ||
</button> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
use leptos::*; | ||
|
||
use crate::ui::components::badge::Badge; | ||
use crate::ui::components::input::Input; | ||
use crate::ui::components::switch::Switch; | ||
|
||
/// Renders the home page of your application. | ||
#[component] | ||
pub fn MailPage() -> impl IntoView { | ||
// Creates a reactive value to update the button | ||
let (count, _set_count) = create_signal(50.00); | ||
|
||
view! { | ||
<div class="bg-black"> | ||
<ProgressNav progress=count /> | ||
<div class="flex items-center text-white"> | ||
<div class="flex flex-col py-3 ml-5 h-screen border-white w-[600px] border-x"> | ||
<div class="px-3"> | ||
<Input /> | ||
</div> | ||
<div class="relative my-1"> | ||
<div class="absolute left-0 -translate-x-1/2"> | ||
<Badge>8</Badge> | ||
</div> | ||
<div class="absolute right-0 translate-x-1/2"> | ||
<Switch /> | ||
</div> | ||
<hr class="mt-2.5 w-full border-zinc-800 box-border" /> | ||
</div> | ||
<div class="flex overflow-y-auto flex-col gap-y-3 px-3 pt-3 w-full"> | ||
<Card /> | ||
<Card /> | ||
<Card /> | ||
<Card /> | ||
<Card /> | ||
</div> | ||
</div> | ||
<div class="flex flex-col flex-grow py-6 px-8 h-screen"> | ||
<h1 class="text-2xl font-semibold">Teset Smith</h1> | ||
<p>[UPDATED] Need help ASAP</p> | ||
<div class="flex justify-between"> | ||
<Badge>badge</Badge> | ||
<div class="text-zinc-400">01:16 am</div> | ||
</div> | ||
<hr class="my-2.5 w-full border-zinc-800 box-border" /> | ||
<p class="overflow-y-hidden text-base"> | ||
Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click. | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
} | ||
|
||
#[component] | ||
fn ProgressNav(progress: ReadSignal<f64>) -> impl IntoView { | ||
let percentage = move || progress() / 100.0; | ||
view! { | ||
<div class="fixed top-0 right-0 left-0 h-0.5"> | ||
<div | ||
class="w-full h-px bg-white transition-all origin-left" | ||
style:transform=move || format!("scaleX({})", percentage()) | ||
/> | ||
</div> | ||
} | ||
} | ||
|
||
#[component] | ||
fn Card() -> impl IntoView { | ||
view! { | ||
<div class="flex flex-col gap-y-1.5 p-6 rounded-lg border bg-zinc-950 border-zinc-800"> | ||
<h1 class="text-2xl font-semibold">Teset Smith</h1> | ||
<p>[UPDATED] Need help ASAP</p> | ||
<p class="overflow-y-hidden text-base text-zinc-400 h-[2lh] text-ellipsis line-clamp-2"> | ||
Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click.Deploy your new project in one-click. | ||
</p> | ||
<hr class="my-2.5 w-full border-zinc-800 box-border" /> | ||
<div class="flex justify-between"> | ||
<Badge>badge</Badge> | ||
<div class="text-zinc-400">01:16 am</div> | ||
</div> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::error_template::{AppError, ErrorTemplate}; | ||
use leptos::*; | ||
use leptos_meta::*; | ||
use leptos_router::*; | ||
|
||
pub mod home; | ||
use crate::ui::home::HomePage; | ||
pub mod mail; | ||
use crate::ui::mail::MailPage; | ||
pub mod components; | ||
|
||
#[component] | ||
pub fn Ui() -> impl IntoView { | ||
// Provides context that manages stylesheets, titles, meta tags, etc. | ||
provide_meta_context(); | ||
|
||
view! { | ||
<Stylesheet id="leptos" href="/pkg/supermailer.css" /> | ||
<Link rel="shortcut icon" type_="image/ico" href="/favicon.ico" /> | ||
|
||
// sets the document title | ||
<Title text="Welcome to Leptos" /> | ||
|
||
// content for this welcome page | ||
<Router fallback=|| { | ||
let mut outside_errors = Errors::default(); | ||
outside_errors.insert_with_default_key(AppError::NotFound); | ||
view! { <ErrorTemplate outside_errors /> }.into_view() | ||
}> | ||
<main class="font-sans"> | ||
<Routes> | ||
<Route path="/" view=HomePage /> | ||
<Route path="/ui" view=MailPage /> | ||
</Routes> | ||
</main> | ||
</Router> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters