refactor(web): remove typescript
This commit is contained in:
@@ -9,41 +9,21 @@ import Paper from '@mui/material/Paper';
|
||||
import Popper from '@mui/material/Popper';
|
||||
import * as React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
type SplitButtonProps = {
|
||||
options: {
|
||||
key: string;
|
||||
'data-test'?: string;
|
||||
label: React.ReactNode;
|
||||
to: string;
|
||||
}[];
|
||||
disabled?: boolean;
|
||||
defaultActionIndex?: number;
|
||||
};
|
||||
|
||||
export default function SplitButton(props: SplitButtonProps) {
|
||||
export default function SplitButton(props) {
|
||||
const { options, disabled, defaultActionIndex = 0 } = props;
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const anchorRef = React.useRef<HTMLDivElement>(null);
|
||||
|
||||
const anchorRef = React.useRef(null);
|
||||
const multiOptions = options.length > 1;
|
||||
const selectedOption = options[defaultActionIndex];
|
||||
|
||||
const handleToggle = () => {
|
||||
setOpen((prevOpen) => !prevOpen);
|
||||
};
|
||||
|
||||
const handleClose = (event: Event) => {
|
||||
if (
|
||||
anchorRef.current &&
|
||||
anchorRef.current.contains(event.target as HTMLElement)
|
||||
) {
|
||||
const handleClose = (event) => {
|
||||
if (anchorRef.current && anchorRef.current.contains(event.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<ButtonGroup
|
Reference in New Issue
Block a user