Tailwind classes in OCaml
1type position = 2 | Static 3 | Fixed 4 | Absolute 5 | Relative 6 | Sticky 7 8type inset_dir = 9 | All 10 | X 11 | Y 12 | Top 13 | Right 14 | Bottom 15 | Left 16 | Start 17 | End 18 19type t = 20 | Position of position 21 | Inset of inset_dir * Size.t 22 | Z_index of int option 23 24let to_class = function 25 | Position Static -> Css.make "static" 26 | Position Fixed -> Css.make "fixed" 27 | Position Absolute -> Css.make "absolute" 28 | Position Relative -> Css.make "relative" 29 | Position Sticky -> Css.make "sticky" 30 | Inset (All, size) -> Css.make (Printf.sprintf "inset-%s" (Size.to_string size)) 31 | Inset (X, size) -> Css.make (Printf.sprintf "inset-x-%s" (Size.to_string size)) 32 | Inset (Y, size) -> Css.make (Printf.sprintf "inset-y-%s" (Size.to_string size)) 33 | Inset (Top, size) -> Css.make (Printf.sprintf "top-%s" (Size.to_string size)) 34 | Inset (Right, size) -> Css.make (Printf.sprintf "right-%s" (Size.to_string size)) 35 | Inset (Bottom, size) -> Css.make (Printf.sprintf "bottom-%s" (Size.to_string size)) 36 | Inset (Left, size) -> Css.make (Printf.sprintf "left-%s" (Size.to_string size)) 37 | Inset (Start, size) -> Css.make (Printf.sprintf "start-%s" (Size.to_string size)) 38 | Inset (End, size) -> Css.make (Printf.sprintf "end-%s" (Size.to_string size)) 39 | Z_index None -> Css.make "z-auto" 40 | Z_index (Some n) -> Css.make (Printf.sprintf "z-%d" n) 41 42let position p = Position p 43let inset dir size = Inset (dir, size) 44let z_index z = Z_index z 45 46let static = Css.make "static" 47let fixed = Css.make "fixed" 48let absolute = Css.make "absolute" 49let relative = Css.make "relative" 50let sticky = Css.make "sticky" 51 52let top size = inset Top size 53let right size = inset Right size 54let bottom size = inset Bottom size 55let left size = inset Left size 56let inset_x size = inset X size 57let inset_y size = inset Y size