98 lines
1.9 KiB
Vue
98 lines
1.9 KiB
Vue
<!--
|
|||
|
|
Ported from legacy henza_pwa/src/components/dropDown.vue, restyled into the
|
||
|
|
redesigned design language (see components/home/* and HomeView) — previously
|
||
|
|
raw Tailwind utility classes with legacy tokens (text-primary,
|
||
|
|
border-lightGray/20), the one accordion in the app that didn't match the
|
||
|
|
LESS-token look every other surface uses.
|
||
|
|
-->
|
||
|
|
<template>
|
||
|
|
<div class="dd" :class="{ 'is-open': show }">
|
||
|
|
<button type="button" class="dd__head" @click="show = !show">
|
||
|
|
<h3 class="dd__title">
|
||
|
|
<slot name="text">{{ text }}</slot>
|
||
|
|
</h3>
|
||
|
|
<Icon icon="vuesax-linear:arrow-down" class="dd__chevron" size="18" />
|
||
|
|
</button>
|
||
|
|
<transition name="drop" mode="out-in" appear>
|
||
|
|
<div class="dd__body" v-if="show">
|
||
|
|
<slot />
|
||
|
|
</div>
|
||
|
|
</transition>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script setup lang="ts">
|
||
|
|
import { ref } from 'vue'
|
||
|
|
import Icon from '../icon/Icon.vue'
|
||
|
|
|
||
|
|
withDefaults(defineProps<{ text?: string }>(), {})
|
||
|
|
const show = ref(false)
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped lang="less">
|
||
|
|
.dd {
|
||
|
|
padding: 15px;
|
||
|
|
border: 1px solid @hairline;
|
||
|
|
border-radius: 16px;
|
||
|
|
background: @canvas;
|
||
|
|
}
|
||
|
|
|
||
|
|
.dd.is-open {
|
||
|
|
border-color: @wineSoft;
|
||
|
|
}
|
||
|
|
|
||
|
|
.dd__head {
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: space-between;
|
||
|
|
gap: 12px;
|
||
|
|
width: 100%;
|
||
|
|
border: 0;
|
||
|
|
padding: 0;
|
||
|
|
cursor: pointer;
|
||
|
|
background: none;
|
||
|
|
font-family: inherit;
|
||
|
|
text-align: start;
|
||
|
|
}
|
||
|
|
|
||
|
|
.dd__title {
|
||
|
|
margin: 0;
|
||
|
|
font-size: 13px;
|
||
|
|
font-weight: 700;
|
||
|
|
color: @ink;
|
||
|
|
}
|
||
|
|
|
||
|
|
.dd__chevron {
|
||
|
|
flex: 0 0 auto;
|
||
|
|
color: @inkFaint;
|
||
|
|
transition: transform 0.2s ease;
|
||
|
|
}
|
||
|
|
|
||
|
|
.dd.is-open .dd__chevron {
|
||
|
|
transform: rotate(180deg);
|
||
|
|
color: @wine;
|
||
|
|
}
|
||
|
|
|
||
|
|
.dd__body {
|
||
|
|
overflow: hidden;
|
||
|
|
padding-top: 15px;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
|
||
|
|
<style lang="less">
|
||
|
|
.drop-enter-active {
|
||
|
|
animation: drop 0.2s cubic-bezier(0.33, 1, 0.68, 1);
|
||
|
|
}
|
||
|
|
.drop-leave-to {
|
||
|
|
animation: drop 0.2s cubic-bezier(0.33, 1, 0.68, 1) reverse;
|
||
|
|
}
|
||
|
|
@keyframes drop {
|
||
|
|
0% {
|
||
|
|
max-height: 0;
|
||
|
|
}
|
||
|
|
100% {
|
||
|
|
max-height: 240px;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</style>
|