/
Border.purs
138 lines (98 loc) · 3.3 KB
/
Border.purs
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
module CSS.Border
(
-- * Stroke type, used for border-style and outline-style.
Stroke(..)
, solid
, dotted
, dashed
, double
, wavy
, groove
, ridge
, inset
, outset
-- * Border properties.
, border
, borderTop
, borderLeft
, borderBottom
, borderRight
, borderColor
-- * Outline properties.
, outline
, outlineColor
, outlineStyle
, outlineWidth
, outlineOffset
-- * Border radius.
, borderRadius
-- * Collapsing borders model for a table
, borderSpacing
) where
import Prelude
import CSS.Color (Color)
import CSS.Common (class Inherit, class Initial, class Unset)
import CSS.Property (class Val, Value, (!))
import CSS.Size (Size, LengthUnit)
import CSS.String (class IsString, fromString)
import CSS.Stylesheet (CSS, key)
import Data.Tuple (Tuple(..))
newtype Stroke = Stroke Value
derive instance eqStroke :: Eq Stroke
derive instance ordStroke :: Ord Stroke
instance isStringStroke :: IsString Stroke where
fromString = Stroke <<< fromString
instance valStroke :: Val Stroke where
value (Stroke v) = v
instance inheritStroke :: Inherit Stroke where
inherit = fromString "inherit"
instance initialStroke :: Initial Stroke where
initial = fromString "initial"
instance unsetStroke :: Unset Stroke where
unset = fromString "unset"
solid :: Stroke
solid = Stroke $ fromString "solid"
dotted :: Stroke
dotted = Stroke $ fromString "dotted"
dashed :: Stroke
dashed = Stroke $ fromString "dashed"
double :: Stroke
double = Stroke $ fromString "double"
wavy :: Stroke
wavy = Stroke $ fromString "wavy"
groove :: Stroke
groove = Stroke $ fromString "groove"
ridge :: Stroke
ridge = Stroke $ fromString "ridge"
inset :: Stroke
inset = Stroke $ fromString "inset"
outset :: Stroke
outset = Stroke $ fromString "outset"
border :: Stroke -> Size LengthUnit -> Color -> CSS
border a b c = key (fromString "border") (Tuple a (Tuple b c))
borderTop :: Stroke -> Size LengthUnit -> Color -> CSS
borderTop a b c = key (fromString "border-top") (Tuple a (Tuple b c))
borderBottom :: Stroke -> Size LengthUnit -> Color -> CSS
borderBottom a b c = key (fromString "border-bottom") (Tuple a (Tuple b c))
borderLeft :: Stroke -> Size LengthUnit -> Color -> CSS
borderLeft a b c = key (fromString "border-left") (Tuple a (Tuple b c))
borderRight :: Stroke -> Size LengthUnit -> Color -> CSS
borderRight a b c = key (fromString "border-right") (Tuple a (Tuple b c))
borderColor :: Color -> CSS
borderColor = key $ fromString "border-color"
-------------------------------------------------------------------------------
outline :: Stroke -> Size LengthUnit -> Color -> CSS
outline a b c = key (fromString "outline") (a ! b ! c)
outlineColor :: Color -> CSS
outlineColor = key (fromString "outline-color")
outlineStyle :: Stroke -> CSS
outlineStyle = key (fromString "outline-style")
outlineWidth :: Size LengthUnit -> CSS
outlineWidth = key (fromString "outline-width")
outlineOffset :: Size LengthUnit -> CSS
outlineOffset = key (fromString "outline-offset")
-------------------------------------------------------------------------------
borderRadius :: forall a. Size a -> Size a -> Size a -> Size a -> CSS
borderRadius a b c d = key (fromString "border-radius") (Tuple (Tuple a b) (Tuple c d))
borderSpacing :: forall a. Size a -> CSS
borderSpacing = key $ fromString "border-spacing"