forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQTimelineEntry.js
More file actions
73 lines (69 loc) · 1.58 KB
/
QTimelineEntry.js
File metadata and controls
73 lines (69 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { QIcon } from '../icon'
export default {
name: 'QTimelineEntry',
inject: {
__timeline: {
default () {
console.error('QTimelineEntry needs to be child of QTimeline')
}
}
},
props: {
heading: Boolean,
tag: {
type: String,
default: 'h3'
},
side: {
type: String,
default: 'right',
validator: v => ['left', 'right'].includes(v)
},
icon: String,
color: String,
title: String,
subtitle: String
},
computed: {
colorClass () {
return `text-${this.color || this.__timeline.color}`
},
classes () {
return [
`q-timeline-entry-${this.side === 'left' ? 'left' : 'right'}`,
this.icon ? 'q-timeline-entry-with-icon' : ''
]
}
},
render (h) {
if (this.heading) {
return h('div', { staticClass: 'q-timeline-heading' }, [
h('div'),
h('div'),
h(this.tag, { staticClass: 'q-timeline-heading-title' }, [
this.$slots.default
])
])
}
return h('li', {
staticClass: `q-timeline-entry`,
'class': this.classes
}, [
h('div', { staticClass: 'q-timeline-subtitle' }, [
h('span', this.subtitle)
]),
h('div', {
staticClass: 'q-timeline-dot',
'class': this.colorClass
}, [
this.icon
? h(QIcon, { props: { name: this.icon } })
: null
]),
h('div', { staticClass: 'q-timeline-content' }, [
h('h6', { staticClass: 'q-timeline-title' }, [ this.title ]),
this.$slots.default
])
])
}
}