/
lineHeight.go
47 lines (35 loc) · 928 Bytes
/
lineHeight.go
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
package lineHeight
import (
"github.com/gopherjs/vecty"
"github.com/nathanhack/vectyUI/internal"
)
type Type string
const (
Normal Type = "normal"
Initial Type = "initial"
Inherit Type = "inherit"
styleName = "line-height"
)
func (t Type) Apply(h *vecty.HTML) {
vecty.Style(styleName, string(t)).Apply(h)
}
func (t Type) AddTo(m map[string]string) {
m[styleName] = string(t)
}
func Percent(percent interface{}) Type {
return Type(internal.Stringify(percent, "%"))
}
func Pixels(length interface{}) Type {
return Type(internal.Stringify(length, "px"))
}
//Number - A number that will be multiplied with the current font-size to set the line height
func Number(number interface{}) Type {
return Type(internal.Stringify(number, ""))
}
type Value Type
func (v Value) Apply(h *vecty.HTML) {
vecty.Style(styleName, string(v)).Apply(h)
}
func (v Value) AddTo(m map[string]string) {
m[styleName] = string(v)
}