Merge pull request #14 from AlexisNP/features/increase-event-label-to-2-lines

Added line clamp to event CTA
This commit is contained in:
AlexisNP
2024-06-06 21:45:35 +02:00
committed by GitHub

View File

@@ -12,11 +12,14 @@ const props = defineProps<{
const { areDatesIdentical } = useCalendar() const { areDatesIdentical } = useCalendar()
const spansMultipleDays = Boolean(props.event.startDate && props.event.endDate) const spansMultipleDays = Boolean(props.event.startDate && props.event.endDate)
const isStartEvent = spansMultipleDays && areDatesIdentical(props.tileDate, props.event.startDate) const isStartEvent = spansMultipleDays && areDatesIdentical(props.tileDate, props.event.startDate)
const isEndEvent = const isEndEvent = spansMultipleDays && props.event.endDate && areDatesIdentical(props.tileDate, props.event.endDate)
spansMultipleDays && props.event.endDate && areDatesIdentical(props.tileDate, props.event.endDate)
const titleCharLimit = 50;
const eventTitle = computed<string>(() => props.event.title.length <= titleCharLimit ? props.event.title : `${props.event.title.slice(0, titleCharLimit)}`)
// Popover code
const isPopoverDetailsOpen = ref<boolean>(false) const isPopoverDetailsOpen = ref<boolean>(false)
function handleClosePopover() { function handleClosePopover() {
@@ -28,7 +31,8 @@ function handleClosePopover() {
<UiPopover v-model:open="isPopoverDetailsOpen"> <UiPopover v-model:open="isPopoverDetailsOpen">
<UiPopoverTrigger as-child> <UiPopoverTrigger as-child>
<button <button
class="text-xs px-2 py-1 block w-full text-left rounded-sm whitespace-nowrap overflow-hidden text-ellipsis" id="test"
class="text-xs px-2 py-1 block w-full text-left rounded-sm"
:class=" :class="
cn({ cn({
'text-white bg-slate-600 hover:bg-slate-700': !event.category, 'text-white bg-slate-600 hover:bg-slate-700': !event.category,
@@ -55,7 +59,9 @@ function handleClosePopover() {
}) })
" "
> >
{{ event.title }} <div class="line-clamp-2">
{{ eventTitle }}
</div>
</button> </button>
</UiPopoverTrigger> </UiPopoverTrigger>