This commit is contained in:
syuilo 2023-03-17 15:09:43 +09:00
parent b644567735
commit ac0e0122f6
3 changed files with 52 additions and 78 deletions

View File

@ -0,0 +1,39 @@
<template>
<div :class="$style.root" class="_panel">
<b>{{ clip.name }}</b>
<div v-if="clip.description" :class="$style.description">{{ clip.description }}</div>
<div v-if="clip.lastClippedAt">{{ i18n.ts.updatedAt }}: <MkTime :time="clip.lastClippedAt" mode="detail"/></div>
<div :class="$style.user">
<MkAvatar :user="clip.user" :class="$style.userAvatar" indicator link preview/> <MkUserName :user="clip.user" :nowrap="false"/>
</div>
</div>
</template>
<script lang="ts" setup>
import { i18n } from '@/i18n';
defineProps<{
clip: any;
}>();
</script>
<style lang="scss" module>
.root {
display: block;
padding: 16px;
}
.description {
padding: 8px 0;
}
.user {
padding-top: 16px;
border-top: solid 0.5px var(--divider);
}
.userAvatar {
width: 32px;
height: 32px;
}
</style>

View File

@ -2,24 +2,18 @@
<MkStickyContainer> <MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700"> <MkSpacer :content-max="700">
<div v-if="tab === 'my'" class="qtcaoidl"> <div v-if="tab === 'my'" class="_gaps">
<MkButton primary rounded class="add" @click="create"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton> <MkButton primary rounded class="add" @click="create"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
<MkPagination v-slot="{items}" ref="pagingComponent" :pagination="pagination" class="list"> <MkPagination v-slot="{items}" ref="pagingComponent" :pagination="pagination" class="_gaps">
<MkA v-for="item in items" :key="item.id" :to="`/clips/${item.id}`" class="item _panel _margin"> <MkA v-for="item in items" :key="item.id" :to="`/clips/${item.id}`">
<b>{{ item.name }}</b> <MkClipPreview :clip="item"/>
<div v-if="item.description" class="description">{{ item.description }}</div>
</MkA> </MkA>
</MkPagination> </MkPagination>
</div> </div>
<div v-else-if="tab === 'favorites'" class="_gaps"> <div v-else-if="tab === 'favorites'" class="_gaps">
<MkA v-for="item in favorites" :key="item.id" :to="`/clips/${item.id}`" :class="$style.clip" class="_panel"> <MkA v-for="item in favorites" :key="item.id" :to="`/clips/${item.id}`">
<b>{{ item.name }}</b> <MkClipPreview :clip="item"/>
<div v-if="item.description" :class="$style.clipDescription">{{ item.description }}</div>
<div v-if="item.lastClippedAt">{{ i18n.ts.updatedAt }}: <MkTime :time="item.lastClippedAt" mode="detail"/></div>
<div :class="$style.clipUser">
<MkAvatar :user="item.user" :class="$style.clipUserAvatar" indicator link preview/> <MkUserName :user="item.user" :nowrap="false"/>
</div>
</MkA> </MkA>
</div> </div>
</MkSpacer> </MkSpacer>
@ -30,6 +24,7 @@
import { watch } from 'vue'; import { watch } from 'vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkClipPreview from '@/components/MkClipPreview.vue';
import * as os from '@/os'; import * as os from '@/os';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
@ -103,44 +98,6 @@ definePageMetadata({
}); });
</script> </script>
<style lang="scss" scoped>
.qtcaoidl {
> .add {
margin: 0 auto 16px auto;
}
> .list {
> .item {
display: block;
padding: 16px;
> .description {
margin-top: 8px;
padding-top: 8px;
border-top: solid 0.5px var(--divider);
}
}
}
}
</style>
<style lang="scss" module> <style lang="scss" module>
.clip {
display: block;
padding: 16px;
}
.clipDescription {
padding: 8px 0;
}
.clipUser {
padding-top: 16px;
border-top: solid 0.5px var(--divider);
}
.clipUserAvatar {
width: 32px;
height: 32px;
}
</style> </style>

View File

@ -17,14 +17,12 @@
</div> </div>
<div v-if="clips && clips.length > 0" class="clips _margin"> <div v-if="clips && clips.length > 0" class="clips _margin">
<div class="title">{{ i18n.ts.clip }}</div> <div class="title">{{ i18n.ts.clip }}</div>
<MkA v-for="item in clips" :key="item.id" :to="`/clips/${item.id}`" class="item _panel _margin"> <div class="_gaps">
<b>{{ item.name }}</b> <MkA v-for="item in clips" :key="item.id" :to="`/clips/${item.id}`">
<div v-if="item.description" class="description">{{ item.description }}</div> <MkClipPreview :clip="item"/>
<div class="user">
<MkAvatar :user="item.user" class="avatar" indicator link preview/> <MkUserName :user="item.user" :nowrap="false"/>
</div>
</MkA> </MkA>
</div> </div>
</div>
<MkButton v-if="!showPrev && hasPrev" class="load prev" @click="showPrev = true"><i class="ti ti-chevron-down"></i></MkButton> <MkButton v-if="!showPrev && hasPrev" class="load prev" @click="showPrev = true"><i class="ti ti-chevron-down"></i></MkButton>
</div> </div>
@ -51,6 +49,7 @@ import * as os from '@/os';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { dateString } from '@/filters/date'; import { dateString } from '@/filters/date';
import MkClipPreview from '@/components/MkClipPreview.vue';
const props = defineProps<{ const props = defineProps<{
noteId: string; noteId: string;
@ -178,27 +177,6 @@ definePageMetadata(computed(() => note ? {
font-weight: bold; font-weight: bold;
padding: 12px; padding: 12px;
} }
> .item {
display: block;
padding: 16px;
> .description {
padding: 8px 0;
}
> .user {
$height: 32px;
padding-top: 16px;
border-top: solid 0.5px var(--divider);
line-height: $height;
> .avatar {
width: $height;
height: $height;
}
}
}
} }
} }
} }