Fix: enable nested scrolling in filter accordion panel
This commit is contained in:
committed by
Aditya Chandel
parent
116f0c950e
commit
ec7846abf6
+54
-53
@@ -1,55 +1,56 @@
|
|||||||
@if (showFilter) {
|
<div class="h-[calc(100vh-6.1rem)] rounded-xl bg-[var(--card-background)] flex flex-col">
|
||||||
<div class="h-[calc(100vh-6.1rem)] rounded-xl bg-[var(--card-background)] flex flex-col">
|
|
||||||
|
|
||||||
<div class="flex items-center justify-between px-4 py-4">
|
|
||||||
<span class="text font-semibold">Filter Mode</span>
|
|
||||||
<p-selectButton
|
|
||||||
[options]="filterModeOptions"
|
|
||||||
[(ngModel)]="selectedFilterMode"
|
|
||||||
optionLabel="label"
|
|
||||||
optionValue="value"
|
|
||||||
class="text-sm"
|
|
||||||
allowEmpty="false"
|
|
||||||
styleClass="h-8"></p-selectButton>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex-1 overflow-y-auto pb-4">
|
|
||||||
<p-accordion [value]="expandedPanels">
|
|
||||||
@for (filterType of filterTypes; track filterType; let i = $index) {
|
|
||||||
<p-accordion-panel [value]="i">
|
|
||||||
<p-accordion-header>
|
|
||||||
<span class="inline-flex items-center gap-1">
|
|
||||||
{{ filterLabels[filterType] || (filterType | titlecase) }}
|
|
||||||
@if (activeFilters[filterType]?.length) {
|
|
||||||
<span class="text-sm text-[var(--primary-color)]">
|
|
||||||
({{ activeFilters[filterType].length }})
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</p-accordion-header>
|
|
||||||
|
|
||||||
<p-accordion-content class="h-[27.5rem]">
|
|
||||||
@if (filterStreams[filterType] | async; as filters) {
|
|
||||||
<div>
|
|
||||||
@for (filter of filters; track filter) {
|
|
||||||
<div
|
|
||||||
class="cursor-pointer transition-colors duration-200 ease-in-out pb-1 flex items-center gap-2"
|
|
||||||
[ngClass]="{
|
|
||||||
'text-[var(--primary-color)]':
|
|
||||||
activeFilters[filterType]?.includes(filter.value?.id || filter.value)
|
|
||||||
}"
|
|
||||||
(click)="handleFilterClick(filterType, filter.value?.id || filter.value)">
|
|
||||||
<p-badge [value]="filter.bookCount"></p-badge>
|
|
||||||
{{ filter.value.name || filter.value }}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</p-accordion-content>
|
|
||||||
</p-accordion-panel>
|
|
||||||
}
|
|
||||||
</p-accordion>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="flex items-center justify-between px-4 py-4">
|
||||||
|
<span class="text font-semibold">Filter Mode</span>
|
||||||
|
<p-selectButton
|
||||||
|
[options]="filterModeOptions"
|
||||||
|
[(ngModel)]="selectedFilterMode"
|
||||||
|
optionLabel="label"
|
||||||
|
optionValue="value"
|
||||||
|
class="text-sm"
|
||||||
|
allowEmpty="false"
|
||||||
|
styleClass="h-8"></p-selectButton>
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
|
<!-- Outer scroll -->
|
||||||
|
<div class="flex-1 overflow-y-auto pb-4 pr-1" style="overscroll-behavior: contain;">
|
||||||
|
<p-accordion [value]="expandedPanels">
|
||||||
|
@for (filterType of filterTypes; track filterType; let i = $index) {
|
||||||
|
<p-accordion-panel [value]="i">
|
||||||
|
<p-accordion-header>
|
||||||
|
<span class="inline-flex items-center gap-1">
|
||||||
|
{{ filterLabels[filterType] || (filterType | titlecase) }}
|
||||||
|
@if (activeFilters[filterType]?.length) {
|
||||||
|
<span class="text-sm text-[var(--primary-color)]">
|
||||||
|
({{ activeFilters[filterType].length }})
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
</p-accordion-header>
|
||||||
|
|
||||||
|
<p-accordion-content>
|
||||||
|
@if (filterStreams[filterType] | async; as filters) {
|
||||||
|
<!-- Inner scrollable content with nested scroll behavior -->
|
||||||
|
<div
|
||||||
|
class="max-h-[27.5rem] overflow-y-auto overscroll-contain pr-1"
|
||||||
|
style="overscroll-behavior: contain;">
|
||||||
|
@for (filter of filters; track filter) {
|
||||||
|
<div
|
||||||
|
class="cursor-pointer transition-colors duration-200 ease-in-out pb-1 flex items-center gap-2"
|
||||||
|
[ngClass]="{
|
||||||
|
'text-[var(--primary-color)]':
|
||||||
|
activeFilters[filterType]?.includes(filter.value?.id || filter.value)
|
||||||
|
}"
|
||||||
|
(click)="handleFilterClick(filterType, filter.value?.id || filter.value)">
|
||||||
|
<p-badge [value]="filter.bookCount"></p-badge>
|
||||||
|
{{ filter.value.name || filter.value }}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</p-accordion-content>
|
||||||
|
</p-accordion-panel>
|
||||||
|
}
|
||||||
|
</p-accordion>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user