koel/resources/assets/js/components/site-header/user-badge.vue

80 lines
1.9 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
<span class="profile" id="userBadge">
<span class="view-profile control" @click="loadProfileView">
<img class="avatar" :src="state.current.avatar" alt="Avatar"></img>
<span class="name">{{ state.current.name }}</span>
</span>
2015-12-30 04:14:47 +00:00
<a class="logout" @click.prevent="logout"><i class="fa fa-sign-out control"></i></a>
2015-12-13 04:42:28 +00:00
</span>
</template>
<script>
import userStore from '../../stores/user';
export default {
data() {
return {
state: userStore.state,
};
},
methods: {
/**
* Load the profile view if the user click on his avatar or name.
*/
loadProfileView() {
this.$root.loadMainView('profile');
},
2015-12-30 04:14:47 +00:00
logout() {
this.$root.logout();
},
2015-12-13 04:42:28 +00:00
},
};
</script>
<style lang="sass">
@import "resources/assets/sass/partials/_vars.scss";
@import "resources/assets/sass/partials/_mixins.scss";
#userBadge {
@include vertical-center();
justify-content: flex-end;
2016-01-12 14:53:15 +00:00
flex: 0 0 $extraPanelWidth;
2015-12-13 04:42:28 +00:00
padding-right: 16px;
text-align: right;
.avatar {
width: 24px;
height: 24px;
border-radius: 50%;
margin-right: 8px;
}
.view-profile {
margin-right: 16px;
@include vertical-center();
}
2016-01-16 18:11:24 +00:00
@media only screen and (max-device-width : 667px) {
2015-12-13 04:42:28 +00:00
flex: 0 0 96px;
margin-right: 0;
padding-right: 0;
align-content: stretch;
.name {
display: none;
}
.view-profile, .logout {
flex: 0 0 40px;
font-size: 140%;
margin-right: 0;
@include vertical-center();
}
}
}
</style>