Skip to content

Commit c77cf3f

Browse files
authored
CONSOLE-4484: Reintroduce styling for tabs within a sidebar (#14797)
* CONSOLE-4484: Reintroduce styling for tabs within a sidebar * CONSOLE-4484: Do not bleed slidebar tabs to the edges * CONSOLE-4484: Address nits
1 parent cc2be45 commit c77cf3f

5 files changed

Lines changed: 14 additions & 2 deletions

File tree

frontend/packages/topology/src/components/side-bar/TopologyEdgePanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const TopologyEdgePanel: React.FC<TopologyEdgePanelProps> = ({ edge }) => {
4444
</PrimaryHeading>
4545
</div>
4646
<SimpleTabNav
47+
withinSidebar
4748
tabs={[
4849
{
4950
name: t('topology~Resources'),

frontend/packages/topology/src/components/side-bar/components/SideBarBody.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const SimpleTabNavWrapper: React.FC<{ tabs: Tab[] }> = ({ tabs }) => {
2323
);
2424
return (
2525
<SimpleTabNav
26+
withinSidebar
2627
selectedTab={selectTabParam || selectedTab || t('topology~Details')}
2728
tabs={tabs}
2829
onClickTab={handleClickTab}

frontend/public/components/overview/resource-overview-details.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export const ResourceOverviewDetails = connect<PropsFromState, PropsFromDispatch
8787
<div className="overview__sidebar-pane resource-overview">
8888
<ResourceOverviewHeading actions={menuActions} kindObj={kindObj} resources={item} />
8989
<SimpleTabNav
90+
withinSidebar
91+
noInset
9092
onClickTab={onClickTab}
9193
selectedTab={selectedDetailsTab}
9294
tabProps={{ item }}

frontend/public/components/sidebars/resource-sidebar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ export const ResourceSidebar: React.FC<{
134134
<ResourceSidebarWrapper label={label} toggleSidebar={toggleSidebar}>
135135
{tabs.length > 0 ? (
136136
<SimpleTabNav
137+
withinSidebar
138+
noInset
137139
tabs={tabs}
138140
tabProps={{
139141
downloadSampleYaml,

frontend/public/components/utils/simple-tab-nav.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
import classnames from 'classnames';
23
import { Tabs, Tab as PfTab, TabTitleText } from '@patternfly/react-core';
34

45
export type Tab = {
@@ -13,6 +14,9 @@ type SimpleTabNavProps = {
1314
tabProps?: any;
1415
tabs: Tab[];
1516
additionalClassNames?: string;
17+
/** Removes inset and adds extra margin to the bottom of the tab list */
18+
withinSidebar?: boolean;
19+
noInset?: boolean;
1620
};
1721

1822
export const SimpleTabNav: React.FC<SimpleTabNavProps> = ({
@@ -21,6 +25,8 @@ export const SimpleTabNav: React.FC<SimpleTabNavProps> = ({
2125
tabProps = null,
2226
tabs,
2327
additionalClassNames,
28+
withinSidebar,
29+
noInset,
2430
}) => {
2531
const handleTabClick = (_e, tabIndex: string) => {
2632
onClickTab && onClickTab(tabIndex);
@@ -31,9 +37,9 @@ export const SimpleTabNav: React.FC<SimpleTabNavProps> = ({
3137
<div>
3238
<Tabs
3339
onSelect={handleTabClick}
34-
className={additionalClassNames}
40+
className={classnames({ 'pf-v6-u-mb-md': withinSidebar }, additionalClassNames)}
3541
defaultActiveKey={selectedTab || tabs[0]?.name}
36-
inset={{ default: 'insetNone', xl: 'insetSm' }}
42+
inset={!noInset && { default: 'insetSm' }}
3743
unmountOnExit
3844
>
3945
{tabs.map((tab) => {

0 commit comments

Comments
 (0)