refactor(web): remove typescript

This commit is contained in:
Ali BARIN
2024-02-27 15:23:23 +00:00
parent 636870a075
commit b3ae2d2748
337 changed files with 2067 additions and 4997 deletions

View File

@@ -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