2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-27 10:51:33 +00:00
|
|
|
// 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">
|
2019-10-02 10:42:12 +01:00
|
|
|
<div class="account-button-toggle-container" @click="toggleSelection">
|
2020-05-08 12:07:24 +01:00
|
|
|
<div class="account-button-toggle-container__avatar" :class="{ 'expanded-background': isDropdownShown }">
|
|
|
|
<h1 class="account-button-toggle-container__avatar__letter" :class="{ 'expanded-font-color': isDropdownShown }">
|
|
|
|
{{ avatarLetter }}
|
|
|
|
</h1>
|
2018-11-16 14:28:02 +00:00
|
|
|
</div>
|
2018-11-19 15:32:50 +00:00
|
|
|
<div class="account-button-toggle-container__expander-area">
|
2019-10-23 13:26:39 +01:00
|
|
|
<ExpandIcon
|
|
|
|
v-if="!isDropdownShown"
|
|
|
|
alt="Arrow down (expand)"
|
|
|
|
/>
|
|
|
|
<HideIcon
|
|
|
|
v-if="isDropdownShown"
|
|
|
|
alt="Arrow up (hide)"
|
|
|
|
/>
|
2018-11-14 14:00:01 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-10-02 10:42:12 +01: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">
|
2019-09-09 11:33:39 +01:00
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
2018-11-14 14:00:01 +00:00
|
|
|
|
2019-10-23 13:26:39 +01:00
|
|
|
import ExpandIcon from '@/../static/images/common/BlackArrowExpand.svg';
|
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2020-05-08 12:07:24 +01:00
|
|
|
import HideIcon from '../../../static/images/common/ArrowHide.svg';
|
2019-09-09 11:33:39 +01:00
|
|
|
import AccountDropdown from './AccountDropdown.vue';
|
2018-11-14 14:00:01 +00:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
@Component({
|
|
|
|
components: {
|
2019-09-13 15:58:18 +01:00
|
|
|
AccountDropdown,
|
2019-10-23 13:26:39 +01:00
|
|
|
ExpandIcon,
|
|
|
|
HideIcon,
|
2019-09-13 15:58:18 +01:00
|
|
|
},
|
2019-09-09 11:33:39 +01:00
|
|
|
})
|
|
|
|
export default class AccountButton extends Vue {
|
2020-02-14 15:35:10 +00:00
|
|
|
/**
|
|
|
|
* Toggles account dropdown.
|
|
|
|
*/
|
2019-09-09 11:33:39 +01:00
|
|
|
public toggleSelection(): void {
|
|
|
|
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_ACCOUNT);
|
|
|
|
}
|
2019-07-18 14:39:39 +01:00
|
|
|
|
2020-02-14 15:35:10 +00:00
|
|
|
/**
|
|
|
|
* Returns first letter of user`s name.
|
|
|
|
*/
|
2019-09-09 11:33:39 +01:00
|
|
|
public get avatarLetter(): string {
|
|
|
|
return this.$store.getters.userName.slice(0, 1).toUpperCase();
|
|
|
|
}
|
|
|
|
|
2020-02-14 15:35:10 +00:00
|
|
|
/**
|
|
|
|
* Indicates if account dropdown should render.
|
|
|
|
*/
|
2019-09-09 11:33:39 +01:00
|
|
|
public get isDropdownShown(): boolean {
|
|
|
|
return this.$store.state.appStateModule.appState.isAccountDropdownShown;
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
2019-09-09 11:33:39 +01:00
|
|
|
}
|
2018-11-14 14:00:01 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
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;
|
|
|
|
|
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;
|
2019-10-28 15:59:19 +00:00
|
|
|
background: #e8eaf2;
|
2019-01-30 13:18:07 +00:00
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
&__letter {
|
2019-10-28 15:59:19 +00:00
|
|
|
font-family: 'font_medium', sans-serif;
|
2018-11-19 15:32:50 +00:00
|
|
|
font-size: 16px;
|
|
|
|
line-height: 23px;
|
|
|
|
color: #354049;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&__expander-area {
|
2019-10-17 13:25:18 +01:00
|
|
|
margin-left: 9px;
|
2018-11-19 15:32:50 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2018-11-14 14:00:01 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-23 15:48:11 +00:00
|
|
|
|
2019-10-28 15:59:19 +00:00
|
|
|
.account-button-container {
|
|
|
|
position: relative;
|
|
|
|
background-color: #fff;
|
|
|
|
cursor: pointer;
|
2020-05-08 12:07:24 +01:00
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2020-05-08 12:07:24 +01:00
|
|
|
.expanded-background {
|
|
|
|
background-color: #2582ff;
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2020-05-08 12:07:24 +01:00
|
|
|
.expanded-font-color {
|
|
|
|
color: #fff;
|
2019-10-28 15:59:19 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 12:07:24 +01:00
|
|
|
@media screen and (max-width: 1280px) {
|
2019-10-28 15:59:19 +00:00
|
|
|
|
2018-11-23 15:48:11 +00:00
|
|
|
.account-button-toggle-container {
|
2019-07-10 10:55:40 +01:00
|
|
|
|
2019-09-20 11:21:22 +01:00
|
|
|
&__expander-area {
|
2018-11-23 15:48:11 +00:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-28 15:59:19 +00:00
|
|
|
</style>
|