Skip to content

Commit 06be51f

Browse files
pdanpdanrstoenescu
authored andcommitted
Add icon property to timeline dot (quasarframework#1197)
* Add icon property to timeline dot * Small tweaks for icon in dot in timeline * Center align title and subtitle with the large dots * Update QTimelineEntry.js * Update QTimelineEntry.js * Update QTimelineEntry.js * Update QTimelineEntry.js * Small tweaks on icons * Update QTimelineEntry.js
1 parent 6faadc4 commit 06be51f

File tree

4 files changed

+88
-12
lines changed

4 files changed

+88
-12
lines changed

dev/components/components/timeline.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
<q-timeline-entry
1717
title="Event Title Event Title Event Title Event Title Event Title Event Title Event Title Event Title "
18-
subtitle="February 22, 1986"
18+
subtitle="February 21, 1986"
1919
side="right"
20+
icon="delete"
2021
>
2122
<div>
2223
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@@ -50,6 +51,7 @@
5051
subtitle="February 22, 1986"
5152
side="left"
5253
color="orange"
54+
icon="done_all"
5355
>
5456
<div>
5557
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@@ -124,6 +126,7 @@
124126
title="Event Title"
125127
subtitle="February 22, 1986"
126128
side="right"
129+
icon="account_balance"
127130
>
128131
<div>
129132
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

src/components/timeline/QTimelineEntry.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { QIcon } from '../icon'
2+
13
export default {
24
name: 'q-timeline-entry',
35
inject: {
@@ -18,13 +20,20 @@ export default {
1820
default: 'right',
1921
validator: v => ['left', 'right'].includes(v)
2022
},
23+
icon: String,
2124
color: String,
2225
title: String,
2326
subtitle: String
2427
},
2528
computed: {
2629
colorClass () {
2730
return `text-${this.color || this.__timeline.color}`
31+
},
32+
classes () {
33+
return [
34+
`q-timeline-entry-${this.side === 'left' ? 'left' : 'right'}`,
35+
this.icon ? 'q-timeline-entry-with-icon' : ''
36+
]
2837
}
2938
},
3039
render (h) {
@@ -39,16 +48,22 @@ export default {
3948
}
4049

4150
return h('li', {
42-
staticClass: 'q-timeline-entry',
43-
'class': this.side === 'left' ? 'q-timeline-entry-left' : 'q-timeline-entry-right'
51+
staticClass: `q-timeline-entry`,
52+
'class': this.classes
4453
}, [
4554
h('div', { staticClass: 'q-timeline-subtitle' }, [
4655
h('span', this.subtitle)
4756
]),
57+
4858
h('div', {
4959
staticClass: 'q-timeline-dot',
5060
'class': this.colorClass
51-
}),
61+
}, [
62+
this.icon
63+
? h(QIcon, { props: { name: this.icon } })
64+
: null
65+
],
66+
5267
h('div', { staticClass: 'q-timeline-content' }, [
5368
h('h6', { staticClass: 'q-timeline-title' }, [ this.title ]),
5469
this.$slots.default

src/components/timeline/timeline.ios.styl

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
bottom 0
2121
left 0
2222
width 15px
23-
2423
&:before, &:after
2524
content ''
2625
background currentColor
@@ -41,6 +40,26 @@
4140
bottom 0
4241
left 6px
4342

43+
.q-timeline-entry-with-icon
44+
.q-timeline-dot
45+
width 31px
46+
left -8px
47+
&:before
48+
height 31px
49+
width 31px
50+
&:after
51+
top 41px
52+
left 14px
53+
.q-icon
54+
position absolute
55+
top 8px
56+
left 4px
57+
font-size 23px
58+
color white
59+
transition color .3s ease-in-out
60+
.q-timeline-subtitle
61+
padding-top 8px
62+
4463
.q-timeline-dark
4564
color white
4665
.q-timeline-subtitle
@@ -54,9 +73,12 @@
5473
padding-bottom 0
5574
.q-timeline-dot:after
5675
content none
57-
&:hover .q-timeline-dot:before
58-
background transparent
59-
border 3px solid currentColor
76+
&:hover
77+
.q-timeline-dot:before
78+
background transparent
79+
border 3px solid currentColor
80+
&.q-timeline-entry-with-icon:hover .q-timeline-dot .q-icon
81+
color currentColor
6082

6183
.q-timeline-content
6284
padding-bottom 24px
@@ -94,6 +116,8 @@
94116
position relative
95117
.q-timeline-content
96118
padding-left 30px
119+
.q-timeline-entry-with-icon .q-timeline-content
120+
padding-top 8px
97121
.q-timeline-subtitle
98122
padding-right 30px
99123

@@ -109,6 +133,9 @@
109133
position absolute
110134
left 50%
111135
margin-left -7.15px
136+
.q-timeline-entry-with-icon .q-timeline-dot
137+
left 50%
138+
margin-left -15px
112139
.q-timeline-subtitle, .q-timeline-content
113140
width 50%
114141
.q-timeline-entry-left .q-timeline-content,
@@ -121,6 +148,8 @@
121148
float right
122149
text-align left
123150
padding-left 30px
151+
.q-timeline-entry-with-icon .q-timeline-content
152+
padding-top 8px
124153
.q-timeline-entry
125154
padding-bottom 24px
126155
overflow hidden

src/components/timeline/timeline.mat.styl

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
bottom 0
2121
left 0
2222
width 15px
23-
2423
&:before, &:after
2524
content ''
2625
background currentColor
@@ -41,6 +40,26 @@
4140
bottom 0
4241
left 6px
4342

43+
.q-timeline-entry-with-icon
44+
.q-timeline-dot
45+
width 31px
46+
left -8px
47+
&:before
48+
height 31px
49+
width 31px
50+
&:after
51+
top 41px
52+
left 14px
53+
.q-icon
54+
position absolute
55+
top 8px
56+
left 4px
57+
font-size 23px
58+
color white
59+
transition color .3s ease-in-out
60+
.q-timeline-subtitle
61+
padding-top 8px
62+
4463
.q-timeline-dark
4564
color white
4665
.q-timeline-subtitle
@@ -54,9 +73,12 @@
5473
padding-bottom 0
5574
.q-timeline-dot:after
5675
content none
57-
&:hover .q-timeline-dot:before
58-
background transparent
59-
border 3px solid currentColor
76+
&:hover
77+
.q-timeline-dot:before
78+
background transparent
79+
border 3px solid currentColor
80+
&.q-timeline-entry-with-icon:hover .q-timeline-dot .q-icon
81+
color currentColor
6082

6183
.q-timeline-content
6284
padding-bottom 24px
@@ -94,6 +116,8 @@
94116
position relative
95117
.q-timeline-content
96118
padding-left 30px
119+
.q-timeline-entry-with-icon .q-timeline-content
120+
padding-top 8px
97121
.q-timeline-subtitle
98122
padding-right 30px
99123

@@ -109,6 +133,9 @@
109133
position absolute
110134
left 50%
111135
margin-left -7.15px
136+
.q-timeline-entry-with-icon .q-timeline-dot
137+
left 50%
138+
margin-left -15px
112139
.q-timeline-subtitle, .q-timeline-content
113140
width 50%
114141
.q-timeline-entry-left .q-timeline-content,
@@ -121,6 +148,8 @@
121148
float right
122149
text-align left
123150
padding-left 30px
151+
.q-timeline-entry-with-icon .q-timeline-content
152+
padding-top 8px
124153
.q-timeline-entry
125154
padding-bottom 24px
126155
overflow hidden

0 commit comments

Comments
 (0)