Skip to content

Commit 66c704b

Browse files
authored
Merge pull request ceph#64631 from rhcs-dashboard/details-card-component
mgr/dashboard: introduce details card component Reviewed-by: Naman Munet <[email protected]> Reviewed-by: Pedro Gonzalez Gomez <[email protected]>
2 parents ea9fa12 + 6ad4bd1 commit 66c704b

File tree

5 files changed

+71
-4
lines changed

5 files changed

+71
-4
lines changed

src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ import {
3737
ComboBoxModule,
3838
ProgressIndicatorModule,
3939
PanelModule,
40-
LayoutModule
40+
LayoutModule,
41+
TilesModule
4142
} from 'carbon-components-angular';
4243
import EditIcon from '@carbon/icons/es/edit/20';
4344
import CodeIcon from '@carbon/icons/es/code/16';
@@ -87,6 +88,7 @@ import { SidePanelComponent } from './side-panel/side-panel.component';
8788
import { ChartsModule } from '@carbon/charts-angular';
8889
import { InlineMessageComponent } from './inline-message/inline-message.component';
8990
import { IconComponent } from './icon/icon.component';
91+
import { DetailsCardComponent } from './details-card/details-card.component';
9092

9193
// Icons
9294
import InfoIcon from '@carbon/icons/es/information/16';
@@ -135,7 +137,8 @@ import CloseIcon from '@carbon/icons/es/close/16';
135137
BaseChartDirective,
136138
PanelModule,
137139
ChartsModule,
138-
LayoutModule
140+
LayoutModule,
141+
TilesModule
139142
],
140143
declarations: [
141144
SparklineComponent,
@@ -180,7 +183,8 @@ import CloseIcon from '@carbon/icons/es/close/16';
180183
ProgressComponent,
181184
SidePanelComponent,
182185
IconComponent,
183-
InlineMessageComponent
186+
InlineMessageComponent,
187+
DetailsCardComponent
184188
],
185189
providers: [provideCharts(withDefaultRegisterables())],
186190
exports: [
@@ -222,7 +226,8 @@ import CloseIcon from '@carbon/icons/es/close/16';
222226
ProgressComponent,
223227
SidePanelComponent,
224228
IconComponent,
225-
InlineMessageComponent
229+
InlineMessageComponent,
230+
DetailsCardComponent
226231
]
227232
})
228233
export class ComponentsModule {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<cds-tile>
2+
<div class="details-card-header">
3+
<span class="cds--type-heading-03"
4+
i18n>{{ cardTitle }}</span>
5+
</div>
6+
7+
<div class="details-card-body">
8+
<div cdsRow>
9+
<ng-content select=".details-body-content"></ng-content>
10+
</div>
11+
</div>
12+
</cds-tile>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@use '@carbon/layout';
2+
3+
.details-card-header {
4+
align-items: center;
5+
display: flex;
6+
justify-content: space-between;
7+
padding-bottom: layout.$spacing-05;
8+
position: relative;
9+
}
10+
11+
::ng-deep .cds--label {
12+
display: block;
13+
}
14+
15+
.cds--row {
16+
row-gap: layout.$spacing-05;
17+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { DetailsCardComponent } from './details-card.component';
4+
5+
describe('DetailsCardComponent', () => {
6+
let component: DetailsCardComponent;
7+
let fixture: ComponentFixture<DetailsCardComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [DetailsCardComponent]
12+
}).compileComponents();
13+
14+
fixture = TestBed.createComponent(DetailsCardComponent);
15+
component = fixture.componentInstance;
16+
fixture.detectChanges();
17+
});
18+
19+
it('should create', () => {
20+
expect(component).toBeTruthy();
21+
});
22+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Component, Input } from '@angular/core';
2+
3+
@Component({
4+
selector: 'cd-details-card',
5+
templateUrl: './details-card.component.html',
6+
styleUrl: './details-card.component.scss'
7+
})
8+
export class DetailsCardComponent {
9+
@Input()
10+
cardTitle: string;
11+
}

0 commit comments

Comments
 (0)