first
This commit is contained in:
80
src/views/service/cpns/ChatFileCard.vue
Normal file
80
src/views/service/cpns/ChatFileCard.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<script setup lang="ts">
|
||||
import { formatFileSize } from '@/utils/format'
|
||||
|
||||
interface FilePayload {
|
||||
name: string
|
||||
size: number
|
||||
}
|
||||
|
||||
interface Props {
|
||||
file: FilePayload
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<{ download: [] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="chat-file-card">
|
||||
<span class="chat-file-card__icon">📄</span>
|
||||
<div class="chat-file-card__info">
|
||||
<span class="chat-file-card__name" :title="file.name">{{ file.name }}</span>
|
||||
<span class="chat-file-card__size text-secondary">{{ formatFileSize(file.size) }}</span>
|
||||
</div>
|
||||
<button class="chat-file-card__download" @click="emit('download')">
|
||||
下载
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.chat-file-card {
|
||||
.flex(row, center);
|
||||
gap: @spacing-sm;
|
||||
min-width: 220px;
|
||||
max-width: 320px;
|
||||
padding: @spacing-sm @spacing-base;
|
||||
border: 1px solid @border-color;
|
||||
border-radius: @radius-base;
|
||||
background: @white;
|
||||
|
||||
&__icon {
|
||||
font-size: @font-size-xl;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
&__info {
|
||||
.flex(column, flex-start);
|
||||
gap: 2px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: @font-size-base;
|
||||
color: @heading-color;
|
||||
.ellipsis();
|
||||
}
|
||||
|
||||
&__size {
|
||||
font-size: @font-size-sm;
|
||||
}
|
||||
|
||||
&__download {
|
||||
flex-shrink: 0;
|
||||
height: 26px;
|
||||
padding: 0 @spacing-sm;
|
||||
border: 1px solid @primary-color;
|
||||
border-radius: @radius-sm;
|
||||
background: @white;
|
||||
color: @primary-color;
|
||||
font-size: @font-size-sm;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: @primary-light;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user