/
IconButton.tsx
44 lines (39 loc) · 1.17 KB
/
IconButton.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from "react";
import { IconButtonProps } from "@rjsf/utils";
import Button, { ButtonProps } from "react-bootstrap/Button";
import { IoIosRemove } from "@react-icons/all-files/io/IoIosRemove";
import { AiOutlineArrowUp } from "@react-icons/all-files/ai/AiOutlineArrowUp";
import { AiOutlineArrowDown } from "@react-icons/all-files/ai/AiOutlineArrowDown";
const IconButton = (props: IconButtonProps & ButtonProps) => {
const { icon, iconType, className, uiSchema, registry, ...otherProps } =
props;
return (
<Button
block={iconType === "block"}
{...otherProps}
variant={props.variant || "light"}
size="sm"
>
{icon}
</Button>
);
};
export default IconButton;
export function MoveDownButton(props: IconButtonProps) {
return (
<IconButton title="Move down" {...props} icon={<AiOutlineArrowDown />} />
);
}
export function MoveUpButton(props: IconButtonProps) {
return <IconButton title="Move up" {...props} icon={<AiOutlineArrowUp />} />;
}
export function RemoveButton(props: IconButtonProps) {
return (
<IconButton
title="Remove"
{...props}
variant="danger"
icon={<IoIosRemove />}
/>
);
}