You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
965B

  1. import { Component, Input, Output, EventEmitter } from '@angular/core';
  2. import { CommonModule } from '@angular/common';
  3. import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
  4. import {
  5. faEdit,
  6. faAlignLeft,
  7. faFileAlt,
  8. faEnvelope,
  9. IconDefinition
  10. } from '@fortawesome/free-solid-svg-icons';
  11. import { Agent } from '../../models/data.model';
  12. @Component({
  13. selector: 'app-agent-card',
  14. standalone: true,
  15. imports: [CommonModule, FontAwesomeModule],
  16. templateUrl: './agent-card.html',
  17. styleUrls: ['./agent-card.scss']
  18. })
  19. export class AgentCard {
  20. @Input() agent!: Agent;
  21. @Output() selected = new EventEmitter<Agent>();
  22. private iconMap: { [key: string]: IconDefinition } = {
  23. 'edit': faEdit,
  24. 'align-left': faAlignLeft,
  25. 'file-alt': faFileAlt,
  26. 'envelope': faEnvelope
  27. };
  28. getIcon(): IconDefinition {
  29. return this.iconMap[this.agent.icon] || faEdit;
  30. }
  31. onSelect(): void {
  32. this.selected.emit(this.agent);
  33. }
  34. }