import { DownOutlined, UpOutlined } from "@ant-design/icons";
import { Space } from "antd";

export default function FormListMoveArrows({ move, index, total, orientation = "vertical" }) {
  const upDisabled = index === 0;
  const downDisabled = index === total - 1;

  const handleUp = () => {
    move(index, index - 1);
  };

  const handleDown = () => {
    move(index, index + 1);
  };

  return (
    <Space orientation={orientation}>
      <UpOutlined disabled={upDisabled} onClick={handleUp} />
      <DownOutlined disabled={downDisabled} onClick={handleDown} />
    </Space>
  );
}
