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 162444 asset language #132

Open
wants to merge 5 commits into
base: stage
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion edsdme/blocks/search/SearchCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,16 @@ export default class Search extends PartnerCards {
}

generateFilters() {
function checkKey(key) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SonjaPopovic - regarding the below requirement from the ticket, I think we'll have to update that in the backend anyhow, so I don't think we will need this mapping from asset-language to language. I can simply change the key in the backend. Or do you need this for something else?

pages should not show up in the filtered view, even if they match the selected language.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also update in on backend, i prepared pr for filtering only assets https://git.corp.adobe.com/wcms/dx-partners-runtime/pull/104 , but didn't want to change key in the backend since was not sure will that have side effects since search api is used on other pages. On logos pages only assets are fetched anyway, and on gnav search there is no language filter so i guess it is ok. I will prepare pr as part of this ticket. Thanks

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it shouldn't have any side effects, I think the fewer mappings we keep the better

if (key === 'asset-language') {
return 'language';
}
return key;
}

const filters = Object.fromEntries(
Object.entries(this.selectedFilters).map(([key, arr]) => [
key,
checkKey(key),
arr.map((item) => item.key),
]),
);
Expand Down
15 changes: 14 additions & 1 deletion edsdme/components/PartnerCards.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getLibs } from '../scripts/utils.js';
import { partnerCardsStyles, partnerCardsLoadMoreStyles, partnerCardsPaginationStyles } from './PartnerCardsStyles.js';
import { partnerCardsLoadMoreStyles, partnerCardsPaginationStyles, partnerCardsStyles } from './PartnerCardsStyles.js';
import './SinglePartnerCard.js';

const miloLibs = getLibs();
Expand Down Expand Up @@ -58,6 +58,7 @@ export default class PartnerCards extends LitElement {
...this.blockData,
title: '',
filters: [],
filtersInfos: [],
sort: {
default: {},
items: [],
Expand Down Expand Up @@ -132,6 +133,10 @@ export default class PartnerCards extends LitElement {
const backgroundColor = backgroundColorEl.innerText.trim();
if (backgroundColor) this.blockData.backgroundColor = backgroundColor;
},
'filter-info': (cols) => {
const filterName = cols[0].innerText.trim();
this.blockData.filtersInfos[filterName] = cols[1].innerText.trim();
},
};

const rows = Array.from(this.blockData.tableData);
Expand Down Expand Up @@ -334,6 +339,10 @@ export default class PartnerCards extends LitElement {
<span class="filter-selected-tags-total-num">${tagsCount}</span>
</button>
<ul class="filter-list">
${this.blockData.filtersInfos[filter.key] ? html`<div class="filter-info">
<div class="info-icon" style="background-image: url('/edsdme/img/icons/info.svg')"></div>
<span class="filter-info-text"> ${this.blockData.filtersInfos[filter.key]}</span> </div>`
: ''}
<sp-theme theme="spectrum" color="light" scale="medium">
${this.getTagsByFilter(filter)}
</sp-theme>
Expand Down Expand Up @@ -378,6 +387,10 @@ export default class PartnerCards extends LitElement {
</div>
<span class="filter-header-chevron-icon"></span>
</button>
${this.blockData.filtersInfos[filter.key] ? html`<div class="filter-info">
<div class="info-icon" style="background-image: url('/edsdme/img/icons/info.svg')"></div>
<span class="filter-info-text"> ${this.blockData.filtersInfos[filter.key]}</span> </div>`
: ''}
<ul class="filter-tags-mobile">
<sp-theme theme="spectrum" color="light" scale="medium">
${this.getTagsByFilter(filter)}
Expand Down
38 changes: 35 additions & 3 deletions edsdme/components/PartnerCardsStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const partnerCardsStyles = css`
width: 100%;
margin: 0 auto;
display: grid;
grid-template-columns: 204px auto;
grid-template-columns: 269px auto;
gap: 32px;
}

Expand All @@ -39,8 +39,8 @@ export const partnerCardsStyles = css`
.partner-cards-sidebar {
display: flex;
flex-direction: column;
width: 204px;
max-width: 204px;
width: 269px;
max-width: 269px;
margin-right: 32px;
padding: 8px 16px 16px;
border-radius: 4px;
Expand Down Expand Up @@ -840,6 +840,38 @@ export const partnerCardsStyles = css`
.all-filters-wrapper-mobile .all-filters-footer-clear-btn-mobile:focus {
border-color: ${blueColor};
}

.filter-info {
display: flex;
margin: 0 15px 5px 0;
}

.info-icon {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SonjaPopovic - I guess there's no spectrum web component that we can use out of the box for this?

height: 18px;
width: 18px;
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: cover;
margin: 5px 10px 0 0;
flex-shrink: 0;
}
.filter-info-text {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SonjaPopovic the filter info text font looks a little wrong to me:

Can we just set a font size and line height? We could make use of the spectrum CSS variables provided:

.filter-info-text {
  font-size: var(--type-body-xs-size);
  line-height: 17px;
}
Screenshot 2024-11-18 at 14 46 51

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have different font, how are you testing this?
Screenshot 2024-11-18 at 15 09 46

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's somehow an issue for me when testing branches with the adobe clean font loading. Nevertheless, I would avoid redefining the font family in the info text and simply inherit it. The default should be:

font-family: var(--body-font-family);

font-family: inherit;
font-size: var(--type-body-xs-size);
line-height: 17px;
}
.filter-wrapper-mobile .filter-info {
display: none;
}
.filter-wrapper-mobile.expanded .filter-info {
display: flex;
width: 100%;
margin: 0;
padding: 10px 20px;
}
.filter-wrapper-mobile.expanded .info-icon {
margin-top: 0;
}
`;

export const partnerCardsLoadMoreStyles = css`
Expand Down
11 changes: 11 additions & 0 deletions edsdme/img/icons/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading