Add eslint
This commit is contained in:
@@ -23,7 +23,15 @@ import { Component, input, output, HostListener } from '@angular/core';
|
||||
standalone: true,
|
||||
template: `
|
||||
<!-- Backdrop -->
|
||||
<div class="fixed inset-0 z-40 bg-black/30" (click)="cancelled.emit()"></div>
|
||||
<div
|
||||
class="fixed inset-0 z-40 bg-black/30"
|
||||
(click)="cancelled.emit(undefined)"
|
||||
(keydown.enter)="cancelled.emit(undefined)"
|
||||
(keydown.space)="cancelled.emit(undefined)"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="Close dialog"
|
||||
></div>
|
||||
<!-- Dialog -->
|
||||
<div class="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-card border border-border rounded-lg shadow-lg"
|
||||
[class]="widthClass()">
|
||||
@@ -35,13 +43,15 @@ import { Component, input, output, HostListener } from '@angular/core';
|
||||
</div>
|
||||
<div class="flex gap-2 p-3 border-t border-border">
|
||||
<button
|
||||
(click)="cancelled.emit()"
|
||||
(click)="cancelled.emit(undefined)"
|
||||
type="button"
|
||||
class="flex-1 px-3 py-2 bg-secondary text-foreground rounded-lg hover:bg-secondary/80 transition-colors text-sm"
|
||||
>
|
||||
{{ cancelLabel() }}
|
||||
</button>
|
||||
<button
|
||||
(click)="confirmed.emit()"
|
||||
(click)="confirmed.emit(undefined)"
|
||||
type="button"
|
||||
class="flex-1 px-3 py-2 rounded-lg transition-colors text-sm"
|
||||
[class.bg-primary]="variant() === 'primary'"
|
||||
[class.text-primary-foreground]="variant() === 'primary'"
|
||||
@@ -55,7 +65,7 @@ import { Component, input, output, HostListener } from '@angular/core';
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
styles: [`:host { display: contents; }`],
|
||||
styles: [':host { display: contents; }']
|
||||
})
|
||||
export class ConfirmDialogComponent {
|
||||
/** Dialog title. */
|
||||
@@ -69,12 +79,12 @@ export class ConfirmDialogComponent {
|
||||
/** Tailwind width class for the dialog. */
|
||||
widthClass = input<string>('w-[320px]');
|
||||
/** Emitted when the user confirms. */
|
||||
confirmed = output<void>();
|
||||
confirmed = output<undefined>();
|
||||
/** Emitted when the user cancels (backdrop click, Cancel button, or Escape). */
|
||||
cancelled = output<void>();
|
||||
cancelled = output<undefined>();
|
||||
|
||||
@HostListener('document:keydown.escape')
|
||||
onEscape(): void {
|
||||
this.cancelled.emit();
|
||||
this.cancelled.emit(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,15 @@ import { Component, input, output, HostListener } from '@angular/core';
|
||||
standalone: true,
|
||||
template: `
|
||||
<!-- Invisible backdrop that captures clicks outside -->
|
||||
<div class="fixed inset-0 z-40" (click)="closed.emit()"></div>
|
||||
<div
|
||||
class="fixed inset-0 z-40"
|
||||
(click)="closed.emit(undefined)"
|
||||
(keydown.enter)="closed.emit(undefined)"
|
||||
(keydown.space)="closed.emit(undefined)"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="Close menu"
|
||||
></div>
|
||||
<!-- Positioned menu panel -->
|
||||
<div
|
||||
class="fixed z-50 bg-card border border-border rounded-lg shadow-lg py-1"
|
||||
@@ -57,21 +65,23 @@ import { Component, input, output, HostListener } from '@angular/core';
|
||||
:host ::ng-deep .context-menu-empty {
|
||||
@apply px-3 py-1.5 text-sm text-muted-foreground;
|
||||
}
|
||||
`,
|
||||
],
|
||||
`
|
||||
]
|
||||
})
|
||||
export class ContextMenuComponent {
|
||||
/** Horizontal position (px from left). */
|
||||
// eslint-disable-next-line id-length, id-denylist
|
||||
x = input.required<number>();
|
||||
/** Vertical position (px from top). */
|
||||
// eslint-disable-next-line id-length, id-denylist
|
||||
y = input.required<number>();
|
||||
/** Tailwind width class for the panel (default `w-48`). */
|
||||
width = input<string>('w-48');
|
||||
/** Emitted when the menu should close (backdrop click or Escape). */
|
||||
closed = output<void>();
|
||||
closed = output<undefined>();
|
||||
|
||||
@HostListener('document:keydown.escape')
|
||||
onEscape(): void {
|
||||
this.closed.emit();
|
||||
this.closed.emit(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import { Component, input } from '@angular/core';
|
||||
</div>
|
||||
}
|
||||
`,
|
||||
styles: [`:host { display: contents; }`],
|
||||
styles: [':host { display: contents; }']
|
||||
})
|
||||
export class UserAvatarComponent {
|
||||
/** Display name — first character is used as fallback initial. */
|
||||
@@ -48,7 +48,8 @@ export class UserAvatarComponent {
|
||||
|
||||
/** Compute the first-letter initial. */
|
||||
initial(): string {
|
||||
return this.name()?.charAt(0)?.toUpperCase() ?? '?';
|
||||
return this.name()?.charAt(0)
|
||||
?.toUpperCase() ?? '?';
|
||||
}
|
||||
|
||||
/** Map size token to Tailwind dimension classes. */
|
||||
|
||||
Reference in New Issue
Block a user