Skip to content

Commit 259bbf1

Browse files
committed
feat: improved error handling and confirmation dialog
1 parent 724f572 commit 259bbf1

File tree

6 files changed

+189
-56
lines changed

6 files changed

+189
-56
lines changed

index.css

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ body {
6262

6363
body {
6464
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
65+
font-size: 12px;
6566
color: var(--color-ui-text);
6667
background-color: var(--color-ui);
6768
background-image: none;
@@ -713,6 +714,7 @@ input[type="search"]:focus::-webkit-search-cancel-button {
713714
max-width: 500px;
714715
box-shadow: 0 20px 40px rgb(0, 0, 0, 0.1);
715716
background: var(--color-bg);
717+
font-size: 12px;
716718
color: var(--color-text);
717719
border-radius: var(--border-radius-lg);
718720
user-select: none;
@@ -777,7 +779,8 @@ input[type="search"]:focus::-webkit-search-cancel-button {
777779
font-weight: 600;
778780
}
779781

780-
[role="dialog"] > .modal-content > .modal-header > .close-btn {
782+
[role="dialog"] > .modal-content > .modal-header > .close-btn,
783+
.toast > .close-btn {
781784
background: none;
782785
border: none;
783786
font-size: 24px;
@@ -1031,7 +1034,8 @@ fieldset {
10311034
*/
10321035

10331036
.btn-primary,
1034-
.btn-secondary {
1037+
.btn-secondary,
1038+
.btn-danger {
10351039
padding: 10px 20px;
10361040
border-radius: var(--border-radius-xl);
10371041
font-size: 14px;
@@ -1059,6 +1063,58 @@ fieldset {
10591063
background: var(--color-overlay);
10601064
}
10611065

1066+
.btn-danger {
1067+
color: white;
1068+
background: var(--color-danger);
1069+
border: 1px solid var(--color-danger);
1070+
}
1071+
1072+
.btn-danger:hover {
1073+
background: var(--color-danger-hover);
1074+
}
1075+
1076+
/*
1077+
* MARK: Toast
1078+
*/
1079+
1080+
.toasts {
1081+
position: fixed;
1082+
bottom: 0;
1083+
width: 100%;
1084+
pointer-events: none;
1085+
}
1086+
1087+
.toast {
1088+
display: flex;
1089+
align-items: center !important;
1090+
width: 350px;
1091+
max-width: 100%;
1092+
margin: 0 auto 2rem auto;
1093+
color: var(--color-text);
1094+
pointer-events: auto;
1095+
background-clip: padding-box;
1096+
background-color: var(--color-bg);
1097+
border: 1px solid var(--color-ui-border);
1098+
box-shadow: rgb(32, 33, 36, 0.28) 0px 1px 6px 0px;
1099+
border-radius: var(--border-radius);
1100+
z-index: 1090;
1101+
opacity: 0;
1102+
transform: translateY(2rem);
1103+
transition: opacity 0.2s linear, transform 0.2s ease;
1104+
}
1105+
1106+
.toast.show {
1107+
opacity: 1;
1108+
transform: translateY(0);
1109+
}
1110+
1111+
.toast-body {
1112+
padding: 1.25rem 0.75rem;
1113+
word-wrap: break-word;
1114+
flex-grow: 1;
1115+
font-size: 1rem;
1116+
}
1117+
10621118
/*
10631119
* MARK: Welcome modal
10641120
*/

index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,21 @@ <h2 class="modal-title"></h2>
149149
</form>
150150
</dialog>
151151

152+
<dialog id="removeModal" role="dialog" aria-modal="true">
153+
<form class="modal-content" data-action="removeItem" method="dialog">
154+
<div class="modal-header">
155+
<h2 class="modal-title"></h2>
156+
</div>
157+
158+
<div class="modal-body"></div>
159+
160+
<div class="modal-footer">
161+
<button type="reset" class="btn-secondary" data-i18n="cancel"></button>
162+
<button type="submit" class="btn-danger" data-i18n="delete"></button>
163+
</div>
164+
</form>
165+
</dialog>
166+
152167
<dialog id="settingsModal" role="dialog" aria-modal="true">
153168
<form class="modal-content" data-action="saveSettings" method="dialog">
154169
<div class="modal-header">
@@ -318,6 +333,8 @@ <h2 class="modal-title" data-i18n="settings"></h2>
318333
</form>
319334
</dialog>
320335

336+
<div id="toasts" class="toasts"></div>
337+
321338
<svg xmlns="http://www.w3.org/2000/svg" class="hidden">
322339
<symbol id="spinner" viewBox="0 0 60 60"><g fill="none" fill-rule="evenodd" stroke="currentcolor"><g transform="translate(12 12)" stroke-width="4"><circle stroke-opacity=".15" cx="18" cy="18" r="18"/><path d="M36 18c0-9.94-8.06-18-18-18"><animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur="1s" repeatCount="indefinite"/></path></g></g></symbol>
323340
<symbol id="search" viewBox="0 0 24 24" fill="currentcolor"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path></symbol>

0 commit comments

Comments
 (0)