Skip to content

Commit 8856d68

Browse files
taiymetamaina
andauthored
enhance(client): MkUrlPreviewの閉じるボタンを見やすく (#9913)
Co-authored-by: tamaina <[email protected]>
1 parent 9edd0d2 commit 8856d68

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

packages/frontend/src/components/MkUrlPreview.vue

+21-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
<template>
2-
<div v-if="playerEnabled" :class="$style.player" :style="`padding: ${(player.height || 0) / (player.width || 1) * 100}% 0 0`">
3-
<button :class="$style.disablePlayer" :title="i18n.ts.disablePlayer" @click="playerEnabled = false"><i class="ti ti-x"></i></button>
4-
<iframe v-if="player.url.startsWith('http://') || player.url.startsWith('https://')" :class="$style.playerIframe" :src="player.url + (player.url.match(/\?/) ? '&autoplay=1&auto_play=1' : '?autoplay=1&auto_play=1')" :width="player.width || '100%'" :heigth="player.height || 250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen/>
5-
<span v-else>invalid url</span>
6-
</div>
7-
<div v-else-if="tweetId && tweetExpanded" ref="twitter" :class="$style.twitter">
8-
<iframe ref="tweet" scrolling="no" frameborder="no" :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px` }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&amp;hideCard=false&amp;hideThread=false&amp;lang=en&amp;theme=${$store.state.darkMode ? 'dark' : 'light'}&amp;id=${tweetId}`"></iframe>
9-
</div>
2+
<template v-if="playerEnabled">
3+
<div :class="$style.player" :style="`padding: ${(player.height || 0) / (player.width || 1) * 100}% 0 0`">
4+
<iframe v-if="player.url.startsWith('http://') || player.url.startsWith('https://')" :class="$style.playerIframe" :src="player.url + (player.url.match(/\?/) ? '&autoplay=1&auto_play=1' : '?autoplay=1&auto_play=1')" :width="player.width || '100%'" :heigth="player.height || 250" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen/>
5+
<span v-else>invalid url</span>
6+
</div>
7+
<div :class="$style.action">
8+
<MkButton :small="true" inline @click="playerEnabled = false">
9+
<i class="ti ti-x"></i> {{ i18n.ts.disablePlayer }}
10+
</MkButton>
11+
</div>
12+
</template>
13+
<template v-else-if="tweetId && tweetExpanded">
14+
<div ref="twitter" :class="$style.twitter">
15+
<iframe ref="tweet" scrolling="no" frameborder="no" :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px` }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&amp;hideCard=false&amp;hideThread=false&amp;lang=en&amp;theme=${$store.state.darkMode ? 'dark' : 'light'}&amp;id=${tweetId}`"></iframe>
16+
</div>
17+
<div :class="$style.action">
18+
<MkButton :small="true" inline @click="tweetExpanded = false">
19+
<i class="ti ti-x"></i> {{ i18n.ts.close }}
20+
</MkButton>
21+
</div>
22+
</template>
1023
<div v-else :class="$style.urlPreview">
1124
<component :is="self ? 'MkA' : 'a'" :class="[$style.link, { [$style.compact]: compact }]" :[attr]="self ? url.substr(local.length) : url" rel="nofollow noopener" :target="target" :title="url">
1225
<div v-if="thumbnail" :class="$style.thumbnail" :style="`background-image: url('${thumbnail}')`">

0 commit comments

Comments
 (0)