-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rearranges mobile layout to have more screenspace
- Loading branch information
Showing
18 changed files
with
258 additions
and
85 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use crate::components::layouts::base_layout::ControlsSignal; | ||
use leptos::*; | ||
use leptos_icons::*; | ||
|
||
#[component] | ||
pub fn ToggleControls() -> impl IntoView { | ||
let controls_signal = expect_context::<ControlsSignal>(); | ||
let toggle_controls = move |_| controls_signal.hidden.update(|b| *b = !*b); | ||
let icon = move || { | ||
if controls_signal.hidden.get() { | ||
view! { <Icon icon=icondata::BiDownArrowSolid class="w-4 h-4"/> } | ||
} else { | ||
view! { <Icon icon=icondata::BiUpArrowSolid class="w-4 h-4"/> } | ||
} | ||
}; | ||
let title = move || { | ||
if controls_signal.hidden.get() { | ||
"Show controls" | ||
} else { | ||
"Hide Controls" | ||
} | ||
}; | ||
|
||
let button_color = move || { | ||
if controls_signal.notify.get() && controls_signal.hidden.get() { | ||
"bg-ladybug-red" | ||
} else { | ||
"bg-button-dawn dark:bg-button-twilight" | ||
} | ||
}; | ||
|
||
view! { | ||
<button | ||
title=title | ||
on:click=toggle_controls | ||
class=move || { | ||
format!( | ||
"{} px-4 py-1 m-1 font-bold text-white rounded transition-transform duration-300 transform hover:bg-pillbug-teal active:scale-95", | ||
button_color(), | ||
) | ||
} | ||
> | ||
|
||
{icon} | ||
</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
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,27 @@ | ||
use crate::{ | ||
components::{ | ||
atoms::toggle_controls::ToggleControls, layouts::base_layout::OrientationSignal, | ||
organisms::dropdowns::ChatDropdown, | ||
}, | ||
providers::{game_state::GameStateSignal, navigation_controller::NavigationControllerSignal}, | ||
}; | ||
use leptos::*; | ||
use shared_types::SimpleDestination; | ||
|
||
#[component] | ||
pub fn ChatAndControls() -> impl IntoView { | ||
let gamestate = expect_context::<GameStateSignal>(); | ||
let navi = expect_context::<NavigationControllerSignal>(); | ||
let orientation_signal = expect_context::<OrientationSignal>(); | ||
let is_finished = gamestate.is_finished(); | ||
let in_mobile_game = | ||
move || orientation_signal.orientation_vertical.get() && navi.signal.get().nanoid.is_some(); | ||
view! { | ||
<Show when=in_mobile_game> | ||
<Show when=move || !is_finished()> | ||
<ToggleControls/> | ||
</Show> | ||
<ChatDropdown destination=SimpleDestination::Game/> | ||
</Show> | ||
} | ||
} |
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
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
Oops, something went wrong.