1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-27 15:24:18 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/ButtonPicker.js

24 lines
720 B
JavaScript

import React from "react"
import ButtonIconOnly from "../base/ButtonIconOnly"
/**
* 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
*/
export default function ButtonPicker({ setTab, currentTab, name, ...props }) {
return (
<ButtonIconOnly
onClick={() => setTab(name)}
disabled={currentTab === name}
color={"Grey"}
{...props}
/>
)
}