diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.html b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.html new file mode 100644 index 00000000..0697581d --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.html @@ -0,0 +1,20 @@ + + + + {{ icon }} + + + {{ title }} + {{ description }} + + + @if (showCardContent) { + + } + + + + + + + diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.scss b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.scss new file mode 100644 index 00000000..3e65b82a --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.scss @@ -0,0 +1,63 @@ +.base-card { + max-width: 100%; + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + transition: box-shadow 0.3s ease-in-out; +} + +.base-card:hover { + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); +} + +.card-header, +.card-content { + display: flex; + align-items: center; + gap: 16px; + padding: 20px 20px 10px 20px; +} + +.card-content { + padding: 10px; + justify-content: center; +} + +.hidden { + display: none; +} +.divider { + width: 80%; + margin: auto; + height: 1px; + background-color: #e0e0e0; +} + +.icon-container { + background-color: #673ab7; + padding: 16px; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; +} + +.card-icon { + color: white; + font-size: 24px; +} + +.text-container { + display: flex; + flex-direction: column; +} + +.card-title { + font-size: 1.2rem; + font-weight: 600; + color: #333; +} + +.card-subtitle { + font-size: 0.9rem; + color: #666; +} diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.spec.ts b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.spec.ts new file mode 100644 index 00000000..0b9cd928 --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BaseCardComponent } from './base-card.component'; + +describe('BaseCardComponent', () => { + let component: BaseCardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [BaseCardComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(BaseCardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.ts b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.ts new file mode 100644 index 00000000..4a09dd0c --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.ts @@ -0,0 +1,54 @@ +import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, Input, ViewChild } from '@angular/core'; +import { MatCardModule } from '@angular/material/card'; +import { MatDividerModule } from '@angular/material/divider'; +import { MatIconModule } from '@angular/material/icon'; + +@Component({ + selector: 'ov-base-card', + standalone: true, + imports: [MatCardModule, MatIconModule, MatDividerModule], + templateUrl: './base-card.component.html', + styleUrl: './base-card.component.scss' +}) +export class BaseCardComponent implements AfterViewInit { + /** + * The title of the dynamic card component. + * This input property allows setting a custom title for the card. + */ + @Input() title: string = ''; + /** + * A brief description of the dynamic card component. + * This input property allows setting a description for the card. + */ + @Input() description: string = ''; + /** + * The name of the icon to be displayed. Defaults to "settings". + * + * @type {string} + * @default 'settings' + */ + @Input() icon: string = 'settings'; + /** + * The background color of the icon. + * + * @default '#000000' + */ + @Input() iconBackgroundColor: string = '#000000'; + /** + * The background color of the card component. + * Accepts any valid CSS color string. + */ + @Input() cardBackgroundColor: string = '#ffffff'; + + // Content child reference to the card content. + @ViewChild('cardContent', { static: false }) cardContent: ElementRef | undefined; + showCardContent: boolean = false; + + constructor(protected cdr: ChangeDetectorRef) {} + + ngAfterViewInit() { + console.log(this.cardContent) + this.showCardContent = this.cardContent?.nativeElement.children.length > 0; + this.cdr.detectChanges(); + } +} diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.html b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.html new file mode 100644 index 00000000..30e66f8c --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.html @@ -0,0 +1,14 @@ + + + Select + + + @for (option of options; track option.value) { + + {{ option.label }} + + } + + + + diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.scss b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.scss new file mode 100644 index 00000000..6ef35dd5 --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.scss @@ -0,0 +1,24 @@ +.mat-form-field { + width: 100%; + margin-top: 8px; + + .mat-select { + font-size: 1rem; + color: #333; + } + + .mat-select-placeholder { + color: #aaa; + } + + .mat-option-text { + color: #333; + } +} + +.card-content { + display: flex; + align-items: center; + gap: 16px; + // padding: 20px; +} \ No newline at end of file diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.spec.ts b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.spec.ts new file mode 100644 index 00000000..2e99f3ab --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SelectionCardComponent } from './selection-card.component'; + +describe('SelectionCardComponent', () => { + let component: SelectionCardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [SelectionCardComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SelectionCardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.ts b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.ts new file mode 100644 index 00000000..b33ef013 --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/components/cards/selection-card/selection-card.component.ts @@ -0,0 +1,20 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { BaseCardComponent } from '../base-card/base-card.component'; +import { MatSelectModule } from '@angular/material/select'; +import { MatFormFieldModule } from '@angular/material/form-field'; + +@Component({ + selector: 'ov-selection-card', + standalone: true, + imports: [BaseCardComponent, MatSelectModule, MatFormFieldModule], + templateUrl: './selection-card.component.html', + styleUrl: './selection-card.component.scss' +}) +export class SelectionCardComponent extends BaseCardComponent { + @Input() options: { label: string; value: any }[] = []; + @Input() selectedOption: any; + @Output() onOptionSelected = new EventEmitter(); + onSelectionChange(event: any) { + this.onOptionSelected.emit(event.value); + } +} diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/toggle-card/toggle-card.component.html b/frontend/projects/shared-call-components/src/lib/components/cards/toggle-card/toggle-card.component.html index add2a66c..ccc36304 100644 --- a/frontend/projects/shared-call-components/src/lib/components/cards/toggle-card/toggle-card.component.html +++ b/frontend/projects/shared-call-components/src/lib/components/cards/toggle-card/toggle-card.component.html @@ -1,16 +1,18 @@ - - - - {{ icon }} - - - {{ title || '' }} - {{ description || 'OpenVidu' }} - - + + -
Select