2020-01-15 20:42:02 +05:00
|
|
|
import "./Stack.css";
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
type StackProps = {
|
|
|
|
children: React.ReactNode;
|
|
|
|
gap?: number;
|
2020-01-17 15:55:17 +03:00
|
|
|
align?: "start" | "center" | "end";
|
2020-01-15 20:42:02 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
function RowStack({ children, gap, align }: StackProps) {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className="Stack Stack_horizontal"
|
|
|
|
style={{ "--gap": gap, alignItems: align } as React.CSSProperties}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function ColStack({ children, gap, align }: StackProps) {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className="Stack Stack_vertical"
|
|
|
|
style={{ "--gap": gap, justifyItems: align } as React.CSSProperties}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
Row: RowStack,
|
|
|
|
Col: ColStack
|
|
|
|
};
|