import { ComponentPropsWithoutRef, Ref } from "react"; import classNames from "classnames"; import Button from "./Button"; import FlatButton from "./FlatButton"; import IconButton from "./IconButton"; import LoadingButton from "./LoadingButton"; import "./ButtonRow.css"; type ButtonRowButton = ( | { type: "normal"; props: ComponentPropsWithoutRef; } | { type: "flat"; props: ComponentPropsWithoutRef; } | { type: "icon"; props: ComponentPropsWithoutRef; } | { type: "loading"; props: ComponentPropsWithoutRef } ) & { key: string | number }; interface ButtonRowProps { className?: string; containerRef?: Ref; buttons: ButtonRowButton[]; buttonsClassName?: string; } export default function ButtonRow({ className, containerRef, buttons, buttonsClassName, }: ButtonRowProps) { return (
{buttons.map((button) => { const { type, key, props } = button; const newClassName = classNames(props.className, buttonsClassName); switch (type) { case "normal": return
); }