Skip to content

Commit f167977

Browse files
authored
Merge pull request #1517 from session-foundation/dev
fix: styling for generic staged attachments
2 parents c741dc3 + 94c9fef commit f167977

File tree

2 files changed

+59
-54
lines changed

2 files changed

+59
-54
lines changed

stylesheets/_modules.scss

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -535,55 +535,9 @@
535535
position: relative;
536536
}
537537

538-
// Module: Staged Generic Attachment
539538

540-
.module-staged-generic-attachment {
541-
height: 120px;
542-
width: 120px;
543-
margin: 1px;
544-
display: inline-block;
545-
position: relative;
546-
border-radius: 4px;
547-
box-shadow: inset 0px 0px 0px 1px var(--border-color);
548-
background-color: var(--message-link-preview-background-color);
549-
vertical-align: middle;
550-
}
551539

552-
.module-staged-generic-attachment__icon__extension {
553-
font-size: 10px;
554-
line-height: 13px;
555-
letter-spacing: 0.1px;
556-
text-transform: uppercase;
557540

558-
// Along with flow layout in parent item, centers text
559-
text-align: center;
560-
width: 25px;
561-
margin-inline-start: auto;
562-
margin-inline-end: auto;
563-
564-
// We don't have much room for text here, cut it off without ellipse
565-
overflow-x: hidden;
566-
white-space: nowrap;
567-
text-overflow: clip;
568-
569-
color: var(--black-color);
570-
}
571-
572-
.module-staged-generic-attachment__filename {
573-
margin: 7px;
574-
margin-top: 5px;
575-
text-align: center;
576-
577-
font-family: var(--font-default);
578-
font-size: 14px;
579-
580-
overflow: hidden;
581-
height: 2.4rem;
582-
display: -webkit-box;
583-
-webkit-line-clamp: 2;
584-
-webkit-box-orient: vertical;
585-
text-overflow: ellipsis;
586-
}
587541

588542
// Module: Caption Editor
589543
.module-caption-editor {
Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,80 @@
1+
import styled from 'styled-components';
12
import { AttachmentType, getExtensionForDisplay } from '../../types/Attachment';
23
import { StagedAttachmentsCloseButton } from './StagedAttachementsCloseButton';
4+
import { LucideIcon } from '../icon/LucideIcon';
5+
import { LUCIDE_ICONS_UNICODE } from '../icon/lucide';
36

47
type Props = {
58
attachment: AttachmentType;
69
onClose: (attachment: AttachmentType) => void;
710
};
811

12+
const StyledIconExtension = styled.div`
13+
font-size: var(--font-size-sm);
14+
letter-spacing: 0.2px;
15+
text-transform: uppercase;
16+
17+
// Along with flow layout in parent item, centers text
18+
text-align: center;
19+
margin-inline-start: auto;
20+
margin-inline-end: auto;
21+
22+
// We don't have much room for text here, cut it off without ellipse
23+
overflow-x: hidden;
24+
white-space: nowrap;
25+
text-overflow: clip;
26+
27+
color: var(--text-primary-color);
28+
`;
29+
30+
const StyledFilename = styled.div`
31+
text-align: center;
32+
font-size: var(--font-size-sm);
33+
34+
white-space: break-spaces;
35+
overflow: hidden;
36+
display: -webkit-box;
37+
-webkit-line-clamp: 2;
38+
-webkit-box-orient: vertical;
39+
text-overflow: ellipsis;
40+
margin-inline: var(--margins-xs);
41+
`;
42+
43+
const StyledGenericAttachment = styled.div`
44+
height: 120px;
45+
width: 120px;
46+
margin: 1px;
47+
display: flex;
48+
flex-direction: column;
49+
justify-content: center;
50+
position: relative;
51+
border-radius: 4px;
52+
gap: var(--margins-sm);
53+
box-shadow: inset 0px 0px 0px 1px var(--border-color);
54+
background-color: var(--message-link-preview-background-color);
55+
text-align: center;
56+
`;
57+
958
export function StagedGenericAttachment(props: Props) {
1059
const { attachment, onClose } = props;
1160
const { fileName, contentType } = attachment;
1261
const extension = getExtensionForDisplay({ contentType, fileName });
1362

1463
return (
15-
<div className="module-staged-generic-attachment">
64+
<StyledGenericAttachment>
1665
<StagedAttachmentsCloseButton
1766
onClick={() => {
1867
onClose?.(attachment);
1968
}}
2069
/>
21-
<div className="module-staged-generic-attachment__icon">
22-
{extension ? (
23-
<div className="module-staged-generic-attachment__icon__extension">{extension}</div>
24-
) : null}
25-
</div>
26-
<div className="module-staged-generic-attachment__filename">{fileName}</div>
27-
</div>
70+
<LucideIcon
71+
iconSize="large"
72+
unicode={LUCIDE_ICONS_UNICODE.FILE}
73+
iconColor="var(--text-primary-color)"
74+
/>
75+
{extension ? <StyledIconExtension>{extension.slice(0, 4)}</StyledIconExtension> : null}
76+
77+
<StyledFilename>{fileName}</StyledFilename>
78+
</StyledGenericAttachment>
2879
);
2980
}

0 commit comments

Comments
 (0)