Skip to content

Commit

Permalink
chore: update style and display
Browse files Browse the repository at this point in the history
  • Loading branch information
fdewas-aneo committed Nov 18, 2024
1 parent cea4f02 commit b19a58d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
mat-dialog-content {
width: 40rem;
}

section {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.25rem 1rem 0 1rem;
}

h2 {
margin: 0;
padding: 0 0 0.75rem 0;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<h2 mat-dialog-title>{{ label }}</h2>
<section>
<h2 mat-dialog-title>{{ label }}</h2>
<button mat-icon-button (click)="copy()">
<mat-icon [fontIcon]="getIcon('copy')" />
</button>
</section>

<mat-dialog-content>
<mat-card>{{ message }}</mat-card>
{{ message }}
</mat-dialog-content>

<mat-dialog-actions align="end">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Component, Inject, inject } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { IconsService } from '@services/icons.service';
import { NotificationService } from '@services/notification.service';

Expand All @@ -14,11 +15,13 @@ export interface TableInspectMessageDialogData {
@Component({
selector: 'app-inspect-message-dialog',
templateUrl: 'table-inspect-message-dialog.component.html',
styleUrl: 'table-inspect-message-dialog.component.css',
standalone: true,
imports: [
MatCardModule,
MatButtonModule,
MatDialogModule,
MatIconModule,
],
providers: [
NotificationService,
Expand Down Expand Up @@ -50,4 +53,8 @@ export class TableInspectMessageDialogComponent {
onNoClick(): void {
this.dialogRef.close();
}

getIcon(name: string) {
return this.iconsService.getIcon(name);
}
}
11 changes: 11 additions & 0 deletions src/app/components/table/table-inspect-message.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
section {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
width: fit-content;
}

mat-icon {
cursor: pointer;
}
24 changes: 11 additions & 13 deletions src/app/components/table/table-inspect-message.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
@if (message) {
<span>{{croppedMessage}}...</span>
<button mat-icon-button (click)="copy()">
<mat-icon [fontIcon]="getIcon('copy')" />
</button>
@if (displayEye) {
<button mat-icon-button (click)="onView()">
<mat-icon [fontIcon]="getIcon('view')" />
</button>
}
} @else {
<span>-</span>
}
<mat-chip disableRipple>
<section>
<span>{{croppedMessage | emptyCell }}</span>
@if (message) {
<mat-icon [fontIcon]="getIcon('copy')" (click)="copy()" />
}
@if (displayEye) {
<mat-icon [fontIcon]="getIcon('view')" (click)="onView()" />
}
</section>
</mat-chip>
9 changes: 7 additions & 2 deletions src/app/components/table/table-inspect-message.component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { Clipboard } from '@angular/cdk/clipboard';
import { Component, Input, inject } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatChipsModule } from '@angular/material/chips';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { EmptyCellPipe } from '@pipes/empty-cell.pipe';
import { IconsService } from '@services/icons.service';
import { NotificationService } from '@services/notification.service';
import { TableInspectMessageDialogComponent, TableInspectMessageDialogData } from './table-inspect-message-dialog.component';

@Component({
selector: 'app-table-inspect-message',
templateUrl: 'table-inspect-message.component.html',
styleUrl: 'table-inspect-message.component.css',
standalone: true,
imports: [
MatDialogModule,
MatButtonModule,
MatIconModule,
MatChipsModule,
EmptyCellPipe,
],
providers: [
NotificationService
Expand All @@ -26,8 +31,8 @@ export class TableInspectMessageComponent {
@Input({ required: true }) set message(entry: string | undefined) {

if (entry && entry !== '') {
if (entry.length > 5) {
this._croppedMessage = entry.substring(0, 30);
if (entry.length > 15) {
this._croppedMessage = `${entry.substring(0, 14).trimEnd()}...`;
this._message = entry;
this._displayEye = true;
} else {
Expand Down

0 comments on commit b19a58d

Please sign in to comment.