add: (wip) new filtering layout
DropDown component, ToggleButton component,
This commit is contained in:
parent
38cd37cf74
commit
3fd26b4e66
11 changed files with 203 additions and 42 deletions
45
app/components/Pp/Form/DropDown.vue
Normal file
45
app/components/Pp/Form/DropDown.vue
Normal file
|
@ -0,0 +1,45 @@
|
|||
<template>
|
||||
<div
|
||||
class="DropDown"
|
||||
:class="{ active }"
|
||||
ref="dropdown"
|
||||
>
|
||||
<button @click="active = !active">
|
||||
<span>{{ current.label }}</span>
|
||||
<Icon class="icon" name="uil:angle-down" mode="svg" />
|
||||
</button>
|
||||
<ul>
|
||||
<li
|
||||
v-for="element in elements"
|
||||
@click="click(element)"
|
||||
:class="{ selected : element.value === current.value }"
|
||||
>
|
||||
{{ element.label }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { DropDownElement } from '../../../../shared/DropDown'
|
||||
|
||||
type Props = {
|
||||
elements : DropDownElement[]
|
||||
current : DropDownElement
|
||||
}
|
||||
|
||||
const { elements = [] } = defineProps<Props>()
|
||||
const emit = defineEmits(['click'])
|
||||
|
||||
const active = ref(false)
|
||||
const dropdown = useTemplateRef<HTMLDivElement>('dropdown')
|
||||
|
||||
const click = (element : DropDownElement) => {
|
||||
emit('click', element)
|
||||
active.value = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onClickOutside(dropdown, () => active.value = false)
|
||||
})
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue