Skip to content

Commit 0368b73

Browse files
committed
fix: StatusFilterButtonComponent - css move from base.scss, TabGroup - remove iconType prop, handling via mixins
1 parent 994ec53 commit 0368b73

File tree

6 files changed

+53
-55
lines changed

6 files changed

+53
-55
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.gui-yaml-switch.status-filter-button {
2+
&.radio-group {
3+
.radio__item-label {
4+
padding: 2px 8px;
5+
display: flex;
6+
align-items: center;
7+
gap: 6px;
8+
}
9+
}
10+
11+
&.with-menu-button {
12+
border-top-right-radius: 0;
13+
border-bottom-right-radius: 0;
14+
15+
.radio:last-child > .radio__item-label {
16+
border-right: none;
17+
border-top-right-radius: 0 !important;
18+
border-bottom-right-radius: 0 !important;
19+
}
20+
}
21+
}

src/Shared/Components/CICDHistory/StatusFilterButtonComponent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import { PopupMenu, StyledRadioGroup as RadioGroup } from '../../../Common'
2121
import { NodeStatus, StatusFilterButtonType } from './types'
2222
import { IndexStore } from '../../Store'
2323

24+
import './StatusFilterButtonComponent.scss'
25+
2426
export const StatusFilterButtonComponent = ({ nodes, handleFilterClick }: StatusFilterButtonType) => {
2527
const [selectedTab, setSelectedTab] = useState('all')
2628

src/Shared/Components/TabGroup/TabGroup.component.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { Fragment } from 'react'
21
import { Link, NavLink } from 'react-router-dom'
32

43
import { ReactComponent as ICErrorExclamation } from '@Icons/ic-error-exclamation.svg'
54
import { ReactComponent as ICWarning } from '@Icons/ic-warning.svg'
65
import { ComponentSizeType } from '@Shared/constants'
76

87
import { TabGroupProps, TabProps } from './TabGroup.types'
9-
import { getClassNameBySizeMap, getIconColorClassMap, tabGroupClassMap } from './TabGroup.utils'
8+
import { getClassNameBySizeMap, tabGroupClassMap } from './TabGroup.utils'
109

1110
import './TabGroup.scss'
1211

@@ -16,7 +15,6 @@ const Tab = ({
1615
tabType,
1716
active,
1817
icon: Icon,
19-
iconType = 'fill',
2018
size,
2119
badge = null,
2220
alignActiveBorderWithContainer,
@@ -38,9 +36,7 @@ const Tab = ({
3836
<p className="m-0 flexbox dc__align-items-center dc__gap-6">
3937
{showError && <ICErrorExclamation className={`${iconClassName}`} />}
4038
{!showError && showWarning && <ICWarning className={`${iconClassName} warning-icon-y7`} />}
41-
{!showError && !showWarning && Icon && (
42-
<Icon className={`${iconClassName} ${getIconColorClassMap({ active })[iconType] || ''}`} />
43-
)}
39+
{!showError && !showWarning && Icon && <Icon className={`${iconClassName} tab-group__tab__icon`} />}
4440
{label}
4541
{badge !== null && (
4642
<div className={`tab-group__tab__badge bcn-1 cn-7 fw-6 flex px-4 ${badgeClassName}`}>
@@ -50,16 +46,16 @@ const Tab = ({
5046
{showIndicator && <span className="tab-group__tab__indicator bcr-5 mt-4 dc__align-self-start" />}
5147
</p>
5248
{description && (
53-
<p className="m-0 fs-12 lh-16 fw-4 cn-7 flexbox dc__align-items-center dc__gap-4">
49+
<ul className="tab-group__tab__description m-0 p-0 fs-12 lh-16 fw-4 cn-7 flexbox dc__align-items-center dc__gap-4">
5450
{Array.isArray(description)
5551
? description.map((desc, idx) => (
56-
<Fragment key={desc}>
52+
<li key={desc} className="flex dc__gap-4">
5753
{!!idx && <span className="dc__bullet" />}
5854
{desc}
59-
</Fragment>
55+
</li>
6056
))
6157
: description}
62-
</p>
58+
</ul>
6359
)}
6460
</>
6561
)

src/Shared/Components/TabGroup/TabGroup.scss

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1+
@mixin svg-styles($color) {
2+
svg.tab-group__tab__icon *[stroke^='#'] {
3+
stroke: $color;
4+
}
5+
6+
svg.tab-group__tab__icon *[fill^='#'] {
7+
fill: $color;
8+
}
9+
}
10+
111
.tab-group {
212
list-style: none;
313

414
&__tab {
515
$parent-selector: &;
616
position: relative;
717

18+
@include svg-styles(var(--N700));
19+
820
&::after {
921
content: '';
1022
position: absolute;
@@ -23,30 +35,17 @@
2335

2436
&:hover:not(.tab-group__tab--block) {
2537
color: var(--B500);
38+
@include svg-styles(var(--B500));
39+
}
2640

27-
#{$parent-selector}__icon {
28-
&--stroke {
29-
stroke: var(--B500);
30-
31-
path {
32-
stroke: var(--B500);
33-
}
34-
}
35-
36-
&--fill {
37-
fill: var(--B500);
41+
&--active {
42+
@include svg-styles(var(--B500));
3843

39-
path {
40-
fill: var(--B500);
41-
}
42-
}
44+
&::after {
45+
background-color: var(--B500);
4346
}
4447
}
4548

46-
&--active::after {
47-
background-color: var(--B500);
48-
}
49-
5049
&__badge {
5150
border-radius: 10px;
5251
min-width: 20px;
@@ -62,26 +61,15 @@
6261
border-radius: 100%;
6362
}
6463

64+
&__description {
65+
list-style: none;
66+
}
67+
6568
&__nav-link {
6669
&.active {
6770
color: var(--B500);
6871
font-weight: 600;
69-
70-
#{$parent-selector}__icon--fill {
71-
fill: var(--B500);
72-
73-
path {
74-
fill: var(--B500);
75-
}
76-
}
77-
78-
#{$parent-selector}__icon--stroke {
79-
stroke: var(--B500);
80-
81-
path {
82-
stroke: var(--B500);
83-
}
84-
}
72+
@include svg-styles(var(--B500));
8573
}
8674

8775
&:not(.active) {

src/Shared/Components/TabGroup/TabGroup.types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ export type TabProps = {
8383
* This should be a functional component that renders an SVG.
8484
*/
8585
icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
86-
/**
87-
* Type of the icon, determining whether it uses a stroke or fill style.
88-
*/
89-
iconType?: 'stroke' | 'fill'
9086
/**
9187
* Badge number to be displayed on the tab, typically for notifications.
9288
*/

src/Shared/Components/TabGroup/TabGroup.utils.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ComponentSizeType } from '@Shared/constants'
22

3-
import { TabGroupProps, TabProps } from './TabGroup.types'
3+
import { TabGroupProps } from './TabGroup.types'
44

55
export const getClassNameBySizeMap = ({
66
hideTopPadding,
@@ -30,11 +30,6 @@ export const getClassNameBySizeMap = ({
3030
},
3131
})
3232

33-
export const getIconColorClassMap = ({ active }: Pick<TabProps, 'active'>): Record<TabProps['iconType'], string> => ({
34-
fill: `tab-group__tab__icon--fill ${active ? 'fcb-5' : 'fcn-7'}`,
35-
stroke: `tab-group__tab__icon--stroke ${active ? 'scb-5' : 'scn-7'}`,
36-
})
37-
3833
export const tabGroupClassMap: Record<TabGroupProps['size'], string> = {
3934
[ComponentSizeType.medium]: 'dc__gap-12',
4035
[ComponentSizeType.large]: 'dc__gap-16',

0 commit comments

Comments
 (0)