2021-05-21 14:37:30 +00:00
|
|
|
import React from "react"
|
|
|
|
import ButtonIconOnly from "../base/ButtonIconOnly"
|
|
|
|
|
|
|
|
|
2021-05-23 03:03:41 +00:00
|
|
|
/**
|
|
|
|
* A {@link ButtonIconOnly} to be used to switch between RepositoryViewer tabs.
|
|
|
|
*
|
|
|
|
* @param setTab - Function to change tab.
|
|
|
|
* @param currentTab - Name of the current tab, as a string.
|
|
|
|
* @param name - Name of the tab this button should switch to, as a string.
|
|
|
|
* @param props - Additional props to pass to the button.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2021-05-21 14:37:30 +00:00
|
|
|
export default function ButtonPicker({ setTab, currentTab, name, ...props }) {
|
|
|
|
return (
|
|
|
|
<ButtonIconOnly
|
|
|
|
onClick={() => setTab(name)}
|
|
|
|
disabled={currentTab === name}
|
|
|
|
color={"Grey"}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|