Skip to content

Commit fdcebc2

Browse files
authored
Merge branch 'main' into RadioOptionsDisabled
2 parents 93130e5 + 35b3801 commit fdcebc2

File tree

7 files changed

+235
-36
lines changed

7 files changed

+235
-36
lines changed

projects/assets-library/assets/styles/_interaction.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,18 @@
9999
cursor: not-allowed;
100100
}
101101
}
102+
103+
@mixin nav-primary-background {
104+
background: $blue-6;
105+
opacity: 0.95;
106+
}
107+
108+
@mixin nav-primary-background-hover {
109+
background: $blue-8;
110+
opacity: 0.95;
111+
}
112+
113+
@mixin nav-secondary-background {
114+
background: $blue-9;
115+
opacity: 0.95;
116+
}

projects/components/src/navigation/nav-item/nav-item.component.scss

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
justify-content: flex-start;
1111
align-items: center;
1212

13-
border-radius: 4px;
13+
border-bottom-left-radius: 4px;
14+
border-top-left-radius: 4px;
1415
padding-left: 16px;
1516
padding-right: 16px;
1617

18+
&.collapsed {
19+
border-radius: 0;
20+
}
21+
1722
.label-container {
1823
flex-grow: 1;
1924
margin-left: 14px;
@@ -27,40 +32,37 @@
2732
}
2833

2934
.icon {
30-
color: $gray-4;
35+
color: $gray-1;
3136
}
3237

3338
.label {
3439
flex: 1;
35-
@include body-1-medium($gray-6);
40+
@include body-1-medium($gray-2);
3641
}
3742

