feat: updated `Tabs` component

pull/107/head
Samuel Rowe 3 years ago
parent 56c8998522
commit 3a8cb66157

@ -1,7 +1,10 @@
import { styled } from "@mui/joy";
import { FunctionComponent, ReactElement, ReactNode } from "react";
import { TabContext } from "../contexts";
export interface ITabsProps {
value: string;
onChange: (newValue: string) => void;
children: ReactNode;
}
@ -30,11 +33,15 @@ const Nav = styled("nav")`
const Tabs: FunctionComponent<ITabsProps> = (
props: ITabsProps
): ReactElement => {
const { children } = props;
const { children, value, onChange } = props;
return (
<Root>
<Nav aria-label="Tabs">{children}</Nav>
<Nav>
<TabContext.Provider value={{ value, onChange }}>
{children}
</TabContext.Provider>
</Nav>
</Root>
);
};

Loading…
Cancel
Save