Update note card to use element plus

main
TZGyn 3 years ago
parent 7bca8317d5
commit 57266379db
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -1,65 +1,64 @@
<template> <template>
<div <el-card>
class="group/note flex w-full cursor-pointer flex-col gap-4 bg-secondary px-4 py-2" <template #header>
v-auto-animate <div
@click="toggleDetail()"> class="flex cursor-pointer items-center"
<div class="flex items-center"> @click.stop="noteDetail(props.uuid)">
<div class="w-full text-center text-2xl font-bold"> <div class="w-full text-center text-2xl font-bold">
{{ props.title }} {{ props.title }}
</div>
<div class="flex flex-col">
<ElementButton @click.stop="toggleOptions()">
<Icon name="fa6-solid:ellipsis-vertical" />
</ElementButton>
<div class="relative">
<div
ref="contextMenu"
v-if="showOptions">
<div
class="absolute right-0 top-0 z-50 flex h-fit w-64 flex-col border border-lightgray bg-secondary">
<CardOptions
name="View Note"
@click.stop="noteDetail(props.uuid)" />
</div>
</div>
</div> </div>
</div> </div>
</div> </template>
<div <div
v-if="showDetail" class="flex w-full cursor-pointer flex-col gap-4"
class="mb-2 line-clamp-6 whitespace-pre"> v-auto-animate
{{ props.description }} @click="toggleDetail()">
<div
v-if="showDetail"
class="mb-2 line-clamp-6 whitespace-pre px-4 pt-2">
{{ props.description }}
</div>
<div
class="w-full px-4 py-2 text-center text-sm hover:bg-[--el-color-primary-light-9] hover:bg-opacity-50 hover:text-[--el-color-primary]"
>{{ showDetail ? 'Hide Details' : 'Show Details' }}</div
>
</div> </div>
</div> </el-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
interface Props { interface Props {
id: string | number id: string | number
uuid: string uuid: string
title: string title: string
description: string description: string
} }
const props = defineProps<Props>() const props = defineProps<Props>()
const showDetail = ref<boolean>(false) const showDetail = ref<boolean>(false)
const showOptions = ref<boolean>(false) const showOptions = ref<boolean>(false)
const contextMenu = ref() const contextMenu = ref()
const toggleOptions = () => { const toggleOptions = () => {
showOptions.value = !showOptions.value showOptions.value = !showOptions.value
} }
const toggleDetail = () => { const toggleDetail = () => {
showDetail.value = !showDetail.value showDetail.value = !showDetail.value
} }
const noteDetail = (id: string) => { const noteDetail = (id: string) => {
navigateTo(`/notes/${id}`) navigateTo(`/notes/${id}`)
} }
onClickOutside(contextMenu, (event) => { onClickOutside(contextMenu, (event) => {
toggleOptions() toggleOptions()
}) })
</script> </script>
<style scoped>
:deep(.el-card__body) {
--el-card-padding: 0;
}
</style>

Loading…
Cancel
Save