This commit is contained in:
syuilo 2023-05-24 14:34:46 +09:00
parent 1de774fa3d
commit d2eec3a9e4
3 changed files with 59 additions and 74 deletions

View file

@ -1,16 +1,16 @@
<template>
<div v-show="props.modelValue.length != 0" class="skeikyzd">
<Sortable :modelValue="props.modelValue" class="files" itemKey="id" :animation="150" :delay="100" :delayOnTouchOnly="true" @update:modelValue="v => emit('update:modelValue', v)">
<div v-show="props.modelValue.length != 0" :class="$style.root">
<Sortable :modelValue="props.modelValue" :class="$style.files" itemKey="id" :animation="150" :delay="100" :delayOnTouchOnly="true" @update:modelValue="v => emit('update:modelValue', v)">
<template #item="{element}">
<div class="file" @click="showFileMenu(element, $event)" @contextmenu.prevent="showFileMenu(element, $event)">
<MkDriveFileThumbnail :data-id="element.id" class="thumbnail" :file="element" fit="cover"/>
<div v-if="element.isSensitive" class="sensitive">
<i class="ti ti-alert-triangle icon"></i>
<div :class="$style.file" @click="showFileMenu(element, $event)" @contextmenu.prevent="showFileMenu(element, $event)">
<MkDriveFileThumbnail :data-id="element.id" :class="$style.thumbnail" :file="element" fit="cover"/>
<div v-if="element.isSensitive" :class="$style.sensitive">
<i class="ti ti-alert-triangle" style="margin: auto;"></i>
</div>
</div>
</template>
</Sortable>
<p class="remain">{{ 16 - props.modelValue.length }}/16</p>
<p :class="$style.remain">{{ 16 - props.modelValue.length }}/16</p>
</div>
</template>
@ -108,16 +108,18 @@ function showFileMenu(file, ev: MouseEvent) {
}
</script>
<style lang="scss" scoped>
.skeikyzd {
<style lang="scss" module>
.root {
padding: 8px 16px;
position: relative;
}
> .files {
.files {
display: flex;
flex-wrap: wrap;
}
> .file {
.file {
position: relative;
width: 64px;
height: 64px;
@ -125,19 +127,16 @@ function showFileMenu(file, ev: MouseEvent) {
border-radius: 4px;
overflow: hidden;
cursor: move;
&:hover > .remove {
display: block;
}
> .thumbnail {
.thumbnail {
width: 100%;
height: 100%;
z-index: 1;
color: var(--fg);
}
> .sensitive {
.sensitive {
display: flex;
position: absolute;
width: 64px;
@ -147,21 +146,15 @@ function showFileMenu(file, ev: MouseEvent) {
z-index: 2;
background: rgba(17, 17, 17, .7);
color: #fff;
> .icon {
margin: auto;
}
}
}
}
> .remain {
.remain {
display: block;
position: absolute;
top: 8px;
right: 8px;
margin: 0;
padding: 0;
}
font-size: 90%;
}
</style>

View file

@ -72,7 +72,3 @@ defineExpose<WidgetComponentExpose>({
id: props.widget ? props.widget.id : null,
});
</script>
<style lang="scss" scoped>
</style>

View file

@ -1,8 +1,10 @@
<template>
<div data-cy-mkw-onlineUsers class="mkw-onlineUsers" :class="{ _panel: !widgetProps.transparent, pad: !widgetProps.transparent }">
<I18n v-if="onlineUsersCount" :src="i18n.ts.onlineUsersCount" textTag="span" class="text">
<template #n><b>{{ number(onlineUsersCount) }}</b></template>
<div data-cy-mkw-onlineUsers :class="[$style.root, { _panel: !widgetProps.transparent, [$style.pad]: !widgetProps.transparent }]">
<span :class="$style.text">
<I18n v-if="onlineUsersCount" :src="i18n.ts.onlineUsersCount" textTag="span">
<template #n><b style="color: #41b781;">{{ number(onlineUsersCount) }}</b></template>
</I18n>
</span>
</div>
</template>
@ -55,22 +57,16 @@ defineExpose<WidgetComponentExpose>({
});
</script>
<style lang="scss" scoped>
.mkw-onlineUsers {
<style lang="scss" module>
.root {
text-align: center;
&.pad {
padding: 16px 0;
}
> .text {
::v-deep(b) {
color: #41b781;
}
::v-deep(span) {
opacity: 0.7;
}
}
.text {
color: var(--fgTransparentWeak);
}
</style>