@@ -7,6 +7,7 @@ import { when } from 'lit/directives/when.js';
7
7
import '../discord-link/DiscordLink.js' ;
8
8
import type { LightTheme } from '../../types.js' ;
9
9
import { messagesLightTheme } from '../discord-messages/DiscordMessages.js' ;
10
+ import AttachmentDownloadButton from '../svgs/AttachmentDownloadButton.js' ;
10
11
import FileAttachment from '../svgs/FileAttachment.js' ;
11
12
12
13
@customElement ( 'discord-file-attachment' )
@@ -35,11 +36,35 @@ export class DiscordFileAttachment extends LitElement implements LightTheme {
35
36
align-self: start;
36
37
}
37
38
39
+ .discord-file-attachment-non-visual-media-item-container:hover .discord-button-download-attachment {
40
+ display: block !important;
41
+ }
42
+
43
+ .discord-button-download-attachment {
44
+ display: none;
45
+ position: absolute;
46
+ top: -8px;
47
+ right: -8px;
48
+ border-radius: 5px;
49
+ outline: color-mix(in oklab, hsl(220 calc(1 * 6.5%) 18% / 1) 100%, black 0%);
50
+ background-color: color-mix(in oklab, hsl(223 calc(1 * 6.7%) 20.6% / 1) 100%, black 0%);
51
+ }
52
+
53
+ .discord-link-download-attachment {
54
+ color: color-mix(in oklab, hsl(215 calc(1 * 8.8%) 73.3% / 1) 100%, black 0%);
55
+ display: flex;
56
+ }
57
+
58
+ .discord-icon-download {
59
+ padding: 6px;
60
+ }
61
+
38
62
.discord-file-attachment-non-visual-media-item-container {
39
63
margin-top: 8px;
40
64
max-width: 100%;
41
65
display: flex;
42
66
flex-direction: column;
67
+ position: relative;
43
68
}
44
69
45
70
.discord-file-attachment-non-visual-media-item {
@@ -211,6 +236,19 @@ export class DiscordFileAttachment extends LitElement implements LightTheme {
211
236
</ div >
212
237
</ div >
213
238
</ div >
239
+ < div class ="discord-button-download-attachment ">
240
+ < a
241
+ class ="discord-link-download-attachment "
242
+ aria-label ="Download "
243
+ href ="${ ifDefined ( this . href ) } "
244
+ rel ="noreferrer noopener "
245
+ target ="_blank "
246
+ role ="button "
247
+ tabindex ="0 "
248
+ >
249
+ ${ AttachmentDownloadButton ( ) }
250
+ </ a >
251
+ </ div >
214
252
</ div > ` ;
215
253
}
216
254
}
0 commit comments