Add mode toggle [Explore|Quote] left of search form in header
All checks were successful
Build Docker Image / build (push) Successful in 3m43s

This commit is contained in:
Ruslan Bakiev
2026-01-22 20:57:37 +07:00
parent c0f38a25cd
commit ae9985023c
2 changed files with 26 additions and 1 deletions

View File

@@ -9,6 +9,26 @@
</NuxtLink> </NuxtLink>
</div> </div>
<!-- Mode toggle (between Logo and Search) -->
<div v-if="showModeToggle" class="flex items-center flex-shrink-0 py-2.5">
<div class="join">
<button
class="btn btn-sm join-item"
:class="catalogMode === 'explore' ? 'btn-primary' : 'btn-ghost'"
@click="$emit('set-catalog-mode', 'explore')"
>
{{ $t('catalog.modes.explore') }}
</button>
<button
class="btn btn-sm join-item"
:class="catalogMode === 'quote' ? 'btn-primary' : 'btn-ghost'"
@click="$emit('set-catalog-mode', 'quote')"
>
{{ $t('catalog.modes.quote') }}
</button>
</div>
</div>
<!-- Center: Search input (transforms based on mode) --> <!-- Center: Search input (transforms based on mode) -->
<div class="flex-1 flex flex-col items-center max-w-2xl mx-auto gap-2"> <div class="flex-1 flex flex-col items-center max-w-2xl mx-auto gap-2">
<!-- Quote mode: Segmented input like Airbnb --> <!-- Quote mode: Segmented input like Airbnb -->
@@ -259,6 +279,7 @@ const props = defineProps<{
hubLabel?: string hubLabel?: string
quantity?: string quantity?: string
canSearch?: boolean canSearch?: boolean
showModeToggle?: boolean
}>() }>()
defineEmits([ defineEmits([
@@ -273,7 +294,8 @@ defineEmits([
'remove-token', 'remove-token',
'update:search-query', 'update:search-query',
// Quote mode // Quote mode
'search' 'search',
'set-catalog-mode'
]) ])
const localePath = useLocalePath() const localePath = useLocalePath()

View File

@@ -21,7 +21,9 @@
:hub-label="hubLabel" :hub-label="hubLabel"
:quantity="quantity" :quantity="quantity"
:can-search="canSearch" :can-search="canSearch"
:show-mode-toggle="isCatalogSection"
@toggle-theme="toggleTheme" @toggle-theme="toggleTheme"
@set-catalog-mode="setCatalogMode"
@sign-out="onClickSignOut" @sign-out="onClickSignOut"
@sign-in="signIn()" @sign-in="signIn()"
@switch-team="switchToTeam" @switch-team="switchToTeam"
@@ -64,6 +66,7 @@ const {
removeFilter, removeFilter,
editFilter, editFilter,
catalogMode, catalogMode,
setCatalogMode,
productLabel, productLabel,
hubLabel, hubLabel,
quantity, quantity,