feat: added vertical timeline

This commit is contained in:
victor
2022-12-16 19:39:09 +04:00
parent 63c97e113e
commit 3b8719a72c
11 changed files with 298 additions and 39 deletions

View File

@@ -1,15 +1,137 @@
<script setup>
import TimelineExample from './timeline/examples/TimelineExample.vue'
import TimelineExample from './timeline/examples/TimelineExample.vue';
import TimelineWithIconsExample from './timeline/examples/TimelineWithIconsExample.vue';
</script>
# Vue Timeline Component - Flowbite
```vue
<script setup>
import { Timeline } from 'flowbite-vue'
</script>
<template>
<Timeline></Timeline>
</template>
```
## Default timeline usage
<TimelineExample />
```vue
<script setup>
import { Timeline, TimelineItem, TimelinePoint, TimelineTime, TimelineContent, TimelineTitle, TimelineButton } from 'flowbite-vue'
</script>
<template>
<div class="vp-raw flex flex-col">
<Timeline>
<timeline-item>
<timeline-point>
</timeline-point>
<timeline-time>
February 2022
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
</timeline-point>
<timeline-time>
February 2021
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
</timeline-point>
<timeline-time>
February 2020
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
</Timeline>
</div>
</template>
```
## Timeline with icons
<TimelineWithIconsExample />
```vue
<script setup>
import { Timeline, TimelineItem, TimelinePoint, TimelineTime, TimelineContent, TimelineTitle, TimelineButton } from 'flowbite-vue'
</script>
<template>
<div class="vp-raw flex flex-col">
<Timeline>
<timeline-item>
<timeline-point>
<svg aria-hidden="true" class="w-3 h-3 text-blue-600 dark:text-blue-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</timeline-point>
<timeline-time>
February 2022
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
<svg aria-hidden="true" class="w-3 h-3 text-blue-600 dark:text-blue-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</timeline-point>
<timeline-time>
February 2021
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
<svg aria-hidden="true" class="w-3 h-3 text-blue-600 dark:text-blue-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</timeline-point>
<timeline-time>
February 2020
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
</Timeline>
</div>
</template>
```

View File

@@ -1,8 +1,57 @@
<template>
<div class="vp-raw flex flex-col">
<Timeline></Timeline>
<Timeline>
<timeline-item>
<timeline-point>
</timeline-point>
<timeline-time>
February 2022
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
</timeline-point>
<timeline-time>
February 2021
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
</timeline-point>
<timeline-time>
February 2020
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
</Timeline>
</div>
</template>
<script setup>
import { Timeline } from '../../../../src/index'
import { Timeline, TimelineItem, TimelinePoint, TimelineTime, TimelineContent, TimelineTitle, TimelineButton } from '../../../../src/index'
</script>

View File

@@ -0,0 +1,60 @@
<template>
<div class="vp-raw flex flex-col">
<Timeline>
<timeline-item>
<timeline-point>
<svg aria-hidden="true" class="w-3 h-3 text-blue-600 dark:text-blue-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</timeline-point>
<timeline-time>
February 2022
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
<svg aria-hidden="true" class="w-3 h-3 text-blue-600 dark:text-blue-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</timeline-point>
<timeline-time>
February 2021
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
<timeline-item>
<timeline-point>
<svg aria-hidden="true" class="w-3 h-3 text-blue-600 dark:text-blue-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</timeline-point>
<timeline-time>
February 2020
</timeline-time>
<timeline-title>
Application UI code in Tailwind CSS
</timeline-title>
<timeline-content>
Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.
</timeline-content>
<timeline-button>
Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</timeline-button>
</timeline-item>
</Timeline>
</div>
</template>
<script setup>
import { Timeline, TimelineItem, TimelinePoint, TimelineTime, TimelineContent, TimelineTitle, TimelineButton } from '../../../../src/index'
</script>

View File

