|
1 | 1 | module CSS.Display where
|
2 | 2 |
|
3 | 3 | import Prelude
|
4 |
| - |
5 |
| -import Data.Generic (class Generic) |
6 |
| - |
| 4 | +import CSS.Common (class Inherit, class None) |
7 | 5 | import CSS.Property (class Val, Value)
|
8 | 6 | import CSS.String (fromString)
|
9 | 7 | import CSS.Stylesheet (CSS, key)
|
| 8 | +import Data.Generic (class Generic, gShow) |
10 | 9 |
|
11 | 10 | newtype Position = Position Value
|
12 | 11 |
|
@@ -106,3 +105,76 @@ inlineGrid = Display $ fromString "inline-grid"
|
106 | 105 |
|
107 | 106 | display :: Display -> CSS
|
108 | 107 | 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