Files
vctp2/components/core/ui.templ
T
nathan 8ccf5a7009
continuous-integration/drone/push Build is passing
enhance utilisation of postgres features
2026-04-20 10:19:27 +10:00

68 lines
1.4 KiB
Plaintext

package core
type ActionLink struct {
Label string
Href string
Class string
}
type SegmentedLink struct {
Label string
Href string
Class string
}
func actionLinkClass(class string) string {
if class == "" {
return "web2-button"
}
return class
}
func segmentedLinkClass(class string) string {
if class == "" {
return "web3-button"
}
return class
}
templ PageHeader(pill string, title string, subtitle string, actions []ActionLink) {
<div class="web2-page-head-row">
<div class="web2-head-copy">
if pill != "" {
<div class="web2-pill">{ pill }</div>
}
<h1 class="web2-page-title">{ title }</h1>
if subtitle != "" {
<p class="web2-page-subtitle">{ subtitle }</p>
}
</div>
if len(actions) > 0 {
<div class="web2-actions">
for _, action := range actions {
<a class={ actionLinkClass(action.Class) } href={ action.Href }>{ action.Label }</a>
}
</div>
}
</div>
}
templ SegmentedActions(actions []SegmentedLink) {
if len(actions) > 0 {
<div class="web3-button-group">
for _, action := range actions {
<a class={ segmentedLinkClass(action.Class) } href={ action.Href }>{ action.Label }</a>
}
</div>
}
}
templ SectionHead(title string, badge string) {
<div class="web2-section-head">
<h2 class="web2-section-title">{ title }</h2>
if badge != "" {
<span class="web2-badge">{ badge }</span>
}
</div>
}