mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
* feat(did): remove account types * feat: Refactor Property to Proof in zkprop.go * feat: add ZKP proof mechanism for verifications * fix: return bool and error from pinInitialVault * feat: implement KeyshareSet for managing user and validator keyshares * feat: Update Credential type in protobuf * feat: update credential schema with sign count * feat: migrate and modules to middleware * refactor: rename vault module to ORM * chore(dwn): add service worker registration to index template * feat: integrate service worker for offline functionality * refactor(did): use DIDNamespace enum for verification method in proto reflection * refactor: update protobuf definitions to support Keyshare * feat: expose did keeper in app keepers * Add Motr Web App * refactor: rename motr/handlers/discovery.go to motr/handlers/openid.go * refactor: move session related code to middleware * feat: add database operations for managing assets, chains, and credentials * feat: add htmx support for UI updates * refactor: extract common helper scripts * chore: remove unused storage GUI components * refactor: Move frontend rendering to dedicated handlers * refactor: rename to * refactor: move alert implementation to templ * feat: add alert component with icon, title, and message * feat: add new RequestHeaders struct to store request headers * Feature/create home view (#9) * refactor: move view logic to new htmx handler * refactor: remove unnecessary dependencies * refactor: remove unused dependencies * feat(devbox): integrate air for local development * feat: implement openid connect discovery document * refactor: rename to * refactor(did): update service handling to support DNS discovery * feat: add support for user and validator keyshares * refactor: move keyshare signing logic to signer
125 lines
2.2 KiB
Templ
125 lines
2.2 KiB
Templ
package elements
|
|
|
|
import "fmt"
|
|
|
|
func Text(content string, options ...Variant) templ.Component {
|
|
if err := ValidTextVariants(options...); err != nil {
|
|
return renderParagraph(clsxMerge(TextSizeDefault, TextStyleDefault), content)
|
|
}
|
|
return renderParagraph(clsxMerge(options...), content)
|
|
}
|
|
|
|
func ValidTextVariants(variants ...Variant) error {
|
|
for _, v := range variants {
|
|
switch v.(type) {
|
|
case TextSize:
|
|
case TextStyle:
|
|
default:
|
|
return fmt.Errorf("invalid text variant: %v", v)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
templ renderHeading(attrs templ.Attributes, text string) {
|
|
<h1 { attrs... }>
|
|
{ text }
|
|
</h1>
|
|
}
|
|
|
|
templ renderParagraph(attrs templ.Attributes, text string) {
|
|
<p { attrs... }>
|
|
{ text }
|
|
</p>
|
|
}
|
|
|
|
templ renderLink(attrs templ.Attributes, text string) {
|
|
<a { attrs... }>
|
|
{ text }
|
|
</a>
|
|
}
|
|
|
|
templ renderStrong(attrs templ.Attributes, text string) {
|
|
<strong { attrs... }>
|
|
{ text }
|
|
</strong>
|
|
}
|
|
|
|
templ renderEmphasis(attrs templ.Attributes, text string) {
|
|
<em { attrs... }>
|
|
{ text }
|
|
</em>
|
|
}
|
|
|
|
templ renderCode(attrs templ.Attributes, text string) {
|
|
<code { attrs... }>
|
|
{ text }
|
|
</code>
|
|
}
|
|
|
|
type TextSize int
|
|
|
|
const (
|
|
TextSizeDefault TextSize = iota
|
|
TextSizeSmall
|
|
TextSizeMedium
|
|
TextSizeLarge
|
|
)
|
|
|
|
func (s TextSize) Attributes() templ.Attributes {
|
|
switch s {
|
|
case TextSizeSmall:
|
|
return templ.Attributes{
|
|
"class": "text-sm",
|
|
}
|
|
case TextSizeLarge:
|
|
return templ.Attributes{
|
|
"class": "text-xl",
|
|
}
|
|
}
|
|
return templ.Attributes{
|
|
"class": "text-md",
|
|
}
|
|
}
|
|
|
|
type TextStyle int
|
|
|
|
const (
|
|
TextStyleDefault TextStyle = iota
|
|
TextStyleHeading
|
|
TextStyleParagraph
|
|
TextStyleLink
|
|
TextStyleStrong
|
|
TextStyleEmphasis
|
|
TextStyleCode
|
|
)
|
|
|
|
func (s TextStyle) Attributes() templ.Attributes {
|
|
switch s {
|
|
case TextStyleHeading:
|
|
return templ.Attributes{
|
|
"class": "text-xl font-bold text-xl",
|
|
}
|
|
case TextStyleParagraph:
|
|
return templ.Attributes{
|
|
"class": "text-base font-normal",
|
|
}
|
|
case TextStyleLink:
|
|
return templ.Attributes{
|
|
"class": "text-blue-600 font-medium underline",
|
|
}
|
|
case TextStyleStrong:
|
|
return templ.Attributes{
|
|
"class": "font-semibold text-md",
|
|
}
|
|
case TextStyleCode:
|
|
return templ.Attributes{
|
|
"class": "text-stone-800 font-mono",
|
|
}
|
|
default:
|
|
return templ.Attributes{
|
|
"class": "text-base font-normal text-md",
|
|
}
|
|
}
|
|
}
|