143 lines
2.7 KiB
Svelte
143 lines
2.7 KiB
Svelte
<script>
|
|
import { onMount } from 'svelte';
|
|
import Select from 'svelte-select';
|
|
|
|
import { UserCheck, handleLogout } from '$lib/userFunction';
|
|
|
|
let Nickname;
|
|
let userImage;
|
|
let jopa = 0;
|
|
|
|
onMount(async () => {
|
|
const UserData = await UserCheck();
|
|
Nickname = UserData.username;
|
|
userImage = UserData.avatar_image;
|
|
});
|
|
|
|
let isOpen = false;
|
|
|
|
function dropDown() {
|
|
isOpen = !isOpen;
|
|
}
|
|
</script>
|
|
|
|
<header>
|
|
<a href="chat" class="avatarDiv">
|
|
<img class="siteAvatar" src="./BP-NEON.png" alt="лого" />
|
|
<h2>BP Chat</h2>
|
|
</a>
|
|
|
|
<div class="userUser">
|
|
<button
|
|
class="buttonUser"
|
|
style:border-bottom-right-radius={isOpen ? '0px' : '15px'}
|
|
style:border-bottom-left-radius={isOpen ? '0px' : '15px'}
|
|
on:click={dropDown}
|
|
>
|
|
<h3>{Nickname}</h3>
|
|
<div><img class="userAvatar" src={userImage} alt="аватарка"/></div>
|
|
</button>
|
|
|
|
{#if isOpen}
|
|
<div class="dropdown">
|
|
<a href="/profile" class="listItem">Профиль</a>
|
|
<a href="/settings" class="listItem">Настройки</a>
|
|
<a on:click={handleLogout} class="listItem">Выйти</a>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
</header>
|
|
|
|
<style lang="scss">
|
|
.buttonUser,
|
|
.dropdown {
|
|
border: 1px solid transparent;
|
|
background:
|
|
linear-gradient(#101010, #101010) padding-box,
|
|
var(--gradient) border-box;
|
|
//background-repeat: no-repeat;
|
|
//background-attachment: fixed;
|
|
border-bottom-left-radius: 15px;
|
|
border-bottom-right-radius: 15px;
|
|
border-bottom: 0;
|
|
border-top-right-radius: 0;
|
|
border-top-left-radius: 0;
|
|
|
|
}
|
|
|
|
header {
|
|
position: relative;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
height: 100%;
|
|
width: 100%;
|
|
margin-left: 9%;
|
|
margin-right: 9%;
|
|
}
|
|
|
|
.avatarDiv {
|
|
border: 1px solid transparent;
|
|
background:
|
|
linear-gradient(#101010, #101010) padding-box,
|
|
var(--gradient) border-box;
|
|
border-radius: 15px;
|
|
border-bottom: 0;
|
|
border-top-right-radius: 0;
|
|
border-top-left-radius: 0;
|
|
margin-top: -1px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.buttonUser {
|
|
width: 230px;
|
|
height: 100%;
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
margin-top: -1px;
|
|
}
|
|
|
|
.dropdown {
|
|
width: 228px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
border-top: 0;
|
|
}
|
|
.userAvatar {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
width: 75px;
|
|
height: 75px;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.dropdown > * {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.listItem {
|
|
text-decoration: none;
|
|
font-size: 16px;
|
|
color: white;
|
|
text-shadow: 0 0 20px white;
|
|
background: transparent;
|
|
border: 0;
|
|
padding-left: 5px;
|
|
padding-bottom: 3px;
|
|
}
|
|
|
|
.avatarDiv {
|
|
width: 230px;
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
}
|
|
|
|
.siteAvatar {
|
|
height: 90%;
|
|
}
|
|
</style>
|