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