feat: Tab Common

This commit is contained in:
sonnguyenkieio
2021-09-07 12:16:04 +07:00
committed by GitHub
parent ceb144ee57
commit 0eb29aed29

View File

@@ -1,22 +1,19 @@
import classNames from "classnames";
import React from "react" import React from "react"
import s from './TabItem.module.scss' import s from './TabItem.module.scss'
interface TabItemProps { interface TabItemProps {
active: string; active: boolean;
children: string; children: string;
onClick: () => void; onClick: (tabIndex: number, tabPane: string) => void;
} }
const TabItem = ({ active = "", children, onClick } : TabItemProps) => { const TabItem = ({ active = false, children, onClick } : TabItemProps) => {
return ( return (
<span onClick={onClick} className={classNames(s.tabItem, { <span onClick={onClick} className={active ? s.tabItemActive : s.tabItem} >
[s[active]]: active
})}>
{children} {children}
</span> </span>
) )
} }
export default TabItem; export default TabItem;