mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
✨ feat: Tab Common
This commit is contained in:
@@ -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;
|
||||||
|
Reference in New Issue
Block a user