mirror of
https://github.com/codex-storage/codex-marketplace-ui-components.git
synced 2025-02-18 01:16:58 +00:00
Allow Icon for tag
This commit is contained in:
parent
411b76160c
commit
89f882eb2f
@ -2,11 +2,15 @@ import { ComponentType } from "react";
|
|||||||
import "./tabs.css";
|
import "./tabs.css";
|
||||||
import { classnames } from "../utils/classnames";
|
import { classnames } from "../utils/classnames";
|
||||||
|
|
||||||
|
export type TabProps = {
|
||||||
|
label: string;
|
||||||
|
className?: string;
|
||||||
|
Icon?: ComponentType;
|
||||||
|
IconAfter?: ComponentType<{ onClick?: () => void }>;
|
||||||
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tabs: {
|
tabs: TabProps[];
|
||||||
label: string;
|
|
||||||
Icon?: ComponentType;
|
|
||||||
}[];
|
|
||||||
|
|
||||||
onTabChange: (index: number) => void | Promise<void>;
|
onTabChange: (index: number) => void | Promise<void>;
|
||||||
|
|
||||||
@ -24,12 +28,14 @@ export function Tabs({ tabs, onTabChange, tabIndex }: Props) {
|
|||||||
key={tab.label}
|
key={tab.label}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
["tabs-tab"],
|
["tabs-tab"],
|
||||||
["tabs-tab--active", tabIndex === index]
|
["tabs-tab--active", tabIndex === index],
|
||||||
|
[tab.className || ""]
|
||||||
)}
|
)}
|
||||||
onClick={() => onTabChange(index)}
|
onClick={() => onTabChange(index)}
|
||||||
>
|
>
|
||||||
{tab.Icon && <tab.Icon />}
|
{tab.Icon && <tab.Icon />}
|
||||||
<span>{tab.label}</span>
|
<span>{tab.label}</span>
|
||||||
|
{tab.IconAfter && <tab.IconAfter />}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,6 +31,6 @@ export { Tooltip } from "./components/Tooltip/Tooltip";
|
|||||||
export { Collapse } from "./components/Collapse/Collapse";
|
export { Collapse } from "./components/Collapse/Collapse";
|
||||||
export { Placeholder } from "./components/Placeholder/Placeholder";
|
export { Placeholder } from "./components/Placeholder/Placeholder";
|
||||||
export { Sheets } from "./components/Sheets/Sheets";
|
export { Sheets } from "./components/Sheets/Sheets";
|
||||||
export { Tabs } from "./components/Tabs/Tabs";
|
export { Tabs, type TabProps } from "./components/Tabs/Tabs";
|
||||||
export * from "./components/Stepper/useStepperReducer";
|
export * from "./components/Stepper/useStepperReducer";
|
||||||
export { Modal } from "./components/Modal/Modal";
|
export { Modal } from "./components/Modal/Modal";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user