2018-02-14 16:32:13 +01:00
|
|
|
<template>
|
2018-03-29 07:48:47 +02:00
|
|
|
<div class="header" :data-is-dark-background="user.bannerUrl != null">
|
2018-04-19 11:54:34 +02:00
|
|
|
<div class="is-suspended" v-if="user.isSuspended"><p>%fa:exclamation-triangle% %i18n:@is-suspended%</p></div>
|
2018-04-17 15:25:51 +02:00
|
|
|
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
2018-05-07 10:05:05 +02:00
|
|
|
<div class="banner-container" :style="style">
|
|
|
|
<div class="banner" ref="banner" :style="style" @click="onBannerClick"></div>
|
2018-04-18 12:47:56 +02:00
|
|
|
<div class="fade"></div>
|
2018-02-14 16:32:13 +01:00
|
|
|
</div>
|
|
|
|
<div class="container">
|
2018-04-29 10:17:15 +02:00
|
|
|
<mk-avatar class="avatar" :user="user" :disable-preview="true"/>
|
2018-02-14 16:32:13 +01:00
|
|
|
<div class="title">
|
2018-04-09 11:52:29 +02:00
|
|
|
<p class="name">{{ user | userName }}</p>
|
2018-05-18 08:42:42 +02:00
|
|
|
<p class="username"><mk-acct :user="user"/></p>
|
2018-04-07 20:58:11 +02:00
|
|
|
<p class="location" v-if="user.host === null && user.profile.location">%fa:map-marker%{{ user.profile.location }}</p>
|
2018-02-14 16:32:13 +01:00
|
|
|
</div>
|
|
|
|
<footer>
|
2018-04-16 08:13:31 +02:00
|
|
|
<router-link :to="user | userPage" :data-active="$parent.page == 'home'">%fa:home%ホーム</router-link>
|
2018-02-14 16:32:13 +01:00
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['user'],
|
2018-05-07 10:05:05 +02:00
|
|
|
computed: {
|
|
|
|
style(): any {
|
|
|
|
if (this.user.bannerUrl == null) return {};
|
|
|
|
return {
|
2018-05-18 08:31:28 +02:00
|
|
|
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
2018-05-07 10:05:05 +02:00
|
|
|
backgroundImage: `url(${ this.user.bannerUrl })`
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
2018-02-14 16:32:13 +01:00
|
|
|
mounted() {
|
2018-04-15 11:38:40 +02:00
|
|
|
if (this.user.bannerUrl) {
|
|
|
|
window.addEventListener('load', this.onScroll);
|
|
|
|
window.addEventListener('scroll', this.onScroll);
|
|
|
|
window.addEventListener('resize', this.onScroll);
|
|
|
|
}
|
2018-02-14 16:32:13 +01:00
|
|
|
},
|
|
|
|
beforeDestroy() {
|
2018-04-15 11:38:40 +02:00
|
|
|
if (this.user.bannerUrl) {
|
|
|
|
window.removeEventListener('load', this.onScroll);
|
|
|
|
window.removeEventListener('scroll', this.onScroll);
|
|
|
|
window.removeEventListener('resize', this.onScroll);
|
|
|
|
}
|
2018-02-14 16:32:13 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onScroll() {
|
|
|
|
const banner = this.$refs.banner as any;
|
|
|
|
|
|
|
|
const top = window.scrollY;
|
|
|
|
|
|
|
|
const z = 1.25; // 奥行き(小さいほど奥)
|
|
|
|
const pos = -(top / z);
|
|
|
|
banner.style.backgroundPosition = `center calc(50% - ${pos}px)`;
|
|
|
|
|
|
|
|
const blur = top / 32
|
|
|
|
if (blur <= 10) banner.style.filter = `blur(${blur}px)`;
|
|
|
|
},
|
|
|
|
|
|
|
|
onBannerClick() {
|
2018-05-27 06:49:09 +02:00
|
|
|
if (!this.$store.getters.isSignedIn || this.$store.state.i.id != this.user.id) return;
|
2018-02-14 16:32:13 +01:00
|
|
|
|
2018-04-08 17:33:56 +02:00
|
|
|
(this as any).apis.updateBanner().then(i => {
|
2018-03-29 07:48:47 +02:00
|
|
|
this.user.bannerUrl = i.bannerUrl;
|
2018-02-14 16:32:13 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-03-03 05:47:55 +01:00
|
|
|
@import '~const.styl'
|
|
|
|
|
2018-02-20 17:39:51 +01:00
|
|
|
.header
|
2018-02-14 16:32:13 +01:00
|
|
|
$footer-height = 58px
|
|
|
|
|
|
|
|
overflow hidden
|
2018-04-15 12:24:21 +02:00
|
|
|
background #f7f7f7
|
2018-04-29 01:51:17 +02:00
|
|
|
box-shadow 0 1px 1px rgba(#000, 0.075)
|
2018-02-14 16:32:13 +01:00
|
|
|
|
2018-04-19 11:54:34 +02:00
|
|
|
> .is-suspended
|
2018-04-15 11:38:40 +02:00
|
|
|
> .is-remote
|
2018-04-19 11:54:34 +02:00
|
|
|
&.is-suspended
|
|
|
|
color #570808
|
|
|
|
background #ffdbdb
|
|
|
|
|
|
|
|
&.is-remote
|
|
|
|
color #573c08
|
|
|
|
background #fff0db
|
2018-04-15 11:38:40 +02:00
|
|
|
|
|
|
|
> p
|
|
|
|
margin 0 auto
|
2018-04-19 19:09:53 +02:00
|
|
|
padding 14px 16px
|
|
|
|
max-width 1200px
|
|
|
|
font-size 14px
|
2018-04-15 11:38:40 +02:00
|
|
|
|
|
|
|
> a
|
|
|
|
font-weight bold
|
|
|
|
|
2018-02-14 16:32:13 +01:00
|
|
|
&[data-is-dark-background]
|
|
|
|
> .banner-container
|
|
|
|
> .banner
|
|
|
|
background-color #383838
|
|
|
|
|
2018-04-18 12:47:56 +02:00
|
|
|
> .fade
|
2018-04-29 01:51:17 +02:00
|
|
|
background linear-gradient(transparent, rgba(#000, 0.7))
|
2018-02-14 16:32:13 +01:00
|
|
|
|
|
|
|
> .container
|
|
|
|
> .title
|
|
|
|
color #fff
|
|
|
|
|
|
|
|
> .name
|
|
|
|
text-shadow 0 0 8px #000
|
|
|
|
|
|
|
|
> .banner-container
|
2018-04-18 12:47:56 +02:00
|
|
|
height 320px
|
2018-02-14 16:32:13 +01:00
|
|
|
overflow hidden
|
|
|
|
background-size cover
|
|
|
|
background-position center
|
|
|
|
|
|
|
|
> .banner
|
|
|
|
height 100%
|
2018-04-15 12:24:21 +02:00
|
|
|
background-color #bfccd0
|
2018-02-14 16:32:13 +01:00
|
|
|
background-size cover
|
|
|
|
background-position center
|
|
|
|
|
2018-04-18 12:47:56 +02:00
|
|
|
> .fade
|
|
|
|
position absolute
|
|
|
|
bottom 0
|
|
|
|
left 0
|
|
|
|
width 100%
|
|
|
|
height 78px
|
2018-02-14 16:32:13 +01:00
|
|
|
|
|
|
|
> .container
|
|
|
|
max-width 1200px
|
|
|
|
margin 0 auto
|
|
|
|
|
|
|
|
> .avatar
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
bottom 16px
|
|
|
|
left 16px
|
|
|
|
z-index 2
|
|
|
|
width 160px
|
|
|
|
height 160px
|
|
|
|
border solid 3px #fff
|
|
|
|
border-radius 8px
|
2018-04-29 01:51:17 +02:00
|
|
|
box-shadow 1px 1px 3px rgba(#000, 0.2)
|
2018-02-14 16:32:13 +01:00
|
|
|
|
|
|
|
> .title
|
|
|
|
position absolute
|
|
|
|
bottom $footer-height
|
|
|
|
left 0
|
|
|
|
width 100%
|
|
|
|
padding 0 0 8px 195px
|
2018-04-15 11:38:40 +02:00
|
|
|
color #5e6367
|
2018-02-14 16:32:13 +01:00
|
|
|
font-family '游ゴシック', 'YuGothic', 'ヒラギノ角ゴ ProN W3', 'Hiragino Kaku Gothic ProN', 'Meiryo', 'メイリオ', sans-serif
|
|
|
|
|
|
|
|
> .name
|
|
|
|
display block
|
|
|
|
margin 0
|
|
|
|
line-height 40px
|
|
|
|
font-weight bold
|
|
|
|
font-size 2em
|
|
|
|
|
|
|
|
> .username
|
|
|
|
> .location
|
|
|
|
display inline-block
|
|
|
|
margin 0 16px 0 0
|
|
|
|
line-height 20px
|
|
|
|
opacity 0.8
|
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
> footer
|
|
|
|
z-index 1
|
|
|
|
height $footer-height
|
|
|
|
padding-left 195px
|
|
|
|
|
|
|
|
> a
|
|
|
|
display inline-block
|
|
|
|
margin 0
|
|
|
|
padding 0 16px
|
|
|
|
height $footer-height
|
|
|
|
line-height $footer-height
|
|
|
|
color #555
|
|
|
|
|
|
|
|
&[data-active]
|
|
|
|
border-bottom solid 4px $theme-color
|
|
|
|
|
|
|
|
> i
|
|
|
|
margin-right 6px
|
|
|
|
|
|
|
|
> button
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
right 0
|
|
|
|
margin 8px
|
|
|
|
padding 0
|
|
|
|
width $footer-height - 16px
|
|
|
|
line-height $footer-height - 16px - 2px
|
|
|
|
font-size 1.2em
|
|
|
|
color #777
|
|
|
|
border solid 1px #eee
|
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
color #555
|
|
|
|
border solid 1px #ddd
|
|
|
|
|
|
|
|
</style>
|