Skip to content

Commit

Permalink
OGPプレビュー追加
Browse files Browse the repository at this point in the history
  • Loading branch information
tamo-morita committed May 6, 2023
1 parent 9c4e6ce commit 4eb0a6d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/frontend/src/components/MkNotePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<div>
<div :class="$style.content">
<Mfm :text="text.trim()" :author="$i" :i="$i"/>
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/>
</div>
</div>
</div>
Expand All @@ -17,10 +18,14 @@
<script lang="ts" setup>
import { } from 'vue';
import { $i } from '@/account';
import MkUrlPreview from '@/components/MkUrlPreview.vue';
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
import * as mfm from 'mfm-js';
const props = defineProps<{
text: string;
}>();
const urls = props.text ? extractUrlFromMfm(mfm.parse(props.text)) : null;
</script>

<style lang="scss" module>
Expand Down Expand Up @@ -55,6 +60,11 @@ const props = defineProps<{
text-overflow: ellipsis;
}
.urlPreview {
margin-top: 8px;
margin-bottom: 8px;
}
@container (min-width: 350px) {
.avatar {
margin: 0 10px 0 0 !important;
Expand Down

0 comments on commit 4eb0a6d

Please sign in to comment.