1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-28 05:29:00 +09:00
misskey/src/client/app/desktop/views/components/ui.header.vue
2018-09-27 15:19:11 +09:00

161 lines
2.8 KiB
Vue

<template>
<div class="header" :style="style">
<p class="warn" v-if="env != 'production'">%i18n:common.do-not-use-in-production%</p>
<mk-special-message/>
<div class="main" ref="main">
<div class="backdrop"></div>
<div class="main">
<div class="container" ref="mainContainer">
<div class="left">
<x-nav/>
</div>
<div class="center">
<div class="icon" @click="goToTop"></div>
</div>
<div class="right">
<x-search/>
<x-account v-if="$store.getters.isSignedIn"/>
<x-notifications v-if="$store.getters.isSignedIn"/>
<x-post v-if="$store.getters.isSignedIn"/>
<x-clock v-if="$store.state.settings.showClockOnHeader"/>
</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import * as anime from 'animejs';
import { env } from '../../../config';
import XNav from './ui.header.nav.vue';
import XSearch from './ui.header.search.vue';
import XAccount from './ui.header.account.vue';
import XNotifications from './ui.header.notifications.vue';
import XPost from './ui.header.post.vue';
import XClock from './ui.header.clock.vue';
export default Vue.extend({
components: {
XNav,
XSearch,
XAccount,
XNotifications,
XPost,
XClock
},
data() {
return {
env: env
};
},
computed: {
style(): any {
return {
'box-shadow': this.$store.state.settings.useShadow ? '0 0px 8px rgba(0, 0, 0, 0.2)' : 'none'
};
}
},
mounted() {
this.$store.commit('setUiHeaderHeight', this.$el.offsetHeight);
},
methods: {
goToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
},
});
</script>
<style lang="stylus" scoped>
root(isDark)
position fixed
top 0
z-index 1000
width 100%
> .warn
display block
margin 0
padding 4px
text-align center
font-size 12px
background #f00
color #fff
> .main
height 48px
> .backdrop
position absolute
top 0
z-index 1000
width 100%
height 48px
background var(--desktopHeaderBg)
> .main
z-index 1001
margin 0
padding 0
background-clip content-box
font-size 0.9rem
user-select none
> .container
display flex
width 100%
max-width 1300px
margin 0 auto
> *
position absolute
height 48px
> .center
right 0
> .icon
margin auto
display block
width 48px
height 48px
background-image var(--desktopHeaderIcon)
background-size 24px
background-position center
background-repeat no-repeat
opacity 0.3
cursor pointer
> .left,
> .center
left 0
> .right
right 0
> *
display inline-block
vertical-align top
@media (max-width 1100px)
> .mk-ui-header-search
display none
.header[data-darkmode]
root(true)
.header:not([data-darkmode])
root(false)
</style>