Skip to content

Commit a719205

Browse files
refactor(web): move icons to icons pkg
1 parent 15f686c commit a719205

15 files changed

+309
-65
lines changed

web/components/attachment_card.templ

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ templ AttachmentCard(props AttachmentCardProps) {
3131
</div>
3232
</div>
3333
</div>
34-
</div>
34+
</div>
3535
}
3636

web/components/base.templ

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
package components
22

33
templ Base(head, body templ.Component, csrfToken string) {
4-
<!DOCTYPE html>
5-
<html lang="en-US">
6-
<head>
7-
<meta charset="UTF-8"/>
8-
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
9-
<title>SMTPBridge</title>
10-
<meta name="description" content="Bridge email to other messaging services."/>
11-
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/>
12-
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
13-
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/>
14-
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/>
15-
<link rel="manifest" href="/site.webmanifest"/>
16-
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/>
17-
<meta name="msapplication-TileColor" content="#da532c"/>
18-
<meta name="theme-color" content="#ffffff"/>
4+
<!DOCTYPE html>
5+
<html lang="en-US">
6+
<head>
7+
<meta charset="UTF-8"/>
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
9+
<title>SMTPBridge</title>
10+
<meta name="description" content="Bridge email to other messaging services."/>
11+
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/>
12+
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
13+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/>
14+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/>
15+
<link rel="manifest" href="/site.webmanifest"/>
16+
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/>
17+
<meta name="msapplication-TileColor" content="#da532c"/>
18+
<meta name="theme-color" content="#ffffff"/>
1919
<meta name="gorilla.csrf.Token" content={ csrfToken } />
20-
{! head }
21-
</head>
22-
<body hx-boost="true">
23-
{! body }
24-
</body>
25-
</html>
20+
{! head }
21+
</head>
22+
<body hx-boost="true">
23+
{! body }
24+
</body>
25+
</html>
2626
}
2727

web/components/flash.templ

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package components
22

33
import (
44
"github.com/ItsNotGoodName/smtpbridge/web/routes"
5+
"github.com/ItsNotGoodName/smtpbridge/web/icons"
56
)
67

78
type FlashType int
@@ -17,20 +18,20 @@ type FlashProps struct {
1718
}
1819

1920
templ Flash(t FlashType, c templ.Component) {
20-
<div lass="flash">
21+
<div lass="flash">
2122
switch t {
2223
case FlashTypeSuccess:
2324
<div class="alert alert-success">
24-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
25+
@icons.CheckboxCircle("h-6 w-6")
2526
{! c }
2627
</div>
2728
default:
28-
<div class="alert alert-error">
29-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
30-
{! c }
31-
</div>
29+
<div class="alert alert-error">
30+
@icons.CloseCircle("h-6 w-6")
31+
{! c }
32+
</div>
3233
}
33-
</div>
34+
</div>
3435
}
3536

3637
templ FlashMessage(message string) {

web/components/flash_templ.go

+11-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/components/header.templ

+16-19
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,28 @@ templ Header(m meta.Meta) {
1010
<div class="navbar bg-base-100 border-b-base-200 sticky top-0 z-10 border-b">
1111
<div class="flex-none">
1212
<label for="my-drawer-2" class="drawer-button btn btn-square btn-ghost lg:hidden">
13-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
14-
class="inline-block h-5 w-5 stroke-current">
15-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
16-
</svg>
13+
@icons.Menu("h-5 w-5 inline-block")
1714
</label>
1815
</div>
1916
<div class="flex-1">
2017
<a class="btn btn-ghost text-xl normal-case" href={ routes.Index().URL() }>SMTPBridge</a>
2118
</div>
2219
if !m.Anonymous {
23-
<div class="flex-none">
24-
<details class="dropdown dropdown-end">
25-
<summary class="btn btn-square btn-ghost">
26-
@icons.More("h-5 w-5")
27-
</summary>
28-
<ul class="menu dropdown-content bg-base-100 rounded-box z-50 w-52 p-2 shadow-lg">
29-
<li>
30-
<a href="#" hx-delete={ routes.Logout().URLString() }>
31-
@icons.LogoutBoxR("h-4 w-4")
32-
Logout
33-
</a>
34-
</li>
35-
</ul>
36-
</details>
37-
</div>
20+
<div class="flex-none">
21+
<details class="dropdown dropdown-end">
22+
<summary class="btn btn-square btn-ghost">
23+
@icons.More("h-5 w-5")
24+
</summary>
25+
<ul class="menu dropdown-content bg-base-100 rounded-box z-50 w-52 p-2 shadow-lg">
26+
<li>
27+
<a href="#" hx-delete={ routes.Logout().URLString() }>
28+
@icons.LogoutBoxR("h-4 w-4")
29+
Logout
30+
</a>
31+
</li>
32+
</ul>
33+
</details>
34+
</div>
3835
}
3936
</div>
4037
}

web/components/header_templ.go

+9-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/components/paginate_header.templ

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ templ PaginateHeader(props PaginateHeaderProps) {
3838
ASC
3939
</a>
4040
} else {
41-
<a class="btn btn-sm btn-outline" href={ props.Route.URLQuery(helpers.Query(props.Query, "ascending", "1")) }>
42-
DESC
43-
</a>
41+
<a class="btn btn-sm btn-outline" href={ props.Route.URLQuery(helpers.Query(props.Query, "ascending", "1")) }>
42+
DESC
43+
</a>
4444
}
4545
</div>
4646
<div class="ml-auto flex flex-row items-center justify-between gap-4">

web/components/recent_envelope_list.templ

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"github.com/ItsNotGoodName/smtpbridge/web/helpers"
77
"github.com/ItsNotGoodName/smtpbridge/web/routes"
88
"github.com/ItsNotGoodName/smtpbridge/internal/models"
9-
"github.com/ItsNotGoodName/smtpbridge/web/meta"
10-
"github.com/ItsNotGoodName/smtpbridge/web/icons"
9+
"github.com/ItsNotGoodName/smtpbridge/web/meta"
10+
"github.com/ItsNotGoodName/smtpbridge/web/icons"
1111
)
1212

