2023-04-29 00:18:09 +02:00
|
|
|
<template>
|
2023-05-20 00:41:59 +02:00
|
|
|
<button
|
|
|
|
ref="el"
|
|
|
|
class="_button"
|
|
|
|
:class="{ fade: modelValue, showLess: !modelValue }"
|
|
|
|
@click.stop="toggle"
|
|
|
|
>
|
2023-05-17 21:24:51 +02:00
|
|
|
<span>{{ modelValue ? i18n.ts.showMore : i18n.ts.showLess }}</span>
|
2023-04-29 00:18:09 +02:00
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { i18n } from "@/i18n";
|
2023-05-17 21:24:51 +02:00
|
|
|
import { ref } from "vue";
|
2023-04-29 00:18:09 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
modelValue: boolean;
|
|
|
|
}>();
|
|
|
|
|
2023-05-17 21:24:51 +02:00
|
|
|
const el = ref<HTMLElement>();
|
|
|
|
|
2023-04-29 00:18:09 +02:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: "update:modelValue", v: boolean): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const toggle = () => {
|
|
|
|
emit("update:modelValue", !props.modelValue);
|
|
|
|
};
|
2023-05-17 21:24:51 +02:00
|
|
|
|
|
|
|
function focus() {
|
|
|
|
el.value.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
focus,
|
|
|
|
});
|
2023-04-29 00:18:09 +02:00
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.fade {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
2023-05-28 06:17:23 +02:00
|
|
|
padding: 20px;
|
|
|
|
margin-bottom: -10px;
|
2023-05-25 21:50:14 +02:00
|
|
|
z-index: 5;
|
2023-04-29 00:18:09 +02:00
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 0.4em 1em;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
> span {
|
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.showLess {
|
|
|
|
width: 100%;
|
|
|
|
position: sticky;
|
2023-05-28 06:17:23 +02:00
|
|
|
bottom: calc(var(--stickyBottom) - 1em);
|
|
|
|
padding: 20px;
|
|
|
|
z-index: 5;
|
2023-04-29 00:18:09 +02:00
|
|
|
|
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 0 7px 7px var(--bg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|