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

80 lines
1.5 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
2016-06-25 16:05:24 +00:00
<span class="profile" id="userBadge">
<span class="view-profile control" @click="loadMainView('profile')">
<img class="avatar" :src="state.current.avatar" alt="Avatar"></img>
<span class="name">{{ state.current.name }}</span>
2015-12-13 04:42:28 +00:00
</span>
2016-06-25 16:05:24 +00:00
<a class="logout" @click.prevent="logout"><i class="fa fa-sign-out control"></i></a>
</span>
2015-12-13 04:42:28 +00:00
</template>
<script>
2016-06-25 16:05:24 +00:00
import { userStore } from '../../stores';
import { event, loadMainView } from '../../utils';
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
export default {
name: 'site-header--user-badge',
2016-06-25 10:15:57 +00:00
2016-06-25 16:05:24 +00:00
data() {
return {
state: userStore.state,
};
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
methods: {
loadMainView(v) {
loadMainView(v);
},
2015-12-30 04:14:47 +00:00
2016-06-25 16:05:24 +00:00
logout() {
event.emit('logout');
},
},
};
2015-12-13 04:42:28 +00:00
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../sass/partials/_vars.scss";
@import "../../../sass/partials/_mixins.scss";
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
#userBadge {
@include vertical-center();
justify-content: flex-end;
flex: 0 0 $extraPanelWidth;
padding-right: 16px;
text-align: right;
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
.avatar {
width: 24px;
height: 24px;
border-radius: 50%;
margin-right: 8px;
}
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
.view-profile {
margin-right: 16px;
@include vertical-center();
}
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
@media only screen and (max-width : 667px) {
flex: 0 0 96px;
margin-right: 0;
padding-right: 0;
align-content: stretch;
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
.name {
display: none;
}
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
.view-profile, .logout {
flex: 0 0 40px;
font-size: 1.4rem;
margin-right: 0;
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
@include vertical-center();
2016-03-13 17:00:32 +00:00
}
2016-06-25 16:05:24 +00:00
}
}
2015-12-13 04:42:28 +00:00
</style>