footer-content.tsx 829 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Button } from "@nextui-org/react";
  2. import React from "react";
  3. export interface Action {
  4. action: () => void;
  5. isDisabled?: boolean;
  6. label: string;
  7. className?: string;
  8. closeAfterAction?: boolean;
  9. }
  10. interface FooterContentProps {
  11. actions: Action[];
  12. closeModal: () => void;
  13. }
  14. export function FooterContent({ actions, closeModal }: FooterContentProps) {
  15. return (
  16. <>
  17. {actions.map(
  18. ({ action, isDisabled, label, className, closeAfterAction }) => (
  19. <Button
  20. key={label}
  21. type="button"
  22. isDisabled={isDisabled}
  23. onClick={() => {
  24. action();
  25. if (closeAfterAction) closeModal();
  26. }}
  27. className={className}
  28. >
  29. {label}
  30. </Button>
  31. ),
  32. )}
  33. </>
  34. );
  35. }