Skip to content

Commit

Permalink
Merge pull request #56 from finos/main
Browse files Browse the repository at this point in the history
Weekly Syncing
  • Loading branch information
vferraro-scottlogic authored Sep 25, 2023
2 parents 9860472 + 1f2fb05 commit 4809e11
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions vuu-ui/packages/vuu-layout/src/stack/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const classBase = "Tabs";
const getDefaultTabIcon = () => undefined;

const getDefaultTabLabel = (component: ReactElement, tabIndex: number) =>
component.props?.title ?? `Tab ${tabIndex + 1}`;
component.props?.title ??
component.props?.["data-tab-title"] ??
`Tab ${tabIndex + 1}`;

const getChildElements = <T extends ReactElement = ReactElement>(
children: ReactNode
Expand Down Expand Up @@ -98,8 +100,11 @@ export const Stack = forwardRef(function Stack(

const renderTabs = () =>
getChildElements(children).map((child, idx) => {
const { closeable = allowCloseTab, id: childId = `${id}-${idx}` } =
child.props;
const {
closeable = allowCloseTab,
id: childId = `${id}-${idx}`,
"data-tab-location": tabLocation,
} = child.props;
return (
<Tab
ariaControls={childId}
Expand All @@ -108,6 +113,7 @@ export const Stack = forwardRef(function Stack(
id={`${childId}-tab`}
index={idx}
label={getTabLabel(child, idx)}
location={tabLocation}
closeable={closeable}
editable={allowRenameTab}
/>
Expand Down

0 comments on commit 4809e11

Please sign in to comment.