add scroll to char for LibraryList
This commit is contained in:
@@ -8,14 +8,14 @@ a:hover {
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
border: 0;
|
||||
border: $line;
|
||||
padding: 0;
|
||||
margin-left: -#{$header-spacer-sm};
|
||||
margin-top: 10px;
|
||||
|
||||
.dropdown-item {
|
||||
font-size: $font-size-sm;
|
||||
padding: .25rem $header-spacer-sm;
|
||||
padding: .25rem 1.25rem .25rem .5rem !important;
|
||||
}
|
||||
|
||||
@include media-breakpoint-up($layout-bp) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<b-dropdown
|
||||
:text="buttonText"
|
||||
variant="outline-dark" class="tags-dropdown d-tb-block"
|
||||
dropright
|
||||
>
|
||||
<b-dropdown-item-button
|
||||
v-for="tag in availableOptions" :key="tag"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"card-map": "Aléatoire",
|
||||
"card-list": "Alphabétique"
|
||||
},
|
||||
"go-to-char": "Aller à la lettre",
|
||||
"shuffle": "Mélanger"
|
||||
},
|
||||
"filters": {
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
<div class="library-list">
|
||||
<div class="library-list-container" @click="onContainerClick">
|
||||
<div v-for="([char, nodes]) in filteredNodes" :key="char">
|
||||
<h3>{{ char }}</h3>
|
||||
<h3 :id="char">
|
||||
{{ char }}
|
||||
</h3>
|
||||
|
||||
<div class="library-list-nodes-group">
|
||||
<node-view
|
||||
|
||||
@@ -19,6 +19,21 @@
|
||||
>
|
||||
{{ $t('options.display.shuffle') }}
|
||||
</b-button>
|
||||
|
||||
<b-dropdown
|
||||
v-if="activeMode === 'list'"
|
||||
:text="$t('options.display.go-to-char')"
|
||||
variant="outline-dark" class="char-select d-block mt-2"
|
||||
dropright
|
||||
>
|
||||
<b-dropdown-item-button
|
||||
class="text-center"
|
||||
v-for="char in availableCharacters" :key="char"
|
||||
@click="scrollToChar(char)"
|
||||
>
|
||||
{{ char }}
|
||||
</b-dropdown-item-button>
|
||||
</b-dropdown>
|
||||
</b-form-group>
|
||||
|
||||
<!-- LIST + MAP ONLY -->
|
||||
@@ -116,6 +131,7 @@ export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'nodesDepartsOptions',
|
||||
'orderedTextsDepart',
|
||||
'tagsOptions',
|
||||
'nodebook',
|
||||
'mode',
|
||||
@@ -125,6 +141,11 @@ export default {
|
||||
'strangeness'
|
||||
]),
|
||||
|
||||
availableCharacters () {
|
||||
if (!this.orderedTextsDepart) return []
|
||||
return this.orderedTextsDepart.map(group => group[0])
|
||||
},
|
||||
|
||||
activeNodeId: {
|
||||
get () { return this.nodeDepartId },
|
||||
set (value) {
|
||||
@@ -173,6 +194,15 @@ export default {
|
||||
tagsIsActive () {
|
||||
this.$store.commit('UPDATE_TAGS', [])
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
scrollToChar (char) {
|
||||
const h = document.querySelector(`h3[id=${char}]`)
|
||||
if (h) {
|
||||
h.scrollIntoView({ behavior: 'smooth' })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -232,6 +262,16 @@ export default {
|
||||
color: $black;
|
||||
}
|
||||
}
|
||||
|
||||
.char-select {
|
||||
line-height: 1;
|
||||
|
||||
.dropdown-menu {
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
min-width: 3rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filters-group {
|
||||
|
||||
Reference in New Issue
Block a user