Skip to content

Commit

Permalink
Tweak loading tombstones for collection page compact list view
Browse files Browse the repository at this point in the history
  • Loading branch information
nsharma123 committed Jan 4, 2024
1 parent 8769919 commit ab5a623
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
39 changes: 39 additions & 0 deletions src/app-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,31 @@ export class AppRoot extends LitElement {
</label>
</div>
</fieldset>
<fieldset class="user-profile-controls">
<legend>Set Placeholder Types</legend>
<div class="checkbox-control">
<input
id="enable-loading-placeholder"
type="radio"
@click=${() => this.setPlaceholderType('loading-placeholder')}
name="placeholder-radio"
/>
<label for="enable-loading-placeholder"
>Loading Placeholder</label
>
</div>
<div class="checkbox-control">
<input
id="enable-empty-placeholder"
type="radio"
@click=${() => this.setPlaceholderType('error-placeholder')}
value="empty-placeholder"
name="placeholder-radio"
/>
<label for="enable-empty-placeholder">Empty Placeholder</label>
</div>
</fieldset>
</div>
<button id="toggle-dev-tools-btn" @click=${this.toggleDevTools}>
Toggle Search Controls
Expand Down Expand Up @@ -437,6 +462,20 @@ export class AppRoot extends LitElement {
`;
}

private async setPlaceholderType(type: String) {
switch (type) {
case 'loading-placeholder':
this.collectionBrowser.baseQuery = '';
this.collectionBrowser.suppressPlaceholders = true;
this.collectionBrowser.clearResultsOnEmptyQuery = true;
this.requestUpdate();
await this.collectionBrowser.updateComplete;
break;
default:
break;
}
}

private baseQueryChanged(e: CustomEvent<{ baseQuery?: string }>): void {
this.searchQuery = e.detail.baseQuery;
}
Expand Down
10 changes: 7 additions & 3 deletions src/collection-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ export class CollectionBrowser
}

render() {
this.setPlaceholderType();
// this.setPlaceholderType();
return html`
<div
id="content-container"
Expand Down Expand Up @@ -1095,6 +1095,10 @@ export class CollectionBrowser
this.restoreState();
}

willUpdate() {
this.setPlaceholderType();
}

updated(changed: PropertyValues) {
if (changed.has('placeholderType') && this.placeholderType === null) {
if (!this.leftColIntersectionObserver) {
Expand Down Expand Up @@ -2747,9 +2751,9 @@ export class CollectionBrowser
--collectionBrowserCellMinWidth,
100%
);
--infiniteScrollerCellMinHeight: 34px; /* override infinite scroller component */
--infiniteScrollerCellMinHeight: 45px; /* override infinite scroller component */
--infiniteScrollerCellMaxHeight: 56px;
--infiniteScrollerRowGap: 0px;
--infiniteScrollerRowGap: 10px;
}
infinite-scroller.list-detail {
Expand Down
2 changes: 1 addition & 1 deletion src/tiles/list/tile-list-compact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class TileListCompact extends BaseTileComponent {
align-items: center;
line-height: 20px;
padding-top: 5px;
padding-bottom: 5px;
margin-bottom: -5px;
}
#list-line.mobile {
Expand Down

0 comments on commit ab5a623

Please sign in to comment.