storj/web/satellite/src/components/header/AccountButton.vue

127 lines
3.4 KiB
Vue
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
<template>
<div class="account-button-container" id="accountDropdownButton">
<div class="account-button-toggle-container" v-on:click="toggleSelection" >
2018-11-16 14:28:02 +00:00
<!-- background of this div generated and stores in store -->
<div class="account-button-toggle-container__avatar">
2018-11-16 14:28:02 +00:00
<!-- First digit of firstName after Registration -->
<!-- img if avatar was set -->
<h1>{{avatarLetter}}</h1>
</div>
<h1 class="account-button-toggle-container__user-name">{{userName}}</h1>
<div class="account-button-toggle-container__expander-area">
<img v-if="!isDropdownShown" src="../../../static/images/register/BlueExpand.svg" alt="expand settings" />
<img v-if="isDropdownShown" src="../../../static/images/register/BlueHide.svg" alt="hide settings" />
</div>
</div>
<AccountDropdown v-if="isDropdownShown" />
2018-11-16 14:28:02 +00:00
</div>
</template>
<script lang="ts">
2019-09-09 11:33:39 +01:00
import { Component, Vue } from 'vue-property-decorator';
2019-09-09 11:33:39 +01:00
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
2019-09-09 11:33:39 +01:00
import AccountDropdown from './AccountDropdown.vue';
2019-09-09 11:33:39 +01:00
@Component({
components: {
AccountDropdown
}
})
export default class AccountButton extends Vue {
public toggleSelection(): void {
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_ACCOUNT);
}
2019-09-09 11:33:39 +01:00
public get avatarLetter(): string {
return this.$store.getters.userName.slice(0, 1).toUpperCase();
}
public get userName(): string {
return this.$store.getters.userName;
}
public get isDropdownShown(): boolean {
return this.$store.state.appStateModule.appState.isAccountDropdownShown;
}
2019-09-09 11:33:39 +01:00
}
</script>
<style scoped lang="scss">
a {
text-decoration: none;
outline: none;
}
2019-07-10 10:55:40 +01:00
.account-button-container {
2018-11-16 14:28:02 +00:00
position: relative;
padding-left: 10px;
padding-right: 10px;
background-color: #FFFFFF;
2018-11-16 14:28:02 +00:00
cursor: pointer;
&:hover {
.account-button-toggle-container__user-name {
opacity: 0.7;
}
}
}
.account-button-toggle-container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
width: max-content;
height: 50px;
&__user-name {
margin-left: 12px;
font-family: 'font_medium';
font-size: 16px;
line-height: 23px;
color: #354049;
transition: opacity .2s ease-in-out;
}
&__avatar {
width: 40px;
height: 40px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
background: #E8EAF2;
h1 {
font-family: 'font_medium';
font-size: 16px;
line-height: 23px;
color: #354049;
}
}
&__expander-area {
margin-left: 12px;
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
}
}
@media screen and (max-width: 720px) {
.account-button-toggle-container {
2019-07-10 10:55:40 +01:00
&__user-name {
display: none;
}
}
}
</style>