enhance(client): improve channel ui

This commit is contained in:
syuilo 2023-03-04 10:50:21 +09:00
parent b303d65450
commit e4fc9ea816

View file

@ -1,28 +1,23 @@
<template>
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700">
<div v-if="channel && tab === 'timeline'" class="_gaps">
<div class="wpgynlbz _panel" :class="{ hide: !showBanner }">
<XChannelFollowButton :channel="channel" :full="true" class="subscribe"/>
<button class="_button toggle" @click="() => showBanner = !showBanner">
<template v-if="showBanner"><i class="ti ti-chevron-up"></i></template>
<template v-else><i class="ti ti-chevron-down"></i></template>
</button>
<div v-if="!showBanner" class="hideOverlay">
</div>
<div :style="{ backgroundImage: channel.bannerUrl ? `url(${channel.bannerUrl})` : null }" class="banner">
<div class="status">
<MkSpacer :content-max="700" :class="$style.main">
<div v-if="channel && tab === 'overview'" class="_gaps">
<div class="_panel" :class="$style.bannerContainer">
<XChannelFollowButton :channel="channel" :full="true" :class="$style.subscribe"/>
<div :style="{ backgroundImage: channel.bannerUrl ? `url(${channel.bannerUrl})` : null }" :class="$style.banner">
<div :class="$style.bannerStatus">
<div><i class="ti ti-users ti-fw"></i><I18n :src="i18n.ts._channel.usersCount" tag="span" style="margin-left: 4px;"><template #n><b>{{ channel.usersCount }}</b></template></I18n></div>
<div><i class="ti ti-pencil ti-fw"></i><I18n :src="i18n.ts._channel.notesCount" tag="span" style="margin-left: 4px;"><template #n><b>{{ channel.notesCount }}</b></template></I18n></div>
</div>
<div class="fade"></div>
<div :class="$style.bannerFade"></div>
</div>
<div v-if="channel.description" class="description">
<div v-if="channel.description" :class="$style.description">
<Mfm :text="channel.description" :is-note="false" :i="$i"/>
</div>
</div>
</div>
<div v-if="channel && tab === 'timeline'" class="_gaps">
<!-- スマホタブレットの場合キーボードが表示されると投稿が見づらくなるのでデスクトップ場合のみ自動でフォーカスを当てる -->
<MkPostForm v-if="$i && defaultStore.reactiveState.showFixedPostFormInChannel.value" :channel="channel" class="post-form _panel" fixed :autofocus="deviceKind === 'desktop'"/>
@ -68,7 +63,6 @@ const props = defineProps<{
let tab = $ref('timeline');
let channel = $ref(null);
let showBanner = $ref(true);
const featuredPagination = $computed(() => ({
endpoint: 'notes/featured' as const,
limit: 10,
@ -113,6 +107,10 @@ const headerActions = $computed(() => channel && channel.userId ? [{
}] : null);
const headerTabs = $computed(() => [{
key: 'overview',
title: i18n.ts.overview,
icon: 'ti ti-info-circle',
}, {
key: 'timeline',
title: i18n.ts.timeline,
icon: 'ti ti-home',
@ -129,48 +127,35 @@ definePageMetadata(computed(() => channel ? {
</script>
<style lang="scss" module>
.main {
min-height: calc(var(--containerHeight) - (var(--stickyTop, 0px) + var(--stickyBottom, 0px)));
}
.footer {
-webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
border-top: solid 0.5px var(--divider);
}
</style>
<style lang="scss" scoped>
.wpgynlbz {
.bannerContainer {
position: relative;
}
> .subscribe {
.subscribe {
position: absolute;
z-index: 1;
top: 16px;
left: 16px;
}
> .toggle {
position: absolute;
z-index: 2;
top: 8px;
right: 8px;
font-size: 1.2em;
width: 48px;
height: 48px;
color: #fff;
background: rgba(0, 0, 0, 0.5);
border-radius: 100%;
> i {
vertical-align: middle;
}
}
> .banner {
.banner {
position: relative;
height: 200px;
background-position: center;
background-size: cover;
}
> .fade {
.bannerFade {
position: absolute;
bottom: 0;
left: 0;
@ -179,7 +164,7 @@ definePageMetadata(computed(() => channel ? {
background: linear-gradient(0deg, var(--panel), var(--X15));
}
> .status {
.bannerStatus {
position: absolute;
z-index: 1;
bottom: 16px;
@ -190,48 +175,8 @@ definePageMetadata(computed(() => channel ? {
border-radius: 6px;
color: #fff;
}
}
> .description {
.description {
padding: 16px;
}
> .hideOverlay {
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
-webkit-backdrop-filter: var(--blur, blur(16px));
backdrop-filter: var(--blur, blur(16px));
background: rgba(0, 0, 0, 0.3);
}
&.hide {
> .subscribe {
display: none;
}
> .toggle {
top: 0;
right: 0;
height: 100%;
background: transparent;
}
> .banner {
height: 42px;
filter: blur(8px);
> * {
display: none;
}
}
> .description {
display: none;
}
}
}
</style>