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

LWS-138: styling tweaks to filters #1032

Merged
merged 3 commits into from
May 21, 2024
Merged
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
41 changes: 20 additions & 21 deletions lxl-web/src/routes/(app)/[[lang=lang]]/(find)/FacetGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { page } from '$app/stores';
import { type FacetGroup } from './search';
import BiChevronRight from '~icons/bi/chevron-right';
import BiChevronDown from '~icons/bi/chevron-down';
import FacetRange from './FacetRange.svelte';

export let group: FacetGroup;
Expand Down Expand Up @@ -41,15 +40,9 @@
data-testid="facet-toggle"
>
<span class="flex items-center gap-2">
<span>
{#if searchPhrase}
<!-- Currently groups can't be minimized while searching -->
<BiChevronDown class="text-icon" />
{:else if expanded}
<BiChevronDown class="text-icon" />
{:else}
<BiChevronRight class="text-icon" />
{/if}
<!-- Currently groups can't be minimized while searching -->
<span class:rotate-90={searchPhrase || expanded} class="transition-transform">
<BiChevronRight class="text-icon" />
</span>
<span>
{group.label}
Expand All @@ -66,10 +59,13 @@
<!-- facet range inputs; hide in filter search results -->
<FacetRange search={group.search} />
{/if}
<ol class="max-h-437px mt-2 overflow-y-auto" data-testid="facet-list">
<ol class="mt-2 max-h-[437px] overflow-y-auto overflow-x-clip" data-testid="facet-list">
{#each shownFacets as facet (facet.view['@id'])}
<li class="pl-6">
<a class="flex items-center justify-between no-underline" href={facet.view['@id']}>
<li class="mb-[0.3rem]">
<a
class="facet-link flex items-end justify-between gap-2 pl-6 no-underline"
href={facet.view['@id']}
>
<span class="flex items-baseline">
{#if 'selected' in facet}
<!-- howto A11y?! -->
Expand All @@ -80,8 +76,10 @@
{/if}
<span>{facet.str}</span>
</span>
<span class="text-sm text-secondary md:text-xs lg:text-sm"
>({facet.totalItems.toLocaleString(locale)})</span
<span
class="facet-total mb-px rounded-sm bg-pill/4 px-1 text-sm text-secondary md:text-xs lg:text-sm"
aria-label="{facet.totalItems} {$page.data.t('search.hits')}"
>{facet.totalItems.toLocaleString(locale)}</span
>
</a>
</li>
Expand All @@ -93,10 +91,8 @@
on:click={() =>
canShowMoreFacets ? (facetsShown = numfacets) : (facetsShown = defaultFacetsShown)}
>
{canShowMoreFacets
? $page.data.t('search.showMore')
: $page.data.t('search.showFewer')}</button
>
{canShowMoreFacets ? $page.data.t('search.showMore') : $page.data.t('search.showFewer')}
</button>
{/if}
{#if searchPhrase && filteredFacets.length === 0}
<span role="status" aria-atomic="true">{$page.data.t('search.noResults')}</span>
Expand All @@ -105,7 +101,10 @@
</li>

<style lang="postcss">
.max-h-437px {
max-height: 437px;
.facet-link:hover,
.facet-link:focus {
& .facet-total {
@apply bg-pill/8;
}
}
</style>