forked from y-scope/yscope-log-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTabButton.tsx
56 lines (49 loc) · 1.2 KB
/
TabButton.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
45
46
47
48
49
50
51
52
53
54
55
56
import {
Tab,
Tooltip,
} from "@mui/joy";
import SvgIcon from "@mui/material/SvgIcon";
import {
TAB_DISPLAY_NAMES,
TAB_NAME,
} from "../../../../typings/tab";
import "./TabButton.css";
interface TabButtonProps {
tabName: TAB_NAME,
Icon: typeof SvgIcon,
onTabButtonClick: (tabName: TAB_NAME) => void
}
/**
* Renders a tooltip-wrapped tab button.
*
* @param props
* @param props.tabName
* @param props.Icon
* @param props.onTabButtonClick
* @return
*/
const TabButton = ({tabName, Icon, onTabButtonClick}: TabButtonProps) => {
const handleClick = () => {
onTabButtonClick(tabName);
};
return (
<Tooltip
arrow={true}
key={tabName}
placement={"right"}
title={TAB_DISPLAY_NAMES[tabName]}
variant={"outlined"}
>
<Tab
className={"sidebar-tab-button"}
color={"neutral"}
indicatorPlacement={"left"}
slotProps={{root: {onClick: handleClick}}}
value={tabName}
>
<Icon className={"sidebar-tab-button-icon"}/>
</Tab>
</Tooltip>
);
};
export default TabButton;