Skip to content

Commit

Permalink
feat: add document search nav
Browse files Browse the repository at this point in the history
  • Loading branch information
pirhoo committed Jul 23, 2024
1 parent 48b93b6 commit fabf2ff
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ declare module 'vue' {
ColumnFilterBadge: typeof import('./src/components/ColumnFilterBadge.vue')['default']
ColumnFilterDropdown: typeof import('./src/components/ColumnFilterDropdown.vue')['default']
ContentTypeBadge: typeof import('./src/components/ContentTypeBadge.vue')['default']
copy: typeof import('./src/components/Document/DocumentLocalSearch/DocumentLocalSearchNav copy.vue')['default']
copy: typeof import('./src/components/Document/DocumentSearchNav/DocumentSearchNav copy.vue')['default']
DismissableAlert: typeof import('./src/components/Dismissable/DismissableAlert.vue')['default']
DismissableToastBody: typeof import('./src/components/Dismissable/DismissableToastBody.vue')['default']
DisplayContentLength: typeof import('./src/components/Display/DisplayContentLength.vue')['default']
Expand Down Expand Up @@ -123,6 +123,8 @@ declare module 'vue' {
DocumentLocalSearchOccurrences: typeof import('./src/components/Document/DocumentLocalSearch/DocumentLocalSearchOccurrences.vue')['default']
DocumentNavbar: typeof import('./src/components/Document/DocumentNavbar.vue')['default']
DocumentNotes: typeof import('./src/components/Document/DocumentNotes.vue')['default']
DocumentSearchNav: typeof import('./src/components/Document/DocumentSearchNav/DocumentSearchNav.vue')['default']
DocumentSearchNavItem: typeof import('./src/components/Document/DocumentSearchNav/DocumentSearchNavItem.vue')['default']
DocumentSlicedName: typeof import('./src/components/DocumentSlicedName.vue')['default']
DocumentTabDetails: typeof import('./src/components/Document/DocumentTab/DocumentTabDetails.vue')['default']
DocumentTabExtractedText: typeof import('./src/components/Document/DocumentTab/DocumentTabExtractedText.vue')['default']
Expand Down
41 changes: 41 additions & 0 deletions src/components/Document/DocumentSearchNav/DocumentSearchNav.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script setup>
import DocumentSearchNavItem from './DocumentSearchNavItem'
defineProps({
disabledPrevious: {
type: Boolean
},
disabledNext: {
type: Boolean
}
})
</script>

<template>
<div class="document-search-nav">
<slot>
<document-search-nav-item
icon="caret-left"
:label="$t('documentSearchNavItem.previous')"
:disabled="disabledPrevious"
@click="$emit('previous')"
/>
<document-search-nav-item
icon="caret-right"
:label="$t('documentSearchNavItem.next')"
:disabled="disabledNext"
@click="$emit('next')"
/>
</slot>
</div>
</template>

<style lang="scss" scoped>
.document-search-nav {
display: inline-flex;
padding: $spacer-xxs;
border-radius: var(--bs-border-radius);
color: var(--bs-light-color-subtle);
background: var(--bs-light-bg-subtle);
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<script setup>
defineProps({
icon: {
type: String,
required: true
},
label: {
type: String,
required: true
},
disabled: {
type: Boolean
}
})
</script>

<template>
<icon-button
class="document-search-nav-item"
variant="outline-tertiary"
:icon-left="icon"
icon-left-hover-weight="bold"
:disabled="disabled"
:label="label"
square
hide-label
/>
</template>

<style lang="scss" scoped>
.document-search-nav-item {
--bs-btn-color: var(--bs-tertiary-text-emphasis);
--bs-btn-border-color: transparent;
--bs-btn-hover-bg: var(--bs-secondary);
--bs-btn-hover-color: var(--bs-white);
--bs-btn-hover-border-color: transparent;
--bs-btn-active-bg: var(--bs-secondary);
--bs-btn-active-color: var(--bs-white);
}
</style>
4 changes: 4 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
"documentLocalSearchOccurrences": {
"label": "{activeIndex} on {occurrences}"
},
"documentSearchNavItem": {
"previous": "Previous",
"next": "Next"
},
"documentThumbnail": {
"noPreview": "No preview available"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import DocumentSearchNav from '@/components/Document/DocumentSearchNav/DocumentSearchNav'

export default {
title: 'Components/Document/DocumentSearchNav/DocumentSearchNav',
component: DocumentSearchNav,
tags: ['autodocs'],
args: {
disablePrevious: false,
disableNext: false
}
}

export const Default = {}

0 comments on commit fabf2ff

Please sign in to comment.