Fix searchbar collapsing on input. Shold not happen with stimulus.
This commit is contained in:
+11
@@ -4,6 +4,7 @@ import { useDispatch } from 'stimulus-use'
|
|||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
|
|
||||||
static targets = [
|
static targets = [
|
||||||
|
'container',
|
||||||
'dateFrom',
|
'dateFrom',
|
||||||
'dateTo',
|
'dateTo',
|
||||||
'destinationUid',
|
'destinationUid',
|
||||||
@@ -16,6 +17,8 @@ export default class extends Controller {
|
|||||||
'priceRangeLabel',
|
'priceRangeLabel',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
static values = { collapsed: Boolean }
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
useDispatch(this)
|
useDispatch(this)
|
||||||
}
|
}
|
||||||
@@ -68,4 +71,12 @@ export default class extends Controller {
|
|||||||
priceRange: this.priceRangeTarget.value,
|
priceRange: this.priceRangeTarget.value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
this.collapsedValue = !this.collapsedValue
|
||||||
|
}
|
||||||
|
|
||||||
|
collapsedValueChanged() {
|
||||||
|
this.containerTarget.classList.toggle('hidden', this.collapsedValue === true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
<f:layout name="Default"/>
|
<f:layout name="Default"/>
|
||||||
|
|
||||||
<f:section name="Main">
|
<f:section name="Main">
|
||||||
<div data-controller="searchbar collapse"
|
<div data-controller="searchbar"
|
||||||
<f:if condition="{collapsed}">
|
<f:if condition="{collapsed}">
|
||||||
data-collapse-collapsed-value="true"
|
data-searchbar-collapsed-value="true"
|
||||||
</f:if>
|
</f:if>
|
||||||
data-action="datepicker:range-select->searchbar#setDateRange searchbar-toggle:toggle@window->collapse#toggle">
|
data-action="datepicker:range-select->searchbar#setDateRange searchbar-toggle:toggle@window->searchbar#toggle">
|
||||||
<f:form action="processSearch" controller="Search" method="post" name="searchParams"
|
<f:form action="processSearch" controller="Search" method="post" name="searchParams"
|
||||||
object="{searchParams}" pluginName="searchresult" extensionName="epproducts"
|
object="{searchParams}" pluginName="searchresult" extensionName="epproducts"
|
||||||
pageUid="{settings.defaultSearchPageUid}" data="{'searchbar-target': 'form'}">
|
pageUid="{settings.defaultSearchPageUid}" data="{'searchbar-target': 'form'}">
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
<f:form.hidden property="destinationType" data="{'searchbar-target': 'destinationType'}"/>
|
<f:form.hidden property="destinationType" data="{'searchbar-target': 'destinationType'}"/>
|
||||||
<f:form.hidden property="priceRange" data="{'searchbar-target': 'priceRange'}"/>
|
<f:form.hidden property="priceRange" data="{'searchbar-target': 'priceRange'}"/>
|
||||||
<div class="searchbar{f:if(condition: collapsed, then: ' reduced hidden')}"
|
<div class="searchbar{f:if(condition: collapsed, then: ' reduced hidden')}"
|
||||||
data-collapse-target="container"
|
|
||||||
<f:if condition="{collapsed}">
|
<f:if condition="{collapsed}">
|
||||||
<f:else>
|
<f:else>
|
||||||
data-controller="sticky"
|
data-controller="sticky"
|
||||||
@@ -27,7 +26,7 @@
|
|||||||
data-sticky-classes-value="sticky reduced"
|
data-sticky-classes-value="sticky reduced"
|
||||||
</f:else>
|
</f:else>
|
||||||
</f:if>
|
</f:if>
|
||||||
data-searchbar-target="container">
|
data-searchbar-target="container">
|
||||||
<div class="bg-gradient-to-tr from-ep-primary-light via-ep-primary-medium to-ep-primary-dark">
|
<div class="bg-gradient-to-tr from-ep-primary-light via-ep-primary-medium to-ep-primary-dark">
|
||||||
<div class="reduced:max-w-screen-xl reduced:mx-auto reduced:px-4 flex flex-col reduced:flex-row reduced:items-center">
|
<div class="reduced:max-w-screen-xl reduced:mx-auto reduced:px-4 flex flex-col reduced:flex-row reduced:items-center">
|
||||||
<div class="flex items-start justify-between reduced:flex-1 pt-8 px-8 reduced:px-0 reduced:py-4">
|
<div class="flex items-start justify-between reduced:flex-1 pt-8 px-8 reduced:px-0 reduced:py-4">
|
||||||
@@ -50,9 +49,8 @@
|
|||||||
data-action="click->collapse#toggle">
|
data-action="click->collapse#toggle">
|
||||||
<use href="#icon-calendar"></use>
|
<use href="#icon-calendar"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<div
|
<div class="hidden absolute z-20 top-100 mt-2 left-0 min-w-full bg-white p-4 shadow-md rounded"
|
||||||
class="hidden absolute z-20 top-100 mt-2 left-0 min-w-full bg-white p-4 shadow-md rounded"
|
data-collapse-target="container">
|
||||||
data-collapse-target="container">
|
|
||||||
<div class="flex justify-between divide-x divide-gray-200">
|
<div class="flex justify-between divide-x divide-gray-200">
|
||||||
<div class="pr-2">
|
<div class="pr-2">
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
|
|||||||
Reference in New Issue
Block a user