Skip to content

Commit

Permalink
neos#504 improve service provider listing filters by using full width
Browse files Browse the repository at this point in the history
* replace ninja icon for search results with an search results text
  • Loading branch information
schneider.n committed Sep 8, 2023
1 parent 02978df commit bcfba54
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ export default function ProviderListing() {
}
};

const sortByFirstNumberInString = (a: string, b: string) => {
const regex = /\d+/; // Regular expression to extract the first number in the string
const numberA = parseInt(a.match(regex)[0]);
const numberB = parseInt(b.match(regex)[0]);

// Sort descending by the first number in the string
return numberB - numberA;
}

sizes.sort(sortByFirstNumberInString);

const switchToGrid = (state: boolean) => { setGrid(state)};

useEffect(() => {
Expand Down Expand Up @@ -88,8 +99,8 @@ export default function ProviderListing() {
<div>
<div>
<header class="service-providers__grid-tableview">
<div class="service-providers__grid-row remove-border form form--inline">
<div class="service-providers__grid-cell">
<div class="service-providers__grid-row remove-border form">
<div class="service-providers__grid-cell row">
<div class="form__item">
<i class={'grid-switcher fas fa-th-large' + (grid ? ' selected' : '')}
onclick={e => switchToGrid(true)}
Expand All @@ -105,12 +116,9 @@ export default function ProviderListing() {
onclick={() => sortBy('title')}
title={translationData['name']}></i>
</div>
<div className="form__item" title={`${providers.length} ${translationData['providers']}`}>
{providers.length} <i class="fas fa-user-ninja"></i>
</div>
</div>
<div class="service-providers__grid-cell">
<div class="form__item">
<div class="form__item form__item--with-icon">
<input type="text"
id="service-provider-search"
placeholder={translationData['search']}
Expand Down Expand Up @@ -146,6 +154,9 @@ export default function ProviderListing() {
</select>
</div>
</div>
<div className="form__item">
<strong>{providers.length}</strong> {translationData['providers']}
</div>
</header>
<section className={grid ? 'service-providers__grid-gridview' : 'service-providers__grid-tableview'}>
{providers.length ? providers.map(provider => (grid ? <ProviderListGridItem provider={provider}/> : <ProviderListTableRow provider={provider}/>)) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,28 @@

.service-providers__grid-tableview {
.service-providers__grid-row {
display: grid;
grid-template-columns: repeat(4, 1fr);
border-top: 1pt solid #eee;
padding: 1rem;

@media(max-width: 1023px) {
grid-template-columns: none;
grid-template-rows: 1fr;
grid-gap: 1rem;
}

&.form {
padding: 0;
grid-template-columns: repeat(5, auto);
display: flex;
justify-content: space-between;

.service-providers__grid-cell {
padding-top: 0;
width: 100%;
&:nth-child(n+2) {
padding-left: 16px;
}
}

select {
width: 100%;
}
}

.form__item {
display: inline-block;
white-space: nowrap;
}
}
Expand All @@ -178,7 +177,6 @@
margin-left: 0.5rem;
}
}

}

.service-providers__grid-gridview {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,20 @@
margin-#{$end}: .3em;
}
}

.form__item {
&--with-icon {
position: relative;

input {
width: 100%;
}

label {
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@
.u-clearfix {
@include u-cf();
}

.row {
display: flex;
}

0 comments on commit bcfba54

Please sign in to comment.