Skip to content

Commit

Permalink
Merge pull request #48 from EvoluxBR/feat/hidden-panel
Browse files Browse the repository at this point in the history
feat(tab bar component): added a hidden-panel prop
  • Loading branch information
gustavoFreireS authored Aug 30, 2019
2 parents 3ba3385 + fb5f46d commit 33cbaca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/components/tabs/tab-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface ITabBarProps {
onTabsChange?: (modifiedList: ITab[], tabList?: ReactChildren) => void;
closeIcon?: ReactElement;
className?: string;
hiddenPanel?: boolean;
}

const TabBar = (props: ITabBarProps) => {
Expand Down Expand Up @@ -245,17 +246,18 @@ const TabBar = (props: ITabBarProps) => {
</span>
)}
</div>
{tabList.map((child: any) => {
return (
<div
id={`${child.id}-panel`}
key={`${child.id}-panel`}
className={`tab-panel ${checkActive(child) ? 'active' : ''}`}
>
{child.tabComponent}
</div>
);
})}
{!props.hiddenPanel &&
tabList.map((child: any) => {
return (
<div
id={`${child.id}-panel`}
key={`${child.id}-panel`}
className={`tab-panel ${checkActive(child) ? 'active' : ''}`}
>
{child.tabComponent}
</div>
);
})}
</Fragment>
);
};
Expand Down
8 changes: 7 additions & 1 deletion src/components/testInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ const TabInterface = () => {
);
};
return (
<TabBar closeable={true} reorderable={true} newTab={createNew} className="small-tab">
<TabBar
closeable={true}
reorderable={true}
newTab={createNew}
className="small-tab"
hiddenPanel
>
<Tab text="first tab" classNameActive="red-header" className="the-rest">
<form className="frm">
<h1>Form 1</h1>
Expand Down

0 comments on commit 33cbaca

Please sign in to comment.