summaryrefslogtreecommitdiff
path: root/bs5/universal/native/shared/Align.re
blob: 6397067f1c6bc07d10a6a02f78087bef68fcf8eb (plain)
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
type verticalAlign = [
  | `top
  | `center
  | `bottom
];
type horizontalAlign = [
  | `left
  | `center
  | `right
];

[@react.component]
let make = (~h: horizontalAlign=`center, ~v: verticalAlign=`center, ~children) => {
  let className =
    Cx.make([
      "flex flex-col h-full w-full",
      switch (h) {
      | `left => "items-start"
      | `center => "items-center"
      | `right => "items-end"
      },
      switch (v) {
      | `top => "justify-start"
      | `center => "justify-center"
      | `bottom => "justify-end"
      },
    ]);

  <div className> children </div>;
};