Skip to content

Commit 18ec182

Browse files
committed
feat: comments
1 parent ebfdeaa commit 18ec182

37 files changed

Lines changed: 3773 additions & 168 deletions

blocks/browse/da-list/da-list.css

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -254,47 +254,6 @@ da-list-item.is-expanded::after {
254254
display: none;
255255
}
256256

257-
.da-list-status {
258-
position: fixed;
259-
inset: 0;
260-
background: rgb(255 255 255 / 60%);
261-
display: flex;
262-
justify-content: center;
263-
align-items: center;
264-
z-index: 500;
265-
}
266-
267-
.da-list-status-toast {
268-
width: 280px;
269-
background: var(--s2-blue-800);
270-
line-height: 48px;
271-
border-radius: 6px;
272-
filter: drop-shadow(rgb(0 0 0 / 15%) 0 1px 4px);
273-
justify-content: space-between;
274-
align-items: center;
275-
box-sizing: border-box;
276-
color: #fff;
277-
font-size: 14px;
278-
overflow: hidden;
279-
}
280-
281-
.da-list-status-title {
282-
font-weight: 700;
283-
padding: 0 12px 0 40px;
284-
margin: 0;
285-
}
286-
287-
.da-list-status-description {
288-
line-height: 1.6;
289-
padding: 6px 12px;
290-
margin: 0;
291-
background: rgb(255 255 255 / 10%);
292-
}
293-
294-
.da-list-status-type-info .da-list-status-title {
295-
background: var(--s2-blue-800) url("/blocks/browse/img/Smock_InfoOutline_18_N.svg") 12px 50% no-repeat;
296-
}
297-
298257
/* Checkbox */
299258

