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

View file

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

View file

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