diff --git a/src/components/common/messaging/bars/FilePreview.tsx b/src/components/common/messaging/bars/FilePreview.tsx index 8bd55d3a..44d94f5f 100644 --- a/src/components/common/messaging/bars/FilePreview.tsx +++ b/src/components/common/messaging/bars/FilePreview.tsx @@ -31,14 +31,6 @@ const Entry = styled.div` display: flex; flex-direction: column; - img { - height: 100px; - margin-bottom: 4px; - border-radius: 4px; - object-fit: contain; - background: var(--secondary-background); - } - &.fade { opacity: 0.4; } @@ -59,27 +51,6 @@ const Entry = styled.div` color: var(--tertiary-foreground); text-align: center; } - - div:first-child { - position: relative; - height: 0; - - div { - display: grid; - height: 100px; - cursor: pointer; - border-radius: 4px; - place-items: center; - - opacity: 0; - transition: 0.1s ease opacity; - background: rgba(0, 0, 0, 0.8); - - &:hover { - opacity: 1; - } - } - } `; const Description = styled.div` @@ -114,13 +85,58 @@ const EmptyEntry = styled.div` } `; +const PreviewBox = styled.div` + display: grid; + grid-template: "main" 100px / minmax(100px, 1fr); + justify-items: center; + + background: var(--primary-background); + + overflow: hidden; + + cursor: pointer; + border-radius: 4px; + + .icon, .overlay { grid-area: main } + + .icon { + height: 100px; + margin-bottom: 4px; + object-fit: contain; + } + + .overlay { + display: grid; + align-items: center; + justify-content: center; + + width: 100%; + height: 100%; + + opacity: 0; + visibility: hidden; + + transition: 0.1s ease opacity; + } + + &:hover { + .overlay { + visibility: visible; + opacity: 1; + background-color: rgba(0, 0, 0, 0.8); + } + } +` + function FileEntry({ file, remove, index }: { file: File, remove?: () => void, index: number }) { if (!file.type.startsWith('image/')) return ( = CAN_UPLOAD_AT_ONCE ? 'fade' : ''}> -
- - - + + + + +
+
{file.name} {determineFileSize(file.size)}
@@ -136,9 +152,10 @@ function FileEntry({ file, remove, index }: { file: File, remove?: () => void, i return ( = CAN_UPLOAD_AT_ONCE ? 'fade' : ''}> - { remove &&
} - {file.name} + + {file.name} +
+
{file.name} {determineFileSize(file.size)}