From aa63862cbe9ecd9ff6e0b26b07a5fcde012d684c Mon Sep 17 00:00:00 2001 From: Zack Lee Date: Fri, 10 May 2024 09:10:59 -0400 Subject: [PATCH 1/2] Add common-secion-card component --- .../common-section-card.component.html | 11 +++++++ .../common-section-card.component.scss | 6 ++++ .../common-section-card.component.spec.ts | 23 +++++++++++++ .../common-section-card.component.ts | 32 +++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html create mode 100644 frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.scss create mode 100644 frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.spec.ts create mode 100644 frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.ts diff --git a/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html new file mode 100644 index 0000000000..29c3fecb1f --- /dev/null +++ b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html @@ -0,0 +1,11 @@ +
+
+ +
+
+ +
+ +
diff --git a/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.scss b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.scss new file mode 100644 index 0000000000..44ebcc1eee --- /dev/null +++ b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.scss @@ -0,0 +1,6 @@ +.common-section-card-container { + + .footer-container { + display: none; + } +} diff --git a/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.spec.ts b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.spec.ts new file mode 100644 index 0000000000..f157b95967 --- /dev/null +++ b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CommonSectionCardComponent } from './common-section-card.component'; + +describe('CommonSectionCardComponent', () => { + let component: CommonSectionCardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [CommonSectionCardComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(CommonSectionCardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.ts b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.ts new file mode 100644 index 0000000000..b26997de49 --- /dev/null +++ b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.ts @@ -0,0 +1,32 @@ +import { CommonModule } from '@angular/common'; +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { TranslateModule } from '@ngx-translate/core'; + +/** + * A component nested in this component can be displayed in the **header**, **content** or **footer** slot. + * The **header** slot should contain a component that wraps a **app-common-section-card-header**. + * The **content** slot should contain a component that wraps a **app-common-section-card-content**. + * The **footer** slot should contain a component that wraps a **app-common-section-card-footer**. + * Simply nest the component and add the slot name as an attribute. + * + * Example usage: + * + * ``` + * + *
Hi I'm in the header slot
+ *
Hi I'm in the content slot
+ *
Hi I'm in the content slot
+ *
+ * ``` + */ +@Component({ + selector: 'app-common-section-card', + standalone: true, + imports: [CommonModule, TranslateModule], + templateUrl: './common-section-card.component.html', + styleUrl: './common-section-card.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class CommonSectionCardComponent { + @Input() hasFooter: boolean = false; +} From a6468887fa2ff7270a6c40f0961f1a6ba6c7d2bc Mon Sep 17 00:00:00 2001 From: Zack Lee Date: Fri, 10 May 2024 11:04:10 -0400 Subject: [PATCH 2/2] Remove the hasFooter flag --- .../common-section-card/common-section-card.component.html | 2 +- .../common-section-card/common-section-card.component.scss | 6 ------ .../common-section-card/common-section-card.component.ts | 3 +-- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html index 29c3fecb1f..53705852ad 100644 --- a/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html +++ b/frontend/projects/upgrade/src/app/shared-standalone-component-lib/components/common-section-card/common-section-card.component.html @@ -5,7 +5,7 @@
-