"use client"; import { Tabs } from "antd-mobile"; import { FC, PropsWithChildren, ReactNode } from "react"; import styles from "./style.module.scss"; interface Item { id: number | string; name?: string | ReactNode; content?: number; render?: ReactNode; headerRender?: () => ReactNode; } interface Props { items: Item[]; activeKey?: string; onChanage?: (key?: string) => void; } // 0 ? tab.content : null} // style={{ // "--right": "-10px", // "--top": "8px", // width: "20px", // height: "20px", // }} // color={"#ff311b"} // > // {tab.name} // const Transactions: FC> = (props) => { const { items, activeKey, onChanage } = props; const tabChange = (key: string) => { if (typeof onChanage === "function") { onChanage(key); } }; console.log(activeKey); return ( {items.map((tab) => { return ( 0 ? tab.content : null} // style={{ // "--right": "-0.1rem", // "--top": "8px", // }} // color={"#ff311b"} // > // {tab.name} // <> {!tab?.headerRender && (
{tab.name} {!!tab.content && (
{tab.content}
)}
)} {tab?.headerRender && tab.headerRender()} } > {tab.render}
); })}
); }; export default Transactions;