300259
.checkbox-wrapper {

blocks/browse/da-list/da-list.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default class DaList extends LitElement {
3535
_dropFiles: { state: true },
3636
_dropMessage: { state: true },
3737
_dropConflicts: { state: true },
38-
_status: { state: true },
38+
_toast: { state: true },
3939
_confirm: { state: true },
4040
_confirmText: { state: true },
4141
_unpublish: { state: true },
@@ -90,16 +90,17 @@ export default class DaList extends LitElement {
9090

9191
async firstUpdated() {
9292
await import('../../shared/da-dialog/da-dialog.js');
93+
await import('../../shared/da-toast/da-toast.js');
9394
await import('../da-actionbar/da-actionbar.js');
9495
this.setupObserver();
9596
}
9697

9798
setStatus(text, description, type = 'info') {
9899
if (!text) {
99-
this._status = null;
100+
this._toast = null;
100101
return;
101102
}
102-
this._status = { type, text, description };
103+
this._toast = { type, text, description, duration: 0 };
103104
}
104105

105106
handlePermissions(permissions) {
@@ -363,7 +364,7 @@ export default class DaList extends LitElement {
363364
return pasteItem;
364365
});
365366

366-
const showStatus = setTimeout(() => {
367+
const pasteStatusTimer = setTimeout(() => {
367368
this.setStatus('Pasting', 'Please be patient. Pasting items with many children can take time.');
368369
}, 2000);
369370

@@ -373,7 +374,7 @@ export default class DaList extends LitElement {
373374
await this.handleItemAction({ item, type });
374375
}));
375376

376-
clearTimeout(showStatus);
377+
clearTimeout(pasteStatusTimer);
377378

378379
this.setStatus();
379380
this.handleClear();
@@ -427,8 +428,7 @@ export default class DaList extends LitElement {
427428
}
428429

429430
handleShare() {
430-
this.setStatus('Copied', 'URLs have been copied to the clipboard.');
431-
setTimeout(() => { this.setStatus(); }, 3000);
431+
this._toast = { text: 'Copied', description: 'URLs have been copied to the clipboard.' };
432432
}
433433

434434
dragenter(e) {
@@ -676,13 +676,7 @@ export default class DaList extends LitElement {
676676
}
677677

678678
renderStatus() {
679-
return html`
680-
<div class="da-list-status">
681-
<div class="da-list-status-toast da-list-status-type-${this._status.type}">
682-
<p class="da-list-status-title">${this._status.text}</p>
683-
${this._status.description ? html`<p class="da-list-status-description">${this._status.description}</p>` : nothing}
684-
</div>
685-
</div>`;
679+
return html`<da-toast .toast=${this._toast} @close=${() => { this._toast = null; }}></da-toast>`;
686680
}
687681

688682
renderConfirm() {
@@ -870,7 +864,7 @@ export default class DaList extends LitElement {
870864
currentPath="${this.fullpath}"
871865
role="row"
872866
data-visible="${this._selectedItems?.length > 0}"></da-actionbar>
873-
${this._status ? this.renderStatus() : nothing}
867+
${this._toast ? this.renderStatus() : nothing}
874868
${this._confirm ? this.renderConfirm() : nothing}
875869
${this._dropConflicts?.length ? this.renderDropConfirm() : nothing}
876870
${!this._confirm && this._itemErrors.length ? this.renderErrors() : nothing}

blocks/browse/da-sites/da-sites.css

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -411,45 +411,3 @@ form button:hover {
411411
text-align: center;
412412
}
413413

414-
/* Handle Share */
415-
416-
.da-list-status {
417-
position: fixed;
418-
inset: 0;
419-
background: rgb(255 255 255 / 60%);
420-
display: flex;
421-
justify-content: center;
422-
align-items: center;
423-
z-index: 500;
424-
}
425-
426-
.da-list-status-toast {
427-
width: 280px;
428-
background: var(--s2-blue-800);
429-
line-height: 48px;
430-
border-radius: 6px;
431-
filter: drop-shadow(rgb(0 0 0 / 15%) 0 1px 4px);
432-
justify-content: space-between;
433-
align-items: center;
434-
box-sizing: border-box;
435-
color: #FFF;
436-
font-size: 14px;
437-
overflow: hidden;
438-
}
439-
440-
.da-list-status-title {
441-
font-weight: 700;
442-
padding: 0 12px 0 40px;
443-
margin: 0;
444-
}
445-
446-
.da-list-status-description {
447-
line-height: 1.6;
448-
padding: 6px 12px;
449-
margin: 0;
450-
background: rgb(255 255 255 / 10%);
451-
}
452-
453-
.da-list-status-type-info .da-list-status-title {
454-
background: var(--s2-blue-800) url('/blocks/browse/img/Smock_InfoOutline_18_N.svg') 12px 50% no-repeat;
455-
}

blocks/browse/da-sites/da-sites.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function getRandom() {
1313
export default class DaSites extends LitElement {
1414
static properties = {
1515
_recents: { state: true },
16-
_status: { state: true },
16+
_toast: { state: true },
1717
_urlError: { state: true },
1818
};
1919

@@ -26,6 +26,7 @@ export default class DaSites extends LitElement {
2626
super.connectedCallback();
2727
this.shadowRoot.adoptedStyleSheets = [sheet];
2828
this.getRecents();
29+
import('../../shared/da-toast/da-toast.js');
2930
}
3031

3132
mapRecentSites(recentSites) {
@@ -60,10 +61,6 @@ export default class DaSites extends LitElement {
6061
}
6162
}
6263

63-
setStatus(text, description, type = 'info') {
64-
this._status = text ? { type, text, description } : null;
65-
}
66-
6764
handleRemove(site) {
6865
// Get the index of the site to remove
6966
const idx = this._recents.findIndex((recent) => recent.name === site.name);
@@ -119,18 +116,7 @@ export default class DaSites extends LitElement {
119116
const data = [new ClipboardItem({ [blob.type]: blob })];
120117
navigator.clipboard.write(data);
121118

122-
this.setStatus('Copied', 'The link was copied to the clipboard.');
123-
setTimeout(() => { this.setStatus(); }, 3000);
124-
}
125-
126-
renderStatus() {
127-
return html`
128-
<div class="da-list-status">
129-
<div class="da-list-status-toast da-list-status-type-${this._status.type}">
130-
<p class="da-list-status-title">${this._status.text}</p>
131-
${this._status.description ? html`<p class="da-list-status-description">${this._status.description}</p>` : nothing}
132-
</div>
133-
</div>`;
119+
this._toast = { text: 'Copied', description: 'The link was copied to the clipboard.' };
134120
}
135121

136122
renderGo() {
@@ -250,7 +236,7 @@ export default class DaSites extends LitElement {
250236
</a>
251237
</div>
252238
</div>
253-
${this._status ? this.renderStatus() : nothing}
239+
<da-toast .toast=${this._toast} @close=${() => { this._toast = null; }}></da-toast>
254240
`;
255241
}
256242
}

0 commit comments

Comments
 (0)