|
| 1 | +module CSS.VerticalAlign where |
| 2 | + |
| 3 | +import CSS.Common (class Baseline, class Inherit, class Initial, class Unset, class Top, class Middle, class Bottom) |
| 4 | +import CSS.Property (class Val) |
| 5 | +import CSS.String (fromString) |
| 6 | +import CSS.Stylesheet (CSS, key) |
| 7 | +import Data.Function (($)) |
| 8 | + |
| 9 | +data VerticalAlign |
| 10 | + = Baseline |
| 11 | + | Sub |
| 12 | + | Super |
| 13 | + | TextTop |
| 14 | + | TextBottom |
| 15 | + | Middle |
| 16 | + | Top |
| 17 | + | Bottom |
| 18 | + | Inherit |
| 19 | + | Initial |
| 20 | + | Unset |
| 21 | + |
| 22 | +instance valVerticalAlign :: Val (VerticalAlign) where |
| 23 | + value (Baseline) = fromString "baseline" |
| 24 | + value (Sub) = fromString "sub" |
| 25 | + value (Super) = fromString "super" |
| 26 | + value (TextTop) = fromString "text-top" |
| 27 | + value (TextBottom) = fromString "text-bottom" |
| 28 | + value (Middle) = fromString "middle" |
| 29 | + value (Top) = fromString "top" |
| 30 | + value (Bottom) = fromString "bottom" |
| 31 | + value (Inherit) = fromString "inherit" |
| 32 | + value (Initial) = fromString "initial" |
| 33 | + value (Unset) = fromString "unset" |
| 34 | + |
| 35 | +instance inheritVerticalAlign :: Inherit (VerticalAlign) where |
| 36 | + inherit = Inherit |
| 37 | + |
| 38 | +instance initialVerticalAlign :: Initial (VerticalAlign) where |
| 39 | + initial = Initial |
| 40 | + |
| 41 | +instance unsetVerticalAlign :: Unset (VerticalAlign) where |
| 42 | + unset = Unset |
| 43 | + |
| 44 | +instance baselineVerticalAlign :: Baseline (VerticalAlign) where |
| 45 | + baseline = Baseline |
| 46 | + |
| 47 | +instance middleVerticalAlign :: Middle (VerticalAlign) where |
| 48 | + middle = Middle |
| 49 | + |
| 50 | +instance topVerticalAlign :: Top (VerticalAlign) where |
| 51 | + top = Top |
| 52 | + |
| 53 | +instance bottomVerticalAlign :: Bottom (VerticalAlign) where |
| 54 | + bottom = Bottom |
| 55 | + |
| 56 | +sub :: VerticalAlign |
| 57 | +sub = Sub |
| 58 | + |
| 59 | +super :: VerticalAlign |
| 60 | +super = Super |
| 61 | + |
| 62 | +textTop :: VerticalAlign |
| 63 | +textTop = TextTop |
| 64 | + |
| 65 | +textBottom :: VerticalAlign |
| 66 | +textBottom = TextBottom |
| 67 | + |
| 68 | +verticalAlign :: VerticalAlign -> CSS |
| 69 | +verticalAlign = key $ fromString "vertical-align" |
0 commit comments