Sharkey/packages/frontend/src/pages/welcome.timeline.vue
Acid Chicken (硫酸鶏) 337dd97b49
perf(#10923): CSS Modules のクラス名をインライン化する (#10930)
* perf(#10923): unwind css module class name

* perf(#10923): support multiple components

* refactor: clean up

* refactor(#10923): avoid `useCssModule()`

* fix(#10923): allow direct literal class name

* fix(#10923): avoid computed class name

* fix(#10923): allow literal keys

* fix(#10923): typo

* fix(#10923): invalid class names

* chore: test

* revert: test

This reverts commit 5c7ef366eceebe8ba260efa4d5d675f6c1775c45.

* fix(#10923): hidden tale

* perf(#10923): also unwind scoped css contained components

* perf(#10923): `normalizeClass` AOT compilation

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-06-01 17:19:46 +09:00

92 lines
2.2 KiB
Vue

<template>
<div :class="$style.root">
<div ref="scrollEl" :class="[$style.scrollbox, { [$style.scroll]: isScrolling }]">
<div v-for="note in notes" :key="note.id" :class="$style.note">
<div class="_panel" :class="$style.content">
<div>
<MkA v-if="note.replyId" class="reply" :to="`/notes/${note.replyId}`"><i class="ti ti-arrow-back-up"></i></MkA>
<Mfm v-if="note.text" :text="note.text" :author="note.user" :i="$i"/>
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
</div>
<div v-if="note.files.length > 0" :class="$style.richcontent">
<MkMediaList :mediaList="note.files"/>
</div>
<div v-if="note.poll">
<MkPoll :note="note" :readOnly="true"/>
</div>
</div>
<MkReactionsViewer ref="reactionsViewer" :note="note"/>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { Note } from 'misskey-js/built/entities';
import { onUpdated } from 'vue';
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
import MkMediaList from '@/components/MkMediaList.vue';
import MkPoll from '@/components/MkPoll.vue';
import * as os from '@/os';
import { getScrollContainer } from '@/scripts/scroll';
import { $i } from '@/account';
let notes = $ref<Note[]>([]);
let isScrolling = $ref(false);
let scrollEl = $shallowRef<HTMLElement>();
os.apiGet('notes/featured').then(_notes => {
notes = _notes;
});
onUpdated(() => {
if (!scrollEl) return;
const container = getScrollContainer(scrollEl);
const containerHeight = container ? container.clientHeight : window.innerHeight;
if (scrollEl.offsetHeight > containerHeight) {
isScrolling = true;
}
});
</script>
<style lang="scss" module>
@keyframes scroll {
0% {
transform: translate3d(0, 0, 0);
}
5% {
transform: translate3d(0, 0, 0);
}
75% {
transform: translate3d(0, calc(-100% + 90vh), 0);
}
90% {
transform: translate3d(0, calc(-100% + 90vh), 0);
}
}
.root {
text-align: right;
}
.scrollbox {
&.scroll {
animation: scroll 45s linear infinite;
}
}
.note {
margin: 16px 0 16px auto;
}
.content {
padding: 16px;
margin: 0 0 0 auto;
max-width: max-content;
border-radius: 16px;
}
.richcontent {
min-width: 250px;
}
</style>