diff options
Diffstat (limited to 'bs5/universal/native/shared/Align.re')
-rw-r--r-- | bs5/universal/native/shared/Align.re | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bs5/universal/native/shared/Align.re b/bs5/universal/native/shared/Align.re new file mode 100644 index 0000000..6397067 --- /dev/null +++ b/bs5/universal/native/shared/Align.re @@ -0,0 +1,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>; +}; |