WASM reactive UI framework for Go: - reactive/ - Signal[T], Effect, Runtime - ui/ - Button, Text, Input, View, Canvas, SVG components - navigation/ - Router, guards, history management - auth/ - OIDC client for WASM applications - host/ - Static file server Extracted from arcadia as open-source component. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
42
ui/font.go
Normal file
42
ui/font.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package ui
|
||||
|
||||
type Font struct {
|
||||
family string
|
||||
size string
|
||||
weight string
|
||||
lineheight string
|
||||
}
|
||||
|
||||
func NewFont() Font {
|
||||
return Font{
|
||||
family: "sans-serif",
|
||||
size: "16px",
|
||||
weight: "400",
|
||||
lineheight: "20px",
|
||||
}
|
||||
}
|
||||
|
||||
func (f Font) Family(family string) Font {
|
||||
f.family = family
|
||||
return f
|
||||
}
|
||||
|
||||
func (f Font) Size(size string) Font {
|
||||
f.size = size
|
||||
return f
|
||||
}
|
||||
|
||||
func (f Font) Weight(weight string) Font {
|
||||
f.weight = weight
|
||||
return f
|
||||
}
|
||||
|
||||
func (f Font) String() string {
|
||||
return f.weight + " " + f.size + " " + f.family + ""
|
||||
}
|
||||
|
||||
// todo we can't apply this straight via the css, we need to apply it to the lineheight of the parent
|
||||
func (f Font) LineHeight(lineheight string) Font {
|
||||
f.lineheight = lineheight
|
||||
return f
|
||||
}
|
||||
Reference in New Issue
Block a user