Skip to content

Commit eb450ce

Browse files
committed
refactor: DeploymentConfigDiffNavigation - tab config - navlink to button conversion
1 parent 1f22cb0 commit eb450ce

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.scss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,4 @@
4040
&__tab-list {
4141
list-style: none;
4242
}
43-
44-
&__tab {
45-
&, &:hover {
46-
color: var(--N700);
47-
}
48-
49-
&--active, &--active:hover {
50-
color: var(--N900);
51-
}
52-
}
5343
}

src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.types.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ export interface DeploymentConfigDiffProps {
7575
navHeading: string
7676
navHelpText?: string
7777
tabConfig?: {
78-
tabs: {
79-
value: string
80-
href: string
81-
}[]
78+
tabs: string[]
79+
activeTab: string
8280
onClick: (tab: string) => void
8381
}
8482
}

src/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiffNavigation.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,22 @@ export const DeploymentConfigDiffNavigation = ({
7474
)
7575

7676
const renderTabConfig = () => {
77-
const { tabs } = tabConfig
77+
const { tabs, activeTab } = tabConfig
7878

7979
return (
8080
<div className="p-12">
8181
<ul className="deployment-config-diff__tab-list p-0 m-0 flexbox dc__align-items-center dc__border br-4 dc__text-center dc__overflow-hidden">
8282
{tabs.map((tab, index) => (
8383
<li className={`flex-1 ${index !== tabs.length - 1 ? 'dc__border-right' : ''}`}>
84-
<NavLink
85-
key={tab.value}
86-
to={tab.href}
87-
activeClassName="deployment-config-diff__tab--active bcn-1"
88-
className={`deployment-config-diff__tab dc__inline-block w-100 dc__no-decor px-8 py-1 fs-12 lh-20 bcn-0 ${isLoading ? 'dc__opacity-0_5 cursor-not-allowed' : ''}`}
89-
onClick={onTabClick(tab.value)}
90-
aria-disabled={isLoading}
84+
<button
85+
key={tab}
86+
type="button"
87+
className={`dc__transparent w-100 dc__no-decor px-8 py-1 fs-12 lh-20 fw-6 ${activeTab === tab ? 'bcn-1 cn-9' : 'bcn-0 cn-7'} ${isLoading ? 'dc__opacity-0_5 cursor-not-allowed' : ''}`}
88+
onClick={onTabClick(tab)}
89+
disabled={isLoading}
9190
>
92-
{tab.value}
93-
</NavLink>
91+
{tab}
92+
</button>
9493
</li>
9594
))}
9695
</ul>

0 commit comments

Comments
 (0)