Skip to content

Commit

Permalink
Fix/issue 1318 scrolltotop (#1322)
Browse files Browse the repository at this point in the history
* fix type build error

* clean Pagination style

fix #1317 add convenient z-index

* go to first element of the page

fix #1318
  • Loading branch information
danieleguido authored Oct 7, 2024
1 parent 069d2ec commit 1d4cc49
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
16 changes: 1 addition & 15 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -482,21 +482,7 @@ input[type='range']:active::-ms-thumb {
font-weight: bold;
}
}
.fixed-pagination-footer {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
max-width: 100%;
.pagination {
li.page-item > a,
li.page-item > .page-link {
border-color: $clr-secondary;
padding: 0.15em 0.6em;
}
}
}
.dark-mode,
.navbar-dark {
.fixed-pagination-footer {
Expand Down
8 changes: 5 additions & 3 deletions src/components/CollapsibleSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
<ol>
<li v-for="(paragraph, idx) in paragraphs" :key="paragraph.id">
<CollapsibleParagraph
:modelValue="currentOpenTaskId === paragraph.id"
:modelValue="currentOpenParagraphId === paragraph.id"
:paragraph="paragraph"
:taskNum="idx + 1"
@update:modelValue="(value: boolean) => (currentOpenTaskId = value ? task.id : null)"
@update:modelValue="
(value: boolean) => (currentOpenParagraphId = value ? paragraph.id : null)
"
@heightChanged="(e: string) => updateHeight(paragraph.id, e)"
>
</CollapsibleParagraph>
Expand Down Expand Up @@ -64,7 +66,7 @@ const props = defineProps({
})
const isOpen = ref(!props.isCollapsed)
const currentOpenTaskId = ref<string | null>(props.initialOpenedParagraphId)
const currentOpenParagraphId = ref<string | null>(props.initialOpenedParagraphId)
watch(
() => props.isCollapsed,
Expand Down
17 changes: 15 additions & 2 deletions src/components/modules/Pagination.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="{ 'dark-mode': props.darkMode }">
<div class="Pagination" :class="{ 'dark-mode': props.darkMode }">
<ul
class="pagination b-pagination m-0"
:class="{
Expand Down Expand Up @@ -209,8 +209,21 @@ const goToLast = () => {
}
</script>

<style scoped lang="less">
<style>
.dark-mode {
background: transparent;
}
.fixed-pagination-footer .Pagination {
border-radius: var(--impresso-border-radius-xs);
box-shadow: var(--bs-box-shadow-md);
}
.Pagination .pagination li.page-item > a,
.Pagination .pagination li.page-item > .page-link {
padding: var(--spacing-1) var(--spacing-2);
background-color: var(--clr-white);
}
.Pagination .pagination li.page-item.active > .page-link {
background-color: var(--impresso-color-black);
}
</style>
3 changes: 3 additions & 0 deletions src/pages/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@

<div class="p-1">
<b-container fluid>
<div ref="searchResultsFirstElement" />
<b-row v-if="displayStyle === 'list'" data-testid="search-results-list-items">
<b-col
cols="12"
Expand Down Expand Up @@ -662,6 +663,8 @@ export default {
this.searchResults = data.map(d => new Article(d))
this.isLoadingResults = false
this.$refs.searchResultsFirstElement?.scrollIntoView({ behavior: 'smooth' })
let facets = searchResponseToFacetsExtractor(FACET_TYPES_S)({ info })
// get remaining facets and enriched filters.
Expand Down
11 changes: 11 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
--impresso-font-size-4: 1.5rem;

--impresso-transition-ease: cubic-bezier(0.4, 0, 0.2, 1);

--z-index-pagination: 1001;
}

body {
Expand Down Expand Up @@ -475,3 +477,12 @@ svg path.domain {
.z-index-1 {
z-index: 1;
}
/* fixed pagination, see Pagination component */
.fixed-pagination-footer {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
max-width: 100%;
z-index: var(--z-index-pagination);
}

0 comments on commit 1d4cc49

Please sign in to comment.