feat: added classes system for timeline point
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div :class="wrapperClasses">
|
||||
<div
|
||||
:class="timelineClasses"
|
||||
:class="pointClasses"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -28,15 +28,28 @@ const wrapperClasses = computed(() => {
|
||||
const defaultBorderClasses = 'h-0.5 w-full bg-gray-200 dark:bg-gray-700 sm:flex'
|
||||
const borderClasses = computed(() => classNames(defaultBorderClasses, { 'sm:hidden hidden': !isHorizontal }))
|
||||
|
||||
const defaultClasses = 'absolute rounded-full -left-1.5 border border-white dark:border-gray-900 dark:bg-gray-700'
|
||||
const noIconClasses = 'w-3 h-3 bg-gray-200'
|
||||
const horizontalClasses = ''
|
||||
const verticalClasses = 'mt-1.5'
|
||||
const iconContainerClasses = 'w-6 h-6 -left-3 flex justify-center items-center bg-blue-200 ring-8 ring-white dark:ring-gray-900'
|
||||
|
||||
const timelineClasses = classNames(
|
||||
defaultClasses,
|
||||
hasSlot.value ? iconContainerClasses : noIconClasses,
|
||||
isHorizontal ? horizontalClasses : verticalClasses,
|
||||
)
|
||||
const pointClasses = computed(() => {
|
||||
const defaultClasses = 'absolute rounded-full -left-1.5 border border-white dark:border-gray-900 dark:bg-gray-700'
|
||||
|
||||
const verticalWithNoIconClasses = 'mt-1.5 w-3 h-3 bg-gray-200'
|
||||
const verticalWithIconClasses = 'mt-1.5 w-6 h-6 -left-3 flex justify-center items-center bg-blue-200 ring-8 ring-white dark:ring-gray-900'
|
||||
const horizontalWithNoIconClasses = 'w-3 h-3 bg-gray-200'
|
||||
const horizontalWithIconClasses = 'w-6 h-6 -left-3 flex justify-center items-center bg-blue-200 ring-8 ring-white dark:ring-gray-900'
|
||||
|
||||
const isVerticalWithNoIcon = !isHorizontal && !hasSlot.value
|
||||
const isVerticalWithIcon = !isHorizontal && hasSlot.value
|
||||
const isHorizontalWithNoIcon = isHorizontal && !hasSlot.value
|
||||
const isHorizontalWithIcon = isHorizontal && hasSlot.value
|
||||
|
||||
return classNames(
|
||||
defaultClasses,
|
||||
{
|
||||
[verticalWithNoIconClasses]: isVerticalWithNoIcon,
|
||||
[verticalWithIconClasses]: isVerticalWithIcon,
|
||||
[horizontalWithNoIconClasses]: isHorizontalWithNoIcon,
|
||||
[horizontalWithIconClasses]: isHorizontalWithIcon,
|
||||
},
|
||||
)
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user