Skip to content

Commit

Permalink
navbar mobile menu added
Browse files Browse the repository at this point in the history
  • Loading branch information
dpet committed Nov 12, 2024
1 parent e8565f0 commit 2c4ee57
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 17 deletions.
5 changes: 5 additions & 0 deletions src/assets/images/hamburger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/images/hamburger_close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 53 additions & 11 deletions src/assets/style/components/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
}
}


.dropdown {
.dropdown-content {
display: none; // Hide dropdown by default
Expand Down Expand Up @@ -96,17 +95,60 @@
}
}

.beta-tag{
color: #ea9606;
.hamburger{
display: none;
position: absolute;
right:40px;
top: 20px;
top: 12px;
right: 10px;
width: 34px;

@media screen and (max-width: 1000px) {
display: inline-block;
}
}
}

.tab-content{
padding: 10px;
background: #1d2127;
margin-bottom: 20px;
min-height: 470px;
.hamburger-close{
display: none;
position: absolute;
top: 12px;
right: 10px;
width: 34px;

@media screen and (max-width: 1000px) {
display: inline-block;
}
}

.mobile-hidden{
.beta-tag{
color: #ea9606;
position: absolute;
right:40px;
top: 20px;
}

@media screen and (max-width: 1000px) {

display: none;
flex-direction: column;
position: absolute;
top: 55px;
right: 10px;
z-index: 2;
background: #0d0e10;

&.open{
display: flex;
}

button{
width: 100%;
}

.beta-tag{
display: none;
}
}
}
}

10 changes: 9 additions & 1 deletion src/assets/style/components/tab_content.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

.tab-content{
padding: 10px;
background: #1d2127;
margin-bottom: 20px;
min-height: 470px;
}

// witness tab
.witness-table{
position: relative;
Expand Down Expand Up @@ -90,4 +97,5 @@
a {
color: #ea9606;
}
}
}

24 changes: 19 additions & 5 deletions src/components/program_window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ mod share_button;
mod tools_dropdown;
mod transaction_button;

use leptos::{component, view, IntoView};
use leptos::create_signal;
use leptos::{component, view, IntoView, SignalGet, SignalSet};

use self::address_button::AddressButton;
use self::examples_dropdown::ExamplesDropdown;
Expand All @@ -22,15 +23,28 @@ pub use self::program_tab::{Program, Runtime};

#[component]
pub fn ProgramWindow() -> impl IntoView {
let (mobile_open, set_mobile_open) = create_signal(false);

view! {
<Toolbar>
<RunButton />
<ExamplesDropdown />
<AddressButton />
<TransactionButton />

<div class="mobile-hidden" class:open = move || mobile_open.get() >
<AddressButton />
<TransactionButton />
<ShareButton />
<div class="beta-tag">beta</div>
</div>

<HelpButton />
<ShareButton />
<div class="beta-tag">beta</div>

{move || if !mobile_open.get() {
view! { <img class="hamburger" src="/images/hamburger.svg" on:click=move |_| set_mobile_open.set(true) /> }
} else {
view! { <img class="hamburger-close" src="/images/hamburger_close.svg" on:click=move |_| set_mobile_open.set(false) /> }
}}

</Toolbar>
<ProgramTab />
}
Expand Down

0 comments on commit 2c4ee57

Please sign in to comment.