Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mwpw 154152 file types #125

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions edsdme/blocks/search/SearchCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default class Search extends PartnerCards {
}

getPageNumArray() {
const countAll = this.selectedTypeCount();
const countAll = this.getTotalResults();
const numberOfPages = Math.ceil(countAll / this.cardsPerPage);
this.totalPages = numberOfPages;
// eslint-disable-next-line consistent-return
Expand All @@ -247,7 +247,7 @@ export default class Search extends PartnerCards {

get cardsCounter() {
const startIndex = (this.paginationCounter - 1) * this.cardsPerPage;
const countAll = this.selectedTypeCount();
const countAll = this.getTotalResults();
const endIndex = startIndex + this.cardsPerPage;
const lastCardIndex = countAll < endIndex
? countAll : endIndex;
Expand All @@ -256,7 +256,7 @@ export default class Search extends PartnerCards {
return `${startIndex + 1} - ${lastCardIndex}`;
}

selectedTypeCount() {
getTotalResults() {
let countAll;
switch (this.contentType) {
case 'page':
Expand Down Expand Up @@ -333,7 +333,7 @@ export default class Search extends PartnerCards {
${!this.mobileView
? html`
<div class="sidebar-header">
<h3 class="sidebar-title">${this.blockData.localizedText['{{filter}}']}</h3>
<h3 class="sidebar-title">${this.blockData.localizedText['{{filters}}']}</h3>
<button class="sidebar-clear-btn" @click="${this.handleResetActions}" aria-label="${this.blockData.localizedText['{{clear-all}}']}">${this.blockData.localizedText['{{clear-all}}']}</button>
</div>
<div class="sidebar-chosen-filters-wrapper">
Expand Down Expand Up @@ -405,7 +405,7 @@ export default class Search extends PartnerCards {
? html`
<div class="pagination-wrapper ${this.blockData?.pagination === 'load-more' ? 'pagination-wrapper-load-more' : 'pagination-wrapper-default'}">
${this.pagination}
<span class="pagination-total-results">${this.cardsCounter} ${this.blockData.localizedText['{{of}}']} ${this.selectedTypeCount()} ${this.blockData.localizedText['{{results}}']}</span>
<span class="pagination-total-results">${this.cardsCounter} <span>${this.blockData.localizedText['{{of}}']} ${this.getTotalResults()} ${this.blockData.localizedText['{{results}}']}</span></span>
</div>
`
: ''
Expand All @@ -425,7 +425,7 @@ export default class Search extends PartnerCards {
${this.filtersMobile}
</div>
<div class="all-filters-footer-mobile">
<span class="all-filters-footer-results-mobile">${this.cards?.length} ${this.blockData.localizedText['{{results}}']}</span>
<span class="all-filters-footer-results-mobile">${this.getTotalResults()} ${this.blockData.localizedText['{{results}}']}</span>
<div class="all-filters-footer-buttons-mobile">
<button class="all-filters-footer-clear-btn-mobile" @click="${this.handleResetActions}" aria-label="${this.blockData.localizedText['{{clear-all}}']}">${this.blockData.localizedText['{{clear-all}}']}</button>
<sp-theme theme="spectrum" color="light" scale="medium">
Expand Down
6 changes: 5 additions & 1 deletion edsdme/components/PartnerCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ export default class PartnerCards extends LitElement {
)}`;
}

getTotalResults() {
return this.cards?.length;
}

get filtersMobile() {
if (!this.blockData.filters.length) return;

Expand Down Expand Up @@ -381,7 +385,7 @@ export default class PartnerCards extends LitElement {
</ul>
<div class="filter-footer-mobile-wrapper">
<div class="filter-footer-mobile">
<span class="filter-footer-results-mobile">${this.cards?.length} ${this.blockData.localizedText['{{results}}']}</span>
<span class="filter-footer-results-mobile">${this.getTotalResults()} ${this.blockData.localizedText['{{results}}']}</span>
<div class="filter-footer-buttons-mobile">
<button class="filter-footer-clear-btn-mobile" @click="${() => this.handleResetTags(filter.key)}" aria-label="${this.blockData.localizedText['{{clear-all}}']}">${this.blockData.localizedText['{{clear-all}}']}</button>
<sp-theme theme="spectrum" color="light" scale="medium">
Expand Down
4 changes: 4 additions & 0 deletions edsdme/components/PartnerCardsStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ export const partnerCardsStyles = css`
font-weight: 700;
text-transform: lowercase;
}

.pagination-wrapper .pagination-total-results span {
font-weight: 500;
}

@media screen and (max-width: 1200px) {
.pagination-wrapper .pagination-total-results {
Expand Down
2 changes: 1 addition & 1 deletion edsdme/components/SearchCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SearchCard extends LitElement {
<div class="card-icons">
<sp-theme theme="spectrum" color="light" scale="medium">
<sp-action-button ?disabled=${this.isDownloadDisabled(this.data.contentArea?.type)} href="${this.setDownloadParam(this.data.contentArea?.url)}" download="${this.data.contentArea?.title}" aria-label="${this.localizedText['{{download}}']}"><sp-icon-download /></sp-action-button>
${this.data.contentArea?.type === 'pdf'
${this.data.contentArea?.type !== 'zip'
? html`<sp-action-button href="${this.data.contentArea?.url}" target="_blank" aria-label="${this.localizedText['{{open-in}}']}"><sp-icon-open-in /></sp-action-button>`
: html`<sp-action-button disabled selected aria-label="${this.localizedText['{{open-in-disabled}}']}"><sp-icon-open-in /></sp-action-button>`
}
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading