|
11 | 11 | </svg> |
12 | 12 | </app-button> |
13 | 13 |
|
14 | | -<div |
15 | | - class="animate-fade fixed inset-0 z-50 p-16 md:px-24 md:py-44" |
16 | | - role="dialog" |
17 | | - *ngIf="showModal" |
18 | | -> |
19 | | - <form (ngSubmit)="onSubmit()" [formGroup]="diaryForm"> |
20 | | - <div class="relative w-full max-w-xl"> |
21 | | - <textarea |
22 | | - class="form-control m-0 block w-full resize-none rounded-xs border-[3px] border-black bg-white px-3 py-1.5 text-base font-normal shadow-[5px_5px_0px_rgba(0,0,0,1)] focus:outline-hidden" |
23 | | - rows="{7}" |
24 | | - placeholder="Your diary entry" |
25 | | - formControlName="entry" |
26 | | - ></textarea> |
27 | | - |
28 | | - <div role="toolbar" class="flex items-center justify-between"> |
29 | | - <div> |
30 | | - <button |
31 | | - type="button" |
32 | | - aria-label="Attach a file to the entry" |
33 | | - class="hover:text-lavender-blue-600 active:text-lavender-blue-400 flex items-center gap-2" |
34 | | - (click)="openSelectFile()" |
35 | | - > |
36 | | - <svg |
37 | | - width="20" |
38 | | - xmlns="http://www.w3.org/2000/svg" |
39 | | - viewBox="0 0 29 29" |
40 | | - fill="currentColor" |
| 14 | +@if (showModal) { |
| 15 | + <div |
| 16 | + class="animate-fade fixed inset-0 z-50 p-16 md:px-24 md:py-44" |
| 17 | + role="dialog" |
| 18 | + > |
| 19 | + <form (ngSubmit)="onSubmit()" [formGroup]="diaryForm"> |
| 20 | + <div class="relative w-full max-w-xl"> |
| 21 | + <textarea |
| 22 | + class="form-control m-0 block w-full resize-none rounded-xs border-[3px] border-black bg-white px-3 py-1.5 text-base font-normal shadow-[5px_5px_0px_rgba(0,0,0,1)] focus:outline-hidden" |
| 23 | + rows="{7}" |
| 24 | + placeholder="Your diary entry" |
| 25 | + formControlName="entry" |
| 26 | + ></textarea> |
| 27 | + <div role="toolbar" class="flex items-center justify-between"> |
| 28 | + <div> |
| 29 | + <button |
| 30 | + type="button" |
| 31 | + aria-label="Attach a file to the entry" |
| 32 | + class="hover:text-lavender-blue-600 active:text-lavender-blue-400 flex items-center gap-2" |
| 33 | + (click)="openSelectFile()" |
41 | 34 | > |
42 | | - <g> |
43 | | - <rect fill="none" class="opacity-25" width="29" height="29" /> |
44 | | - <path |
45 | | - d="M8.36,26.92c-2,0-3.88-.78-5.29-2.19C.15,21.81.15,17.06,3.06,14.14L12.57,4.64c.39-.39,1.02-.39,1.41,0s.39,1.02,0,1.41L4.48,15.56c-2.14,2.14-2.14,5.62,0,7.76,1.04,1.04,2.41,1.61,3.88,1.61s2.84-.57,3.88-1.61l12.79-12.79c1.47-1.47,1.47-3.87,0-5.34-1.47-1.47-3.87-1.47-5.34,0l-12.45,12.45c-.73.73-.73,1.91,0,2.64.73.73,1.91.73,2.64,0l9.17-9.17c.39-.39,1.02-.39,1.41,0s.39,1.02,0,1.41l-9.17,9.17c-1.51,1.51-3.96,1.51-5.47,0-1.51-1.51-1.51-3.96,0-5.47L18.26,3.77c2.25-2.25,5.92-2.25,8.17,0s2.25,5.92,0,8.17l-12.79,12.79c-1.41,1.41-3.29,2.19-5.29,2.19Z" |
46 | | - /> |
47 | | - </g> |
48 | | - </svg> |
49 | | - <span class="max-w-48 truncate"> |
50 | | - <small>{{ |
51 | | - file !== undefined ? file.name : "Attach file" |
52 | | - }}</small> |
53 | | - </span> |
54 | | - </button> |
55 | | - |
56 | | - <input |
57 | | - type="file" |
58 | | - class="fixed right-0 -bottom-24 opacity-0" |
59 | | - (change)="onFileChanged($event)" |
60 | | - [disabled]="diaryForm.disabled" |
61 | | - #inputFile |
62 | | - /> |
63 | | - </div> |
64 | | - |
65 | | - <div |
66 | | - class="my-8 inline-block h-6 w-6 animate-spin rounded-full border-[3px] border-current border-t-transparent text-indigo-600" |
67 | | - role="status" |
68 | | - aria-label="loading" |
69 | | - *ngIf="diaryForm.disabled" |
70 | | - > |
71 | | - <span class="sr-only">Loading...</span> |
72 | | - </div> |
73 | | - |
74 | | - <div class="my-4 flex" *ngIf="!diaryForm.disabled"> |
75 | | - <button |
76 | | - class="hover:text-lavender-blue-600 active:text-lavender-blue-400 px-8 py-1" |
77 | | - type="button" |
78 | | - (click)="closeModal()" |
79 | | - > |
80 | | - Close |
81 | | - </button> |
82 | | - |
83 | | - <app-button [disabled]="diaryForm.disabled"> Submit </app-button> |
| 35 | + <svg |
| 36 | + width="20" |
| 37 | + xmlns="http://www.w3.org/2000/svg" |
| 38 | + viewBox="0 0 29 29" |
| 39 | + fill="currentColor" |
| 40 | + > |
| 41 | + <g> |
| 42 | + <rect fill="none" class="opacity-25" width="29" height="29" /> |
| 43 | + <path |
| 44 | + d="M8.36,26.92c-2,0-3.88-.78-5.29-2.19C.15,21.81.15,17.06,3.06,14.14L12.57,4.64c.39-.39,1.02-.39,1.41,0s.39,1.02,0,1.41L4.48,15.56c-2.14,2.14-2.14,5.62,0,7.76,1.04,1.04,2.41,1.61,3.88,1.61s2.84-.57,3.88-1.61l12.79-12.79c1.47-1.47,1.47-3.87,0-5.34-1.47-1.47-3.87-1.47-5.34,0l-12.45,12.45c-.73.73-.73,1.91,0,2.64.73.73,1.91.73,2.64,0l9.17-9.17c.39-.39,1.02-.39,1.41,0s.39,1.02,0,1.41l-9.17,9.17c-1.51,1.51-3.96,1.51-5.47,0-1.51-1.51-1.51-3.96,0-5.47L18.26,3.77c2.25-2.25,5.92-2.25,8.17,0s2.25,5.92,0,8.17l-12.79,12.79c-1.41,1.41-3.29,2.19-5.29,2.19Z" |
| 45 | + /> |
| 46 | + </g> |
| 47 | + </svg> |
| 48 | + <span class="max-w-48 truncate"> |
| 49 | + <small>{{ |
| 50 | + file !== undefined ? file.name : "Attach file" |
| 51 | + }}</small> |
| 52 | + </span> |
| 53 | + </button> |
| 54 | + <input |
| 55 | + type="file" |
| 56 | + class="fixed right-0 -bottom-24 opacity-0" |
| 57 | + (change)="onFileChanged($event)" |
| 58 | + [disabled]="diaryForm.disabled" |
| 59 | + #inputFile |
| 60 | + /> |
| 61 | + </div> |
| 62 | + @if (diaryForm.disabled) { |
| 63 | + <div |
| 64 | + class="my-8 inline-block h-6 w-6 animate-spin rounded-full border-[3px] border-current border-t-transparent text-indigo-600" |
| 65 | + role="status" |
| 66 | + aria-label="loading" |
| 67 | + > |
| 68 | + <span class="sr-only">Loading...</span> |
| 69 | + </div> |
| 70 | + } |
| 71 | + @if (!diaryForm.disabled) { |
| 72 | + <div class="my-4 flex"> |
| 73 | + <button |
| 74 | + class="hover:text-lavender-blue-600 active:text-lavender-blue-400 px-8 py-1" |
| 75 | + type="button" |
| 76 | + (click)="closeModal()" |
| 77 | + > |
| 78 | + Close |
| 79 | + </button> |
| 80 | + <app-button [disabled]="diaryForm.disabled"> Submit </app-button> |
| 81 | + </div> |
| 82 | + } |
84 | 83 | </div> |
85 | 84 | </div> |
86 | | - </div> |
87 | | - </form> |
88 | | -</div> |
| 85 | + </form> |
| 86 | + </div> |
| 87 | +} |
89 | 88 |
|
90 | | -<app-backdrop *ngIf="showModal" [spinner]="false" /> |
| 89 | +@if (showModal) { |
| 90 | + <app-backdrop [spinner]="false" /> |
| 91 | +} |
0 commit comments