Added simple popup to profile icon
modified: src/components/dashboard.rs modified: src/components/personal.rs modified: style/dashboard.scss modified: style/home.scss modified: style/personal.scss
This commit is contained in:
parent
e211f476a7
commit
7c5f21791c
@ -4,7 +4,7 @@ use leptos::*;
|
||||
pub fn Dashboard() -> impl IntoView {
|
||||
view! {
|
||||
<div class="dashboard-container home-component">
|
||||
<h1>Dashboard</h1>
|
||||
<h1 class="dashboard-header">Dashboard</h1>
|
||||
</div>
|
||||
}
|
||||
}
|
@ -14,12 +14,30 @@ pub fn Personal() -> impl IntoView {
|
||||
|
||||
#[component]
|
||||
pub fn Profile() -> impl IntoView {
|
||||
let (dropdown_open, set_dropdown_open) = create_signal(false);
|
||||
|
||||
let open_dropdown = move |_| {
|
||||
set_dropdown_open.update(|value| *value = !*value);
|
||||
log!("opened dropdown");
|
||||
};
|
||||
view! {
|
||||
<div class="profile-container">
|
||||
<div class="profile-icon">
|
||||
<div class="profile-icon" on:click=open_dropdown>
|
||||
<Icon icon=Icon::from(CgProfile) />
|
||||
</div>
|
||||
|
||||
<div class="dropdown-container" style={move || if dropdown_open() {"display: flex"} else {"display: none"}}>
|
||||
<DropDownNotLoggedIn />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
#[component]
|
||||
pub fn DropDownNotLoggedIn() -> impl IntoView {
|
||||
view! {
|
||||
<div class="dropdown-not-logged">
|
||||
<h1>Not Logged in!</h1>
|
||||
<a href="/login"><button class="auth-button">Log In</button></a>
|
||||
<a href="/signup"><button class="auth-button">Sign up</button></a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
@ -2,4 +2,9 @@
|
||||
|
||||
.dashboard-container {
|
||||
width: calc(100% - 22rem - 16rem);
|
||||
.dashboard-header {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 300;
|
||||
border-bottom: 2px solid white;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
background: #1c1c1c;
|
||||
height: 100vh;
|
||||
margin: 2px;
|
||||
padding: 1rem 1.5rem 1.5rem 1.5rem;
|
||||
padding: 0.2rem 1.5rem 1.5rem 1rem;
|
||||
border-radius: 0.5rem;
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
.profile-container {
|
||||
display: flex;
|
||||
border-radius: 0.4rem;
|
||||
margin: 0.3rem;
|
||||
margin: 0.2rem;
|
||||
min-height: 6rem;
|
||||
border: 2px solid rgba(89, 89, 89, 0.199);
|
||||
padding: 0.5rem;
|
||||
@ -34,5 +34,41 @@
|
||||
.profile-icon:active {
|
||||
transform: scale(0.8);
|
||||
}
|
||||
.dropdown-container {
|
||||
position: absolute;
|
||||
top: 3.8rem;
|
||||
right: 0.8rem;
|
||||
background: #1c1c1c;
|
||||
border-radius: 0.5rem;
|
||||
width: 10rem;
|
||||
z-index: 1;
|
||||
background-color: red;
|
||||
border: 1px solid grey;
|
||||
|
||||
.dropdown-not-logged {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
h1 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
.auth-button {
|
||||
}
|
||||
}
|
||||
}
|
||||
.dropdown-container:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -0.4rem;
|
||||
right: 0.92rem;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
transform: rotate(45deg);
|
||||
background-color: red;
|
||||
border-left: 1px solid grey;
|
||||
border-top: 1px solid grey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user