diff --git a/web/components/attachment_card.templ b/web/components/attachment_card.templ index f99d5115..abe8a8bb 100644 --- a/web/components/attachment_card.templ +++ b/web/components/attachment_card.templ @@ -3,6 +3,7 @@ package components import ( "github.com/ItsNotGoodName/smtpbridge/web/routes" "github.com/ItsNotGoodName/smtpbridge/internal/models" + "github.com/ItsNotGoodName/smtpbridge/web/icons" ) type AttachmentCardProps struct { @@ -10,16 +11,26 @@ type AttachmentCardProps struct { } templ AttachmentCard(props AttachmentCardProps) { -
- if props.Attachment.IsImage() { -
{
- } -
-

{ props.Attachment.Name }

-
- Download +
+
+ if props.Attachment.IsImage() { +
{
+ } + -
+
} diff --git a/web/components/attachment_card_templ.go b/web/components/attachment_card_templ.go index c0573453..8ff968b2 100644 --- a/web/components/attachment_card_templ.go +++ b/web/components/attachment_card_templ.go @@ -11,6 +11,7 @@ import "bytes" import ( "github.com/ItsNotGoodName/smtpbridge/internal/models" + "github.com/ItsNotGoodName/smtpbridge/web/icons" "github.com/ItsNotGoodName/smtpbridge/web/routes" ) @@ -31,12 +32,12 @@ func AttachmentCard(props AttachmentCardProps) templ.Component { var_1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, err = templBuffer.WriteString("
") + _, err = templBuffer.WriteString("
") if err != nil { return err } diff --git a/web/components/envelope_tab.templ b/web/components/envelope_tab.templ index 6c887db0..6d7dfd87 100644 --- a/web/components/envelope_tab.templ +++ b/web/components/envelope_tab.templ @@ -13,20 +13,20 @@ type EnvelopeTabProps struct { } templ EnvelopeTab(props EnvelopeTabProps) { -
+
- + Text if props.Envelope.Message.HTML != "" { - + HTML } if len(props.Envelope.Attachments) != 0 { - + Attachments
{ strconv.Itoa(len(props.Envelope.Attachments)) } diff --git a/web/components/envelope_tab_templ.go b/web/components/envelope_tab_templ.go index f9fe770d..c1cd07e0 100644 --- a/web/components/envelope_tab_templ.go +++ b/web/components/envelope_tab_templ.go @@ -34,7 +34,7 @@ func EnvelopeTab(props EnvelopeTabProps) templ.Component { var_1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, err = templBuffer.WriteString("
") + _, err = templBuffer.WriteString("
") if err != nil { return err } @@ -59,7 +59,7 @@ func EnvelopeTab(props EnvelopeTabProps) templ.Component { if err != nil { return err } - _, err = templBuffer.WriteString("\" aria-controls=\"tab-content\" role=\"tab\">") + _, err = templBuffer.WriteString("\" aria-controls=\"tab-content\" role=\"tab\" hx-target=\"#tabs\" hx-swap=\"innerHTML\">") if err != nil { return err } @@ -94,7 +94,7 @@ func EnvelopeTab(props EnvelopeTabProps) templ.Component { if err != nil { return err } - _, err = templBuffer.WriteString("\" aria-controls=\"tab-content\" role=\"tab\">") + _, err = templBuffer.WriteString("\" aria-controls=\"tab-content\" role=\"tab\" hx-target=\"#tabs\" hx-swap=\"innerHTML\">") if err != nil { return err } @@ -130,7 +130,7 @@ func EnvelopeTab(props EnvelopeTabProps) templ.Component { if err != nil { return err } - _, err = templBuffer.WriteString("\" aria-controls=\"tab-content\" role=\"tab\">") + _, err = templBuffer.WriteString("\" aria-controls=\"tab-content\" role=\"tab\" hx-target=\"#tabs\" hx-swap=\"innerHTML\">") if err != nil { return err } diff --git a/web/icons/icons.templ b/web/icons/icons.templ index 28c79998..d9e4d9e1 100644 --- a/web/icons/icons.templ +++ b/web/icons/icons.templ @@ -88,3 +88,8 @@ templ ArrowDownS(class any) { } +// https://remixicon.com/icon/download-line +templ Download(class any) { + +} + diff --git a/web/icons/icons_templ.go b/web/icons/icons_templ.go index c9c1404d..ca13bae2 100644 --- a/web/icons/icons_templ.go +++ b/web/icons/icons_templ.go @@ -691,3 +691,42 @@ func ArrowDownS(class any) templ.Component { return err }) } + +// https://remixicon.com/icon/download-line + +func Download(class any) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) { + templBuffer, templIsBuffer := w.(*bytes.Buffer) + if !templIsBuffer { + templBuffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templBuffer) + } + ctx = templ.InitializeContext(ctx) + var_36 := templ.GetChildren(ctx) + if var_36 == nil { + var_36 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + var var_37 = []any{class, "fill-current"} + err = templ.RenderCSSItems(ctx, templBuffer, var_37...) + if err != nil { + return err + } + _, err = templBuffer.WriteString("") + if err != nil { + return err + } + if !templIsBuffer { + _, err = templBuffer.WriteTo(w) + } + return err + }) +}