@@ -3,23 +3,34 @@ package components
3
3
import (
4
4
" github.com/ItsNotGoodName/smtpbridge/web/routes"
5
5
" github.com/ItsNotGoodName/smtpbridge/internal/models"
6
+ " github.com/ItsNotGoodName/smtpbridge/web/icons"
6
7
)
7
8
8
9
type AttachmentCardProps struct {
9
10
Attachment models.Attachment
10
11
}
11
12
12
13
templ AttachmentCard (props AttachmentCardProps ) {
13
- <div class =" card card-compact bg-base-100 border-base-200 w-full border sm:w-80" >
14
- if props.Attachment .IsImage () {
15
- <figure ><img src ={ routes.AttachmentFile (props.Attachment .FileName ()).URLString () } alt ={ props.Attachment .Name }/></figure >
16
- }
17
- <div class =" card-body" >
18
- <h2 class =" card-title break-all" >{ props.Attachment .Name }</h2 >
19
- <div class =" card-actions justify-end" >
20
- <a hx-boost =" false" href ={ routes.AttachmentFile (props.Attachment .FileName ()).URLQuery (" download=1" ) } class =" btn btn-primary" >Download</a >
14
+ <div class =" w-full sm:w-80" >
15
+ <div class =" card card-compact bg-base-100 border-base-200 border" >
16
+ if props.Attachment .IsImage () {
17
+ <figure class =" bg-base-content" ><img src ={ routes.AttachmentFile (props.Attachment .FileName ()).URLString () } alt ={ props.Attachment .Name }/></figure >
18
+ }
19
+ <div class =" flex-1 p-2 flex flex-col justify-end gap-2" >
20
+ <p class =" break-all font-bold" >{ props.Attachment .Name }</p >
21
+ <div class =" join flex justify-end" >
22
+ <a class =" join-item btn tooltip flex items-center" data-tip =" Envelope" href ={ routes.Envelope (props.Attachment .MessageID ).URLQuery (" tab=" + routes.EnvelopeTabAttachments .String ()) }>
23
+ @ icons.Mail (" h-5 w-5" )
24
+ </a >
25
+ <a class =" join-item btn tooltip flex items-center" data-tip =" View" hx-boost =" false" href ={ routes.AttachmentFile (props.Attachment .FileName ()).URL () }>
26
+ @ icons.Eye (" h-5 w-5" )
27
+ </a >
28
+ <a class =" join-item btn tooltip flex items-center" data-tip =" Download" hx-boost =" false" href ={ routes.AttachmentFile (props.Attachment .FileName ()).URLQuery (" download=1" ) }>
29
+ @ icons.Download (" h-5 w-5" )
30
+ </a >
31
+ </div >
21
32
</div >
22
- </div >
33
+ </div >
23
34
</div >
24
35
}
25
36
0 commit comments