Skip to content

Commit

Permalink
Merge pull request #70 from toyota-corolla0/2024-02-move-positioning-…
Browse files Browse the repository at this point in the history
…class-outside-of-alert-blocks

fix: move positioning class outside of alert blocks
  • Loading branch information
elsirion authored Feb 28, 2024
2 parents a8fa811 + 4368010 commit 5ada27d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/components/alerts.rs
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
use leptos::*;

#[component]
pub fn NoteBlock(children: Children) -> impl IntoView {
pub fn NoteBlock(#[prop(into, optional)] class: String, children: Children) -> impl IntoView {
view! {
<div class="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4 mb-8 w-full" role="alert">
<div class=format!("bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4 w-full {}", class) role="alert">
<p class="font-bold">Note</p>
<p>{ children() }</p>
</div>
}
}

#[component]
pub fn SuccessBlock(children: Children) -> impl IntoView {
pub fn SuccessBlock(#[prop(into, optional)] class: String, children: Children) -> impl IntoView {
view! {
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-8 w-full" role="alert">
<div class=format!("bg-green-100 border-l-4 border-green-500 text-green-700 p-4 w-full {}", class) role="alert">
<p class="font-bold">Success</p>
<p>{ children() }</p>
</div>
}
}

#[component]
pub fn WarningBlock(children: Children) -> impl IntoView {
pub fn WarningBlock(#[prop(into, optional)] class: String, children: Children) -> impl IntoView {
view! {
<div class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4 mb-8 w-full" role="alert">
<div class=format!("bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4 w-full {}", class) role="alert">
<p class="font-bold">Warning</p>
<p>{ children() }</p>
</div>
}
}

#[component]
pub fn ErrorBlock(children: Children) -> impl IntoView {
pub fn ErrorBlock(#[prop(into, optional)] class: String, children: Children) -> impl IntoView {
view! {
<div class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4 mb-8 w-full" role="alert">
<div class=format!("bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4 w-full {}", class) role="alert">
<p class="font-bold">Error</p>
<p>{ children() }</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ln_receive_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ where
{move || {
if let Some(error) = error.get() {
view!{
<ErrorBlock>
<ErrorBlock class="mb-8">
{ error }
</ErrorBlock>
}.into_view()
Expand Down
4 changes: 2 additions & 2 deletions src/components/receive_ln.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn ReceiveLn() -> impl IntoView {

match paid_resource.get() {
Some(()) => view! {
<SuccessBlock>
<SuccessBlock class="mb-8">
"The invoice has been paid!"
</SuccessBlock>
}.into_view(),
Expand All @@ -80,7 +80,7 @@ pub fn ReceiveLn() -> impl IntoView {
}
Some(Err(e)) => {
view!{
<ErrorBlock>
<ErrorBlock class="mb-8">
{ e.to_string() }
</ErrorBlock>
}.into_view()
Expand Down
6 changes: 3 additions & 3 deletions src/components/send_ecash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn SendEcash() -> impl IntoView {
{move || {
error.get().map(|e| {
view! {
<ErrorBlock>
<ErrorBlock class="mb-8">
{e}
</ErrorBlock>
}
Expand All @@ -81,7 +81,7 @@ pub fn SendEcash() -> impl IntoView {
submit_action.value().get().map(|r| {
r.result.err().map(|err| {
view! {
<ErrorBlock>
<ErrorBlock class="mb-8">
{format!("{:?}", err)}
</ErrorBlock>
}
Expand All @@ -95,7 +95,7 @@ pub fn SendEcash() -> impl IntoView {
let total = notes.total_amount();
let notes_string_signal = Signal::derive(move || notes.to_string());
view! {
<SuccessBlock>
<SuccessBlock class="mb-8">
{format!("Notes representing {} shown below.", total)}
</SuccessBlock>
<Show when=move || total != r.requested_amount>
Expand Down
4 changes: 2 additions & 2 deletions src/components/wallet_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ where
.collect::<Vec<_>>();

view! {
<NoteBlock>
<NoteBlock class="mb-8">
"To switch wallets after selecting one just reload the web app."
</NoteBlock>
<WarningBlock>
<WarningBlock class="mb-8">
"Webimint is a highly experimental Fedimint wallet, use at your own risk.
It's currently compatible with the 0.2 release of Fedimint."
</WarningBlock>
Expand Down

0 comments on commit 5ada27d

Please sign in to comment.