Layout for AttachmentPresenter (#283)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2021-10-23 19:34:15 +03:00 committed by GitHub
parent 6813bedc55
commit 6f0daa1dfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,11 +15,39 @@
-->
<script lang="ts">
import type { Attachment } from '@anticrm/chunter'
import type { Attachment } from '@anticrm/chunter'
export let value: Attachment
export let value: Attachment
const maxLenght: number = 16
const trimFilename = (fname: string): string => (fname.length > maxLenght)
? fname.substr(0, (maxLenght - 1) / 2) + '...' + fname.substr(-(maxLenght - 1) / 2)
: fname
</script>
{JSON.stringify(value)}
<div class="flex-row-center">
<div class="flex-center icon">PDF</div>
<div class="flex-col">
<div class="caption-color">{trimFilename(value.name)}</div>
<div class="type">{value.type}</div>
</div>
</div>
<style lang="scss">
.icon {
flex-shrink: 0;
margin-right: 1.25rem;
width: 2rem;
height: 2rem;
font-weight: 500;
font-size: .625rem;
color: var(--primary-button-color);
background-color: var(--primary-button-enabled);
border: 1px solid rgba(0, 0, 0, .1);
border-radius: .5rem;
}
.type {
font-size: .75rem;
color: var(--theme-content-dark-color);
}
</style>