-
-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathstyle.go
66 lines (49 loc) · 1.35 KB
/
style.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package style
import (
"strconv"
"github.com/hexops/vecty"
)
type Size string
func Px(pixels int) Size {
return Size(strconv.Itoa(pixels) + "px")
}
func Color(value string) vecty.Applyer {
return vecty.Style("color", value)
}
func Width(size Size) vecty.Applyer {
return vecty.Style("width", string(size))
}
func MinWidth(size Size) vecty.Applyer {
return vecty.Style("min-width", string(size))
}
func MaxWidth(size Size) vecty.Applyer {
return vecty.Style("max-width", string(size))
}
func Height(size Size) vecty.Applyer {
return vecty.Style("height", string(size))
}
func MinHeight(size Size) vecty.Applyer {
return vecty.Style("min-height", string(size))
}
func MaxHeight(size Size) vecty.Applyer {
return vecty.Style("max-height", string(size))
}
func Margin(size Size) vecty.Applyer {
return vecty.Style("margin", string(size))
}
type OverflowOption string
const (
OverflowVisible OverflowOption = "visible"
OverflowHidden OverflowOption = "hidden"
OverflowScroll OverflowOption = "scroll"
OverflowAuto OverflowOption = "auto"
)
func Overflow(option OverflowOption) vecty.Applyer {
return vecty.Style("overflow", string(option))
}
func OverflowX(option OverflowOption) vecty.Applyer {
return vecty.Style("overflow-x", string(option))
}
func OverflowY(option OverflowOption) vecty.Applyer {
return vecty.Style("overflow-y", string(option))
}