2023-12-19 18:43:42 +01:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { InputOption } from '~/types'
|
|
|
|
|
2024-09-03 17:13:23 +02:00
|
|
|
defineProps<{ placeholder?: string, includeSort?: boolean }>()
|
|
|
|
|
2023-12-19 18:43:42 +01:00
|
|
|
const { filter, switcher } = storeToRefs(useData())
|
|
|
|
const options: InputOption[] = [
|
|
|
|
{ label: 'A to Z', value: 'atoz' },
|
|
|
|
{ label: 'Score', value: 'score' },
|
|
|
|
{ label: 'Anonymity', value: 'anonymity' },
|
|
|
|
]
|
|
|
|
|
|
|
|
const isSearchFocused = ref(false)
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
|
|
|
flex
|
|
|
|
justify-between
|
|
|
|
gap-16px
|
|
|
|
items-centeer
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
border-2px
|
|
|
|
flex
|
|
|
|
items-center
|
|
|
|
w-full
|
2024-09-03 17:13:23 +02:00
|
|
|
h-40px
|
2024-09-02 15:13:43 +02:00
|
|
|
hover:opacity-100
|
|
|
|
:class="isSearchFocused ? 'opacity-100' : 'opacity-25'"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
px-12px
|
|
|
|
py-0px
|
|
|
|
flex
|
|
|
|
w-fit
|
|
|
|
>
|
2023-12-19 18:43:42 +01:00
|
|
|
<UnoIcon
|
2024-09-03 17:13:23 +02:00
|
|
|
i-heroicons-solid-magnifying-glass
|
2024-09-02 15:13:43 +02:00
|
|
|
text-16px
|
2023-12-19 18:43:42 +01:00
|
|
|
:class="isSearchFocused ? 'opacity-100' : 'opacity-50' "
|
|
|
|
class="uno-icon"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<input
|
2024-09-02 15:13:43 +02:00
|
|
|
v-model="filter.query"
|
2024-09-03 17:13:23 +02:00
|
|
|
:placeholder="placeholder"
|
2024-09-02 15:13:43 +02:00
|
|
|
type="text"
|
|
|
|
bg-transparent
|
|
|
|
border-transparent
|
|
|
|
focus:border-transparent
|
|
|
|
focus:ring-0
|
|
|
|
h-full
|
|
|
|
w-full
|
|
|
|
outline-none
|
|
|
|
@focus="isSearchFocused = true"
|
|
|
|
@blur="isSearchFocused = false"
|
2023-12-19 18:43:42 +01:00
|
|
|
>
|
|
|
|
</div>
|
2024-09-03 17:13:23 +02:00
|
|
|
<div v-if="includeSort">
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
|
|
|
flex
|
|
|
|
gap-24px
|
|
|
|
items-center
|
|
|
|
w-full
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
gap-12px
|
|
|
|
items-center
|
|
|
|
xl:flex
|
|
|
|
hidden
|
|
|
|
invisible
|
|
|
|
>
|
|
|
|
<UnoIcon
|
|
|
|
i-web-list
|
|
|
|
text-16px
|
|
|
|
cursor-pointer
|
|
|
|
hover:opacity-100
|
|
|
|
:class="switcher ? 'opacity-100' : 'opacity-50'"
|
|
|
|
@click="switcher = true"
|
|
|
|
/>
|
|
|
|
<UnoIcon
|
|
|
|
i-web-blocks
|
|
|
|
text-16px
|
|
|
|
cursor-pointer
|
|
|
|
hover:opacity-100
|
|
|
|
:class="!switcher ? 'opacity-100' : 'opacity-50'"
|
|
|
|
@click="switcher = false"
|
|
|
|
/>
|
2023-12-19 18:43:42 +01:00
|
|
|
</div>
|
2024-09-02 15:13:43 +02:00
|
|
|
<div
|
|
|
|
flex
|
|
|
|
gap-12px
|
|
|
|
items-center
|
|
|
|
w-full
|
|
|
|
>
|
|
|
|
<h4
|
|
|
|
xl:block
|
|
|
|
hidden
|
|
|
|
text-16px
|
|
|
|
opacity-50
|
|
|
|
w-fit
|
|
|
|
>
|
2023-12-19 18:43:42 +01:00
|
|
|
Sort by
|
|
|
|
</h4>
|
2024-09-02 15:13:43 +02:00
|
|
|
<SelectBox
|
|
|
|
v-model="filter.sortby"
|
|
|
|
:black-and-white="false"
|
|
|
|
:options="options"
|
|
|
|
w-99px
|
|
|
|
sm:w-162px
|
|
|
|
text-black
|
|
|
|
:is-margin-top="false"
|
|
|
|
/>
|
2023-12-19 18:43:42 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
div:hover .uno-icon {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
</style>
|