3843
&.active {
39-
background-color: $gray-2;
44+
@include nav-primary-background;
4045

41-
.label {
42-
color: $gray-9;
46+
&:hover {
47+
background-color: $blue-5;
4348
}
4449

45-
.icon {
46-
color: $gray-6;
50+
.label {
51+
color: white;
4752
}
4853

49-
&:hover {
50-
background-color: $gray-1;
54+
.icon {
55+
color: white;
5156
}
5257
}
5358

5459
&:hover {
55-
background-color: $gray-1;
60+
@include nav-primary-background;
5661
}
5762

5863
.soon-container {
5964
flex: 0;
60-
display: flex;
61-
flex-direction: row;
62-
vertical-align: center;
63-
align-items: center;
65+
@include center-contents;
6466
}
6567

6668
.soon {
@@ -71,6 +73,36 @@
7173
font-weight: 600;
7274
padding: 2px 4px;
7375
}
76+
77+
&:not(.navigation-dark) {
78+
border-radius: 4px;
79+
.icon {
80+
color: $gray-4;
81+
}
82+
.label {
83+
@include body-1-medium($gray-6);
84+
}
85+
86+
&:hover {
87+
background-color: $gray-1;
88+
}
89+
90+
&.active {
91+
background-color: $gray-2;
92+
93+
.label {
94+
color: $gray-9;
95+
}
96+
97+
.icon {
98+
color: $gray-6;
99+
}
100+
101+
&:hover {
102+
background-color: $gray-1;
103+
}
104+
}
105+
}
74106
}
75107

76108
:hover {

projects/components/src/navigation/nav-item/nav-item.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22
import { ActivatedRoute } from '@angular/router';
33
import { FeatureState, NavigationParams, NavigationParamsType } from '@hypertrace/common';
44
import { IconSize } from '../../icon/icon-size';
5-
import { NavItemLinkConfig } from '../navigation.config';
5+
import { NavItemLinkConfig, NavViewStyle } from '../navigation.config';
66

77
@Component({
88
selector: 'ht-nav-item',
@@ -13,7 +13,7 @@ import { NavItemLinkConfig } from '../navigation.config';
1313
<div
1414
*htIfFeature="this.config.featureState$ | async as featureState"
1515
class="nav-item"
16-
[ngClass]="{ active: this.active }"
16+
[ngClass]="[this.active ? 'active' : '', this.navItemViewStyle ?? '', this.collapsed ? 'collapsed' : '']"
1717
>
1818
<ht-icon
1919
class="icon"
@@ -54,6 +54,9 @@ export class NavItemComponent {
5454
@Input()
5555
public collapsed: boolean = true;
5656

57+
@Input()
58+
public readonly navItemViewStyle?: NavViewStyle;
59+
5760
public buildNavigationParam = (item: NavItemLinkConfig): NavigationParams => ({
5861
navType: NavigationParamsType.InApp,
5962
path: item.matchPaths[0],

projects/components/src/navigation/navigation-list.component.scss

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@import 'color-palette';
2-
@import 'font';
1+
@import 'mixins';
32

43
.navigation-list {
4+
@include nav-secondary-background;
55
position: relative;
66
display: flex;
77
flex-direction: column;
@@ -12,7 +12,8 @@
1212

1313
.content {
1414
overflow-y: auto;
15-
padding: 18px 12px;
15+
overflow-x: hidden;
16+
padding: 18px 0 12px 12px;
1617

1718
.nav-header {
1819
padding-top: 24px;
@@ -23,7 +24,7 @@
2324
align-items: center;
2425

2526
.label {
26-
@include overline($gray-9);
27+
@include overline($blue-2);
2728
}
2829

2930
.beta {
@@ -33,19 +34,17 @@
3334
}
3435

3536
.resize-tab-button {
37+
@include nav-secondary-background;
3638
position: absolute;
3739
display: flex;
3840
align-items: center;
3941
top: 22px;
4042
right: -12px;
4143
height: 28px;
4244
width: 12px;
43-
border: 1px solid $gray-2;
44-
border-left-color: white;
4545
border-radius: 0 6px 6px 0;
4646
cursor: pointer;
47-
color: $gray-7;
48-
background: white;
47+
color: white;
4948

5049
&:hover {
5150
color: $gray-4;
@@ -58,31 +57,100 @@
5857
}
5958

6059
.footer {
60+
display: flex;
61+
flex-direction: column;
6162
position: relative;
62-
margin-left: 6px;
6363
color: $gray-5;
6464
padding: 8px 12px 18px;
6565

6666
.footer-item {
6767
display: flex;
6868
align-items: center;
69-
margin-left: 12px;
69+
justify-content: center;
70+
71+
.nav-group-icon {
72+
height: 190px;
73+
opacity: 0.15;
74+
color: $blue-gray-4;
75+
}
76+
77+
.nav-group-label {
78+
margin: 10px auto 0 0;
79+
padding-right: 20px;
80+
font-size: 24px;
81+
font-weight: bold;
82+
color: $gray-4;
83+
}
7084

7185
.link {
86+
margin-right: auto;
7287
@include link;
7388
@include footnote($gray-5);
7489
}
7590
}
7691

7792
.nav-divider {
78-
position: absolute;
79-
top: 0;
80-
left: 24px;
81-
margin: 0;
93+
margin: 12px auto 8px 0;
8294
height: 1px;
8395
width: 16px;
84-
background-color: $gray-2;
85-
border: none;
96+
background-color: $gray-4;
97+
}
98+
}
99+
100+
&:not(.expanded) {
101+
.footer .footer-item .link {
102+
margin-right: 0;
103+
}
104+
105+
.footer .nav-divider {
106+
margin: 8px auto;
107+
}
108+
109+
.content {
110+
padding: 18px 0 12px 0;
111+
}
112+
}
113+
114+
&:not(.navigation-dark) {
115+
background: white;
116+
117+
.content {
118+
padding: 18px 12px;
119+
}
120+
&:not(.expanded) {
121+
.content {
122+
padding: 18px 12px;
123+
}
124+
}
125+
126+
.content .nav-header .label {
127+
@include overline($gray-9);
128+
}
129+
130+
.footer {
131+
margin-left: 6px;
132+
133+
.footer-item {
134+
margin-left: 12px;
135+
justify-content: unset;
136+
}
137+
.nav-divider {
138+
position: absolute;
139+
top: 0;
140+
left: 24px;
141+
margin: 0;
142+
height: 1px;
143+
width: 16px;
144+
background-color: $gray-2;
145+
border: none;
146+
}
147+
}
148+
149+
.resize-tab-button {
150+
border: 1px solid $gray-2;
151+
border-left-color: white;
152+
color: $gray-7;
153+
background: white;
86154
}
87155
}
88156
}

projects/components/src/navigation/navigation-list.component.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,52 @@ describe('Navigation List Component', () => {
144144
expect(spectator.queryAll('.nav-header')).toHaveLength(1);
145145
expect(spectator.queryAll('.nav-header .label')[0]).toHaveText('header 1');
146146
});
147+
148+
test('should render nav group label and icon if provided', () => {
149+
const navItems: NavItemConfig[] = [
150+
{
151+
type: NavItemType.Header,
152+
label: 'header 1',
153+
isVisible$: of(true)
154+
},
155+
{
156+
type: NavItemType.Link,
157+
icon: 'icon',
158+
label: 'label',
159+
matchPaths: ['']
160+
}
161+
];
162+
const footerItems: FooterItemConfig[] = [
163+
{
164+
url: 'http://test',
165+
label: 'Footer item',
166+
icon: 'icon'
167+
}
168+
];
169+
const navGroup = {
170+
label: 'TEST LABEL',
171+
icon: IconType.StatusCode,
172+
displayNavList: true,
173+
navItems: navItems
174+
};
175+
spectator = createHost(
176+
`<ht-navigation-list [navGroup]="navGroup" [navItems]="navItems" [footerItems]="footerItems"></ht-navigation-list>`,
177+
{
178+
hostProps: { navItems: navItems, navGroup: navGroup, footerItems: footerItems },
179+
providers: [
180+
mockProvider(ActivatedRoute, activatedRoute),
181+
mockProvider(NavigationListComponentService, {
182+
resolveFeaturesAndUpdateVisibilityForNavItems: jest.fn().mockReturnValue(navItems)
183+
}),
184+
mockProvider(NavigationService, {
185+
navigation$: EMPTY,
186+
navigateWithinApp: jest.fn(),
187+
getCurrentActivatedRoute: jest.fn().mockReturnValue(of(activatedRoute))
188+
})
189+
]
190+
}
191+
);
192+
expect(spectator.query('.nav-group-icon')).toExist();
193+
expect(spectator.query('.nav-group-label')).toExist();
194+
});
147195
});

0 commit comments

Comments
 (0)