phase-7: add reusable input-output widget library and default registry
This commit is contained in:
44
src/app/widgets/ui/footer-navigation-widget.component.ts
Normal file
44
src/app/widgets/ui/footer-navigation-widget.component.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
|
||||
export interface FooterNavigationLink {
|
||||
id: string;
|
||||
label: string;
|
||||
href: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-footer-navigation-widget',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
template: `
|
||||
<footer class="footer-nav-widget">
|
||||
<nav>
|
||||
<ul>
|
||||
@for (link of links; track link.id) {
|
||||
<li>
|
||||
<button type="button" (click)="onLinkClick(link)">{{ link.label }}</button>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</nav>
|
||||
</footer>
|
||||
`,
|
||||
styles: [
|
||||
`
|
||||
.footer-nav-widget { padding: 1rem; border-top: 1px solid var(--border-color, #d3dad9); }
|
||||
ul { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
|
||||
button { background: transparent; border: none; color: var(--text-secondary, #667a77); cursor: pointer; }
|
||||
`
|
||||
],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class FooterNavigationWidgetComponent {
|
||||
@Input() links: FooterNavigationLink[] = [];
|
||||
|
||||
@Output() linkSelected = new EventEmitter<FooterNavigationLink>();
|
||||
|
||||
onLinkClick(link: FooterNavigationLink): void {
|
||||
this.linkSelected.emit(link);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user