@@ -1,35 +1,10 @@
<template>
<ol class="relative border-l border-gray-200 dark:border-gray-700">
<li class="mb-10 ml-4">
<div class="absolute w-3 h-3 bg-gray-200 rounded-full mt-1.5 -left-1.5 border border-white dark:border-gray-900 dark:bg-gray-700"></div>
<time class="mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">February 2022</time>
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">Application UI code in Tailwind CSS</h3>
<p class="mb-4 text-base font-normal text-gray-500 dark:text-gray-400">Get access to over 20+ pages including a dashboard layout, charts, kanban board, calendar, and pre-order E-commerce & Marketing pages.</p>
<a href="#" class="inline-flex items-center py-2 px-4 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:outline-none focus:ring-gray-200 focus:text-blue-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700">Learn more <svg class="ml-2 w-3 h-3" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg></a>
</li>
<li class="mb-10 ml-4">
<div class="absolute w-3 h-3 bg-gray-200 rounded-full mt-1.5 -left-1.5 border border-white dark:border-gray-900 dark:bg-gray-700"></div>
<time class="mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">March 2022</time>
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">Marketing UI design in Figma</h3>
<p class="text-base font-normal text-gray-500 dark:text-gray-400">All of the pages and components are first designed in Figma and we keep a parity between the two versions even as we update the project.</p>
</li>
<li class="ml-4">
<div class="absolute w-3 h-3 bg-gray-200 rounded-full mt-1.5 -left-1.5 border border-white dark:border-gray-900 dark:bg-gray-700"></div>
<time class="mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">April 2022</time>
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">E-Commerce UI code in Tailwind CSS</h3>
<p class="text-base font-normal text-gray-500 dark:text-gray-400">Get started with dozens of web components and interactive elements built on top of Tailwind CSS.</p>
</li>
<ol class="relative border-l border-gray-200 dark:border-gray-700">
<slot></slot>
</ol>
</template>
<script lang="ts" setup>
import { computed, toRefs } from 'vue'
import type { PropType } from 'vue'
const props = defineProps({
className: {
type: String,
default: '',
},
defineProps({
horizontal: {
type: Boolean,
default: false,

View File

@@ -0,0 +1,5 @@
<template>
<a href="#" class="inline-flex items-center py-2 px-4 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:outline-none focus:ring-gray-200 focus:text-blue-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700">
<slot></slot>
</a>
</template>

View File

@@ -0,0 +1,3 @@
<template>
<p class="mb-4 text-base font-normal text-gray-500 dark:text-gray-400"><slot></slot></p>
</template>

View File

@@ -0,0 +1,5 @@
<template>
<li class="mb-10 ml-6">
<slot></slot>
</li>
</template>

View File

@@ -0,0 +1,24 @@
<template>
<div
:class="timelineClasses"
>
<slot />
</div>
</template>
<script lang="ts" setup>
import { computed, useSlots } from 'vue'
import classNames from 'classnames'
const slots = useSlots()
const hasSlot = computed(() => {
return !!slots.default
})
const defaultClasses = 'absolute rounded-full -left-1.5 border border-white dark:border-gray-900 dark:bg-gray-700'
const noIconClasses = 'mt-1.5 w-3 h-3 bg-gray-200'
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)
</script>

View File

@@ -0,0 +1,5 @@
<template>
<time class="mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500">
<slot></slot>
</time>
</template>

View File

@@ -0,0 +1,5 @@
<template>
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">
<slot></slot>
</h3>
</template>

View File

@@ -33,6 +33,12 @@ export { default as Rating } from './components/Rating/Rating.vue'
export { default as Sidebar } from './components/Sidebar/Sidebar.vue'
export { default as Table } from './components/Table/Table.vue'
export { default as Timeline } from './components/Timeline/Timeline.vue'
export { default as TimelineItem } from './components/Timeline/TimelineItem.vue'
export { default as TimelinePoint } from './components/Timeline/TimelinePoint.vue'
export { default as TimelineTime } from './components/Timeline/TimelineTime.vue'
export { default as TimelineTitle } from './components/Timeline/TimelineTitle.vue'
export { default as TimelineContent } from './components/Timeline/TimelineContent.vue'
export { default as TimelineButton } from './components/Timeline/TimelineButton.vue'
export { default as Toast } from './components/Toast/Toast.vue'
export { default as ToastProvider } from './components/Toast/components/ToastProvider/ToastProvider.vue'
export { default as Tooltip } from './components/Tooltip/Tooltip.vue'