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

FEATURE: Improve service provider listing #528

Merged
Expand Up @@ -68,6 +68,7 @@ prototype(Neos.NeosIo.ServiceOfferings:Component.ProviderList) < prototype(Neos.
}

renderer = afx`
<h2 class="headline">{I18n.id('serviceListing.headline').value('serviceListing.headline').package('Neos.NeosIo.ServiceOfferings').source('Main')}</h2>
<div class="service-providers__list" id="service-providers-listing"
data-provider-data={Json.stringify(props.serviceProvidersData)}
data-translation-data={Json.stringify(props.translationData)}
Expand Down
@@ -1,6 +1,10 @@
prototype(Neos.NeosIo.ServiceOfferings:Document.ServiceProviderCollection) < prototype(Neos.NeosIo:DefaultPage) {
body {
content {
keyVisual = Neos.NeosIo:KeyVisual {
keyVisualSize = 'small'
}

main = Neos.Fusion:Join {
top = Neos.Neos:PrimaryContent {
nodePath = 'main'
Expand Down
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">
Sebobo marked this conversation as resolved.
Show resolved Hide resolved
<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
Expand Up @@ -137,29 +137,38 @@

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

@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;
}

&.row {
width: auto;

.form__item {
padding-right: 16px;
}
}
}

select {
width: 100%;
}
}

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

}

.service-providers__grid-gridview {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 2rem;
padding-top: 16px;

@media(max-width: 1023px) {
grid-template-columns: repeat(2, 1fr);
Expand Down
Expand Up @@ -2,6 +2,9 @@
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Neos.NeosIo.ServiceOfferings" source-language="en" target-language="de" datatype="plaintext">
<body>
<trans-unit id="serviceListing.headline" xml:space="preserve">
<target>Finde Deinen passenden Neos-Partner</target>
</trans-unit>
<trans-unit id="serviceListing.name" xml:space="preserve">
<target>Name</target>
</trans-unit>
Expand Down
Expand Up @@ -2,6 +2,9 @@
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Neos.NeosIo.ServiceOfferings" source-language="en" datatype="plaintext">
<body>
<trans-unit id="serviceListing.headline" xml:space="preserve">
<target>Find the right Neos partner for you</target>
</trans-unit>
<trans-unit id="serviceListing.name" xml:space="preserve">
<source>Name</source>
</trans-unit>
Expand Down
Expand Up @@ -5,6 +5,7 @@ prototype(Neos.NeosIo:KeyVisual) < prototype(Neos.Fusion:Component) {
// API
keyVisualImage = null
keyVisualImageSmall = null
keyVisualSize = 'default'
isKeyVisualContentsInverted = false
content = null

Expand Down
Expand Up @@ -10,7 +10,7 @@ prototype(Neos.NeosIo:KeyVisual.AbstractRenderer) < prototype(Neos.Fusion:Compon
highQualityImageUri = ''
imageSrcSet = ''

classes = "keyVisual print-hidden"
classes = ${"keyVisual keyVisual--" + props.keyVisualSize + " print-hidden"}

divClasses = ${"keyVisual__contents u-alignCenter " + (this.isKeyVisualContentsInverted ? "u-invertText" : "")}
previewImageStyleAttribute = ${"background-image: url('" + this.previewImageUri + "')"}
Expand Down
Expand Up @@ -13,4 +13,6 @@ prototype(Neos.NeosIo:KeyVisual.StaticPlaceholderImageRenderer) < prototype(Neos
highRes = ${staticUrlPrefix + "-1280w.jpg 1280w, "}
mediumRes = ${staticUrlPrefix + "-658w.jpg 658w"}
}

keyVisualSize = ${props.keyVisualSize}
}
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%);
}
}
}
Expand Up @@ -6,6 +6,12 @@
overflow: hidden;
background: #000;

&--small {
.keyVisual__contents {
height: MIN(250px, 25vw);
}
}

&:before {
content: '';
position: absolute;
Expand Down
Expand Up @@ -53,3 +53,7 @@
.u-clearfix {
@include u-cf();
}

.row {
display: flex;
}