-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypography.templ
More file actions
164 lines (155 loc) · 2.76 KB
/
typography.templ
File metadata and controls
164 lines (155 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package popui
import (
"github.com/invopop/icons"
"github.com/invopop/popui.go/props"
"github.com/invopop/popui.go/tailwind"
)
// P provides a paragraph element with default styling.
templ P(opts ...props.P) {
{{ p := props.First(opts) }}
<p
if p.ID != "" {
id={ p.ID }
}
class={
tailwind.Merge(
"font-sans text-base text-foreground",
p.Class,
),
}
{ p.Attributes... }
>
{ children... }
</p>
}
// Title provides an h1 element with heading styling.
templ Title(opts ...props.Title) {
{{ p := props.First(opts) }}
<h1
if p.ID != "" {
id={ p.ID }
}
class={
tailwind.Merge(
"font-sans text-foreground text-lg font-semibold",
p.Class,
),
}
{ p.Attributes... }
>
{ children... }
</h1>
}
// Subtitle provides an h2 element with subheading styling.
templ Subtitle(opts ...props.Subtitle) {
{{ p := props.First(opts) }}
<h2
if p.ID != "" {
id={ p.ID }
}
class={
tailwind.Merge(
"font-sans text-base text-foreground-default-secondary",
p.Class,
),
}
{ p.Attributes... }
>
{ children... }
</h2>
}
// Description provides a paragraph element with secondary text styling.
templ Description(opts ...props.Description) {
{{ p := props.First(opts) }}
<p
if p.ID != "" {
id={ p.ID }
}
class={
tailwind.Merge(
"text-foreground-default-secondary font-sans text-base",
p.Class,
),
}
{ p.Attributes... }
>
{ children... }
</p>
}
// Info provides an info box with icon and text.
templ Info(opts ...props.Info) {
{{ p := props.First(opts) }}
<div
if p.ID != "" {
id={ p.ID }
}
class={
tailwind.Merge(
"font-sans text-sm text-foreground-default-secondary flex items-center gap-1",
p.Class,
),
}
{ p.Attributes... }
>
<div>
@InfoIcon()
</div>
<div class="flex-1">
{ children... }
</div>
</div>
}
// Warning provides a warning box with alert icon and text.
templ Warning(opts ...props.Warning) {
{{ p := props.First(opts) }}
<div
if p.ID != "" {
id={ p.ID }
}
class={
tailwind.Merge(
"font-sans text-sm text-foreground-default-secondary flex items-center gap-1",
p.Class,
),
}
{ p.Attributes... }
>
<div>
@icons.Alert()
</div>
<div class="flex-1">
{ children... }
</div>
</div>
}
// Mark provides a mark element for highlighted text.
templ Mark(opts ...props.Mark) {
{{ p := props.First(opts) }}
<mark
if p.ID != "" {
id={ p.ID }
}
class={ p.Class }
{ p.Attributes... }
>
{ children... }
</mark>
}
// Prose provides a wrapper for rendering raw HTML with default prose styling.
templ Prose(opts ...props.Prose) {
{{ p := props.First(opts) }}
<div
if p.ID != "" {
id={ p.ID }
}
class={
tailwind.Merge(
"prose",
p.Class,
),
}
{ p.Attributes... }
>
{ children... }
</div>
}