Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 100% width underline to NavTab #1796

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/src/common/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ export const componentTokens = {
selectedIconColor: CoreTokens.color_grey_700,
unselectedIconColor: CoreTokens.color_grey_700,
disabledIconColor: CoreTokens.color_grey_500,
dividerThickness: "2px",
Mil4n0r marked this conversation as resolved.
Show resolved Hide resolved
},
paginator: {
backgroundColor: CoreTokens.color_grey_100,
Expand Down
12 changes: 12 additions & 0 deletions lib/src/nav-tabs/NavTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,27 @@ const DxcNavTabs = ({ iconPosition = "top", tabIndex = 0, children }: NavTabsPro
<ThemeProvider theme={colorsTheme.navTabs}>
<NavTabsContainer onKeyDown={handleOnKeyDown} role="tablist" aria-label="Navigation tabs">
<NavTabsContext.Provider value={contextValue}>{children}</NavTabsContext.Provider>
<Underline />
</NavTabsContainer>
</ThemeProvider>
);
};

const Underline = styled.div`
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: ${(props) => props.theme.dividerThickness};
background-color: ${(props) => props.theme.dividerColor};
z-index: -1;
`;

DxcNavTabs.Tab = DxcTab;

const NavTabsContainer = styled.div`
display: flex;
position: relative;
`;

export default DxcNavTabs;
2 changes: 1 addition & 1 deletion lib/src/nav-tabs/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const DxcTab = forwardRef(

const TabContainer = styled.div<{ active: TabProps["active"] }>`
align-items: stretch;
border-bottom: 2px solid ${(props) => (props.active ? props.theme.selectedUnderlineColor : props.theme.dividerColor)};
border-bottom: 2px solid ${(props) => (props.active ? props.theme.selectedUnderlineColor : 'transparent')};
padding: 0.5rem;

svg {
Expand Down
1 change: 0 additions & 1 deletion website/screens/common/TabsPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const TabsPageLayout = ({ tabs }: TabsPageLayoutProps) => {
</Link>
))}
</DxcNavTabs>
<Divider />
</TabsContainer>
);
};
Expand Down