Skip to content

Commit 7013af5

Browse files
palbizuPatricio Albizu
andauthored
feat: Adding properties to Title Content (#1235)
* feat: Adding properties to Title Content * feat: Fixing comments * feat: fixing comments Co-authored-by: Patricio Albizu <patricioalbizu@Patricios-MacBook-Pro.local>
1 parent 5ee7d10 commit 7013af5

File tree

3 files changed

+73
-14
lines changed

3 files changed

+73
-14
lines changed

projects/components/src/public-api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,12 @@ export * from './time-range/time-range.component';
317317
export * from './time-range/time-range.module';
318318

319319
// Titled Content
320-
export { TitledContentComponent, TitlePosition } from './titled-content/titled-content.component';
320+
export {
321+
TitledContentComponent,
322+
TitlePosition,
323+
TitledContentTitleStyle,
324+
TitledContentHeaderJustify
325+
} from './titled-content/titled-content.component';
321326
export { TitledContentModule } from './titled-content/titled-content.module';
322327

323328
// Toggle Button

projects/components/src/titled-content/titled-content.component.scss

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,24 @@
1111
display: flex;
1212
flex-direction: row;
1313
align-items: center;
14-
justify-items: center;
14+
15+
&.center {
16+
justify-items: center;
17+
}
18+
19+
&.space-between {
20+
justify-content: space-between;
21+
}
1522

1623
.link {
17-
margin-left: 20px;
18-
margin-top: 14px;
24+
&.regular {
25+
margin-left: 20px;
26+
margin-top: 14px;
27+
}
28+
29+
&.grayed-out {
30+
margin: 0 16px 12px 16px;
31+
}
1932
}
2033

2134
.controls {
@@ -26,11 +39,23 @@
2639
}
2740

2841
.title {
29-
@include overline($gray-9);
30-
margin-top: 16px;
42+
&.regular {
43+
@include overline($gray-9);
44+
margin-top: 16px;
45+
}
46+
47+
&.grayed-out {
48+
@include overline($gray-5);
49+
height: 12px;
50+
margin-bottom: 12px;
51+
}
3152
}
3253
}
3354

55+
.header:has(.title .grayed-out) {
56+
margin-bottom: 12px;
57+
}
58+
3459
.content {
3560
height: 100%;
3661
width: 100%;
@@ -40,8 +65,15 @@
4065

4166
.footer {
4267
.title {
43-
@include overline($gray-4);
4468
margin-top: 8px;
4569
}
70+
71+
&.regular {
72+
@include overline($gray-4);
73+
}
74+
75+
&.grayed-out {
76+
@include overline($gray-5);
77+
}
4678
}
4779
}

projects/components/src/titled-content/titled-content.component.ts

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ import { TitledHeaderControlDirective } from './header-controls/titled-header-co
1010
changeDetection: ChangeDetectionStrategy.OnPush,
1111
template: `
1212
<div class="titled-content-container">
13-
<div class="header" [htLayoutChangeTrigger]="this.shouldShowHeader">
14-
<ht-label *ngIf="this.shouldShowTitleInHeader" [label]="this.title" class="title"></ht-label>
15-
<ht-link [paramsOrUrl]="this.link" class="link" *ngIf="this.link">
13+
<div class="header" [ngClass]="this.headerJustifyContent" [htLayoutChangeTrigger]="this.shouldShowHeader">
14+
<ht-label
15+
*ngIf="this.shouldShowTitleInHeader"
16+
[ngClass]="this.titleStyle"
17+
[label]="this.title"
18+
class="title"
19+
></ht-label>
20+
<ht-link [paramsOrUrl]="this.link" class="link" [ngClass]="this.titleStyle" *ngIf="this.link">
1621
<ht-button
1722
[label]="this.linkLabel"
18-
role="${ButtonRole.Primary}"
19-
display="${ButtonStyle.Text}"
23+
role="${ButtonRole.Quaternary}"
24+
display="${ButtonStyle.Solid}"
2025
size="${ButtonSize.ExtraSmall}"
2126
icon="${IconType.ChevronRight}"
2227
[trailingIcon]="true"
@@ -29,8 +34,8 @@ import { TitledHeaderControlDirective } from './header-controls/titled-header-co
2934
<div class="content">
3035
<ng-content></ng-content>
3136
</div>
32-
<div class="footer">
33-
<ht-label *ngIf="this.shouldShowTitleInFooter" [label]="this.title" class="title"></ht-label>
37+
<div class="footer" *ngIf="this.shouldShowTitleInFooter">
38+
<ht-label [ngClass]="this.titleStyle" [label]="this.title" class="title"></ht-label>
3439
</div>
3540
</div>
3641
`
@@ -42,12 +47,18 @@ export class TitledContentComponent {
4247
@Input()
4348
public titlePosition: TitlePosition = TitlePosition.Header;
4449

50+
@Input()
51+
public titleStyle: TitledContentTitleStyle = TitledContentTitleStyle.Regular;
52+
4553
@Input()
4654
public hideTitle: boolean = false;
4755

4856
@Input()
4957
public link?: string;
5058

59+
@Input()
60+
public headerJustifyContent: TitledContentHeaderJustify = TitledContentHeaderJustify.Center;
61+
5162
@Input()
5263
public linkLabel?: string;
5364

@@ -75,3 +86,14 @@ export const enum TitlePosition {
7586
Header = 'header',
7687
Footer = 'footer'
7788
}
89+
90+
// Regular title (black) and GrayedOut new style (gray)
91+
export const enum TitledContentTitleStyle {
92+
Regular = 'regular',
93+
GrayedOut = 'grayed-out'
94+
}
95+
96+
export const enum TitledContentHeaderJustify {
97+
Center = 'center',
98+
SpaceBetween = 'space-between'
99+
}

0 commit comments

Comments
 (0)