import { DetailedHTMLProps, HTMLAttributes } from "react";
import { twMerge } from "tailwind-merge";

type Props = DetailedHTMLProps<
    HTMLAttributes<HTMLDivElement>,
    HTMLDivElement
> & {
    noWrap?: boolean;
    itemsStart?: boolean;
};

/**
 * # Flexbox Row
 * @className twui-row
 */
export default function Row({ noWrap, itemsStart, ...props }: Props) {
    return (
        <div
            {...props}
            className={twMerge(
                "flex flex-row gap-2",
                noWrap ? "xl:flex-nowrap" : "flex-wrap",
                itemsStart ? "items-start" : "items-center",
                "twui-row",
                props.className
            )}
        >
            {props.children}
        </div>
    );
}
