Skip to content

Commit cdd62db

Browse files
authored
Merge pull request #53 from alexmingoia/topic/float-rule
Add float rule
2 parents 7f43dfb + d0db508 commit cdd62db

File tree

1 file changed

+75
-3
lines changed

1 file changed

+75
-3
lines changed

src/CSS/Display.purs

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
module CSS.Display where
22

33
import Prelude
4-
5-
import Data.Generic (class Generic)
6-
4+
import CSS.Common (class Inherit, class None)
75
import CSS.Property (class Val, Value)
86
import CSS.String (fromString)
97
import CSS.Stylesheet (CSS, key)
8+
import Data.Generic (class Generic, gShow)
109

1110
newtype Position = Position Value
1211

@@ -106,3 +105,76 @@ inlineGrid = Display $ fromString "inline-grid"
106105

107106
display :: Display -> CSS
108107
display = key $ fromString "display"
108+
109+
data Float = FloatLeft | FloatRight | FloatNone
110+
111+
derive instance eqFloat :: Eq Float
112+
derive instance genericFloat :: Generic Float
113+
114+
instance showFloat :: Show Float where
115+
show = gShow
116+
117+
instance valFloat :: Val (Float) where
118+
value (FloatLeft) = fromString "left"
119+
value (FloatRight) = fromString "right"
120+
value (FloatNone) = fromString "none"
121+
122+
instance noneFloat :: None (Float) where
123+
none = FloatNone
124+
125+
floatLeft :: Float
126+
floatLeft = FloatLeft
127+
128+
floatRight :: Float
129+
floatRight = FloatRight
130+
131+
float :: Float -> CSS
132+
float = key (fromString "float")
133+
134+
data ClearFloat
135+
= ClearFloatLeft
136+
| ClearFloatRight
137+
| ClearFloatBoth
138+
| ClearFloatNone
139+
| ClearFloatInherit
140+
| ClearFloatInlineStart
141+
| ClearFloatInlineEnd
142+
143+
derive instance eqClearFloat :: Eq ClearFloat
144+
derive instance genericClearFloat :: Generic ClearFloat
145+
146+
instance showClearFloat :: Show ClearFloat where
147+
show = gShow
148+
149+
instance valClearFloat :: Val (ClearFloat) where
150+
value (ClearFloatLeft) = fromString "left"
151+
value (ClearFloatRight) = fromString "right"
152+
value (ClearFloatBoth) = fromString "both"
153+
value (ClearFloatNone) = fromString "none"
154+
value (ClearFloatInherit) = fromString "inherit"
155+
value (ClearFloatInlineStart) = fromString "inline-start"
156+
value (ClearFloatInlineEnd) = fromString "inline-end"
157+
158+
instance noneClearFloat :: None (ClearFloat) where
159+
none = ClearFloatNone
160+
161+
instance inheritClearFloat :: Inherit (ClearFloat) where
162+
inherit = ClearFloatInherit
163+
164+
clearLeft :: ClearFloat
165+
clearLeft = ClearFloatLeft
166+
167+
clearRight :: ClearFloat
168+
clearRight = ClearFloatRight
169+
170+
clearBoth :: ClearFloat
171+
clearBoth = ClearFloatBoth
172+
173+
clearInlineStart :: ClearFloat
174+
clearInlineStart = ClearFloatInlineStart
175+
176+
clearInlineEnd :: ClearFloat
177+
clearInlineEnd = ClearFloatInlineEnd
178+
179+
clear :: ClearFloat -> CSS
180+
clear = key (fromString "clear")

0 commit comments

Comments
 (0)