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

76 lines
1.4 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">
2016-07-10 18:28:14 +00:00
<a class="view-profile control" href="/#!/profile">
2016-10-31 04:28:12 +00:00
<img class="avatar" :src="state.current.avatar" alt="Avatar"/>
2016-06-25 16:05:24 +00:00
<span class="name">{{ state.current.name }}</span>
2016-07-10 18:28:14 +00:00
</a>
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-11-26 03:25:35 +00:00
import { userStore } from '../../stores'
import { event } 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-11-26 03:25:35 +00:00
data () {
2016-06-25 16:05:24 +00:00
return {
2016-11-26 03:25:35 +00:00
state: userStore.state
}
2016-06-25 16:05:24 +00:00
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
methods: {
2016-11-26 03:25:35 +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>