new-personal-site/components/lib/layout/Stack.tsx

29 lines
697 B
TypeScript
Raw Normal View History

2025-01-05 06:25:38 +00:00
import _ from "lodash";
2024-12-09 15:36:17 +00:00
import { DetailedHTMLProps, HTMLAttributes } from "react";
import { twMerge } from "tailwind-merge";
/**
* # Flexbox Column
* @className twui-stack
*/
export default function Stack({
...props
2025-01-05 06:25:38 +00:00
}: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
center?: boolean;
}) {
const finalProps = _.omit(props, "center");
2024-12-09 15:36:17 +00:00
return (
<div
2025-01-05 06:25:38 +00:00
{...finalProps}
2024-12-09 15:36:17 +00:00
className={twMerge(
"flex flex-col items-start gap-4",
2025-01-05 06:25:38 +00:00
props.center && "items-center",
2024-12-09 15:36:17 +00:00
"twui-stack",
props.className
)}
>
{props.children}
</div>
);
}