1313
type RecentEnvelopeListProps struct {

web/components/rule_form.templ

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import (
44
"strconv"
55

66
"github.com/ItsNotGoodName/smtpbridge/web/routes"
7-
"github.com/ItsNotGoodName/smtpbridge/internal/models"
7+
"github.com/ItsNotGoodName/smtpbridge/internal/models"
8+
"github.com/ItsNotGoodName/smtpbridge/web/icons"
89
)
910

1011
type RuleFormCreateProps struct {
@@ -109,7 +110,7 @@ templ RuleFormUpdate(props RuleFormUpdateProps) {
109110
</fieldset>
110111
if props.Rule.Internal {
111112
<div class="alert alert-warning">
112-
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>
113+
@icons.Alert("h-6 w-6")
113114
<span>Cannot be edited because it is an internal rule.</span>
114115
</div>
115116
}

web/components/rule_form_templ.go

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/components/table_order_th.templ

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import "github.com/ItsNotGoodName/smtpbridge/web/helpers"
66
import "net/url"
77

88
type TableOrderTHProps struct {
9-
Query url.Values
10-
Ascending bool
11-
Order string
12-
Field string
9+
Query url.Values
10+
Ascending bool
11+
Order string
12+
Field string
1313
}
1414

1515
func tableOrderTHAscending(enable, ascending bool) string {

web/icons/icons.templ

+24
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,27 @@ templ Download(class any) {
9393
<svg class={ class, "fill-current" } xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 19H21V21H3V19ZM13 13.1716L19.0711 7.1005L20.4853 8.51472L12 17L3.51472 8.51472L4.92893 7.1005L11 13.1716V2H13V13.1716Z"></path></svg>
9494
}
9595

96+
// https://remixicon.com/icon/checkbox-circle-line
97+
templ CheckboxCircle(class any) {
98+
<svg class={ class, "fill-current" } xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z"></path></svg>
99+
}
100+
101+
// https://remixicon.com/icon/close-circle-line
102+
templ CloseCircle(class any) {
103+
<svg class={ class, "fill-current" } viewBox="0 0 24 24"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 10.5858L14.8284 7.75736L16.2426 9.17157L13.4142 12L16.2426 14.8284L14.8284 16.2426L12 13.4142L9.17157 16.2426L7.75736 14.8284L10.5858 12L7.75736 9.17157L9.17157 7.75736L12 10.5858Z"></path></svg>
104+
}
105+
106+
// https://remixicon.com/icon/menu-line
107+
templ Menu(class any) {
108+
<svg class={ class, "fill-current" } xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 4H21V6H3V4ZM3 11H21V13H3V11ZM3 18H21V20H3V18Z"></path></svg>
109+
}
110+
111+
// https://remixicon.com/icon/error-warning-line
112+
templ ErrorWarning(class any) {
113+
<svg class={ class, "fill-current" } xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"></path></svg>
114+
}
115+
116+
// https://remixicon.com/icon/alert-line
117+
templ Alert(class any) {
118+
<svg class={ class, "fill-current" } xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.865 3.00017L22.3912 19.5002C22.6674 19.9785 22.5035 20.5901 22.0252 20.8662C21.8732 20.954 21.7008 21.0002 21.5252 21.0002H2.47266C1.92037 21.0002 1.47266 20.5525 1.47266 20.0002C1.47266 19.8246 1.51886 19.6522 1.60663 19.5002L11.1329 3.00017C11.4091 2.52187 12.0206 2.358 12.4989 2.63414C12.651 2.72191 12.7772 2.84815 12.865 3.00017ZM4.20471 19.0002H19.7932L11.9989 5.50017L4.20471 19.0002ZM10.9989 16.0002H12.9989V18.0002H10.9989V16.0002ZM10.9989 9.00017H12.9989V14.0002H10.9989V9.00017Z"></path></svg>
119+
}

0 commit comments

Comments
 (0)