1
1
<template >
2
- <li class =" timeline-item" >
3
- <div class =" timeline-item-line" />
2
+ <div class =" mooc-timeline-item" >
3
+ <!-- line -->
4
+ <div class =" mooc-timeline-item-line" ></div >
4
5
6
+ <!-- dot -->
5
7
<div
6
8
v-if =" !$slots.dot"
7
- class =" timeline-item-dot"
9
+ class =" mooc- timeline-item-dot"
8
10
:style =" {
9
11
'background-color': color
10
12
}"
11
13
:class =" [
12
- ` timeline-item-dot-${size || '' }`,
13
- ` timeline-item-dot-${type || '' }`
14
+ type && `mooc- timeline-item-dot-${type }`,
15
+ size && `mooc- timeline-item-dot-${size }`
14
16
]"
15
- />
16
-
17
- <div v-if =" $slots.dot" class =" timeline-item-dot-customer" >
18
- <slot name =" dot" />
19
- </div >
17
+ ></div >
18
+ <div v-else class =" mooc-timeline-item-dot-customer" >
19
+ <slot name =" dot" ></slot >
20
+ </div >
20
21
21
- <div class =" timeline-item-wrapper" >
22
- <div v-if =" !hideTimestamp && placement==='top'" class =" timeline-item-timestamp top" >
22
+ <!-- content -->
23
+ <div class =" mooc-timeline-item-wrapper" >
24
+ <div
25
+ v-if =" !hideTimestamp && placement == 'top'"
26
+ class =" mooc-timeline-item-timestamp is-top"
27
+ >
23
28
{{ timestamp }}
24
29
</div >
25
-
26
- <div class =" timeline-item-content" >
27
- <slot />
30
+ <div class =" mooc-timeline-item-content" >
31
+ <slot ></slot >
28
32
</div >
29
-
30
- <div v-if =" !hideTimestamp && placement==='bottom'" class =" timeline-item-timestamp bottom" >
33
+ <div
34
+ v-if =" !hideTimestamp && placement == 'bottom'"
35
+ class =" mooc-timeline-item-timestamp is-bottom"
36
+ >
31
37
{{ timestamp }}
32
38
</div >
33
39
</div >
34
- </li >
40
+ </div >
35
41
</template >
42
+
36
43
<script >
44
+ import { baseType } from ' assets/js/mooc.config.js'
37
45
export default {
38
46
name: ' MoocTimelineItem' ,
39
47
props: {
@@ -49,86 +57,63 @@ export default {
49
57
return [' top' , ' bottom' ].includes (val)
50
58
}
51
59
},
52
- size: {
60
+ color: String ,
61
+ type: {
53
62
type: String ,
54
- default: ' small' ,
55
63
validator (val ) {
56
- return [ ' small ' , ' normal ' , ' medium ' , ' large ' ] .includes (val)
64
+ return baseType .includes (val)
57
65
}
58
66
},
59
- type : {
67
+ size : {
60
68
type: String ,
69
+ default: ' small' ,
61
70
validator (val ) {
62
- return [' primary' , ' success' , ' warning' , ' danger' , ' info' ].includes (val)
63
- }
64
- },
65
- color: String
71
+ return [' small' , ' normal' , ' medium' , ' large' ].includes (val)
72
+ }
73
+ }
66
74
}
67
75
}
68
76
</script >
69
77
<style lang="stylus" scoped>
70
78
@import '~assets/theme/variables.styl' ;
71
79
@import '~assets/theme/src/timeline-variables.styl' ;
72
- .timeline-item
80
+ @import '~assets/theme/mixin/timeline-mixin.styl' ;
81
+ .mooc-timeline-item
73
82
position : relative ;
74
83
padding-bottom : $timeline-item-padding-bottom ;
75
84
& :last-child
76
- .timeline-item-line
85
+ .mooc- timeline-item-line
77
86
display : none ;
78
- & -line
87
+ .mooc-timeline-item -line
79
88
position : absolute ;
80
- left : 4 px ;
89
+ left : $timeline-item-line-left ;
81
90
top : 0 ;
82
91
height : 100% ;
83
- border-left : 2 px solid $timeline-item-dot- color ;
84
- & -dot
92
+ border-left : $timeline-item-border-left-size $timeline-item-border-left-style $base-border-second- color ;
93
+ .mooc-timeline-item -dot
85
94
position : absolute ;
86
95
top : 0 ;
87
- border-radius : 50% ;
88
- background-color : $timeline-item-dot-color ;
89
- & -small
90
- left : - 1px ;
91
- width : $timeline-item-dot-small-size ;
92
- height : $timeline-item-dot-small-size ;
93
- & -normal
94
- left : - 2px ;
95
- width : $timeline-item-dot-normal-size ;
96
- height : $timeline-item-dot-normal-size ;
97
- & -medium
98
- left : - 3px
99
- width : $timeline-item-dot-medium-size ;
100
- height : $timeline-item-dot-medium-size ;
101
- & -large
102
- left : - 4px
103
- width : $timeline-item-dot-large-size ;
104
- height : $timeline-item-dot-large-size ;
105
- & -primary
106
- background-color : $base-primary ;
107
- & -success
108
- background-color : $base-success ;
109
- & -warning
110
- background-color : $base-warning ;
111
- & -danger
112
- background-color : $base-danger ;
113
- & -info
114
- background-color : $base-info ;
115
- & -dot-customer
116
- position : absolute ;
117
- display : flex ;
118
- justify-content : center ;
119
- align-items : center ;
120
- & -wrapper
96
+ border-radius : $base-border-radius-circle ;
97
+ background-color : $base-border-second-color ;
98
+ timeline-status ($timeline-item-small-left , $timeline-item-small-size , $timeline-item-status-args );
99
+ timeline-type ($timeline-item-type-args , $base-primary $base-success $base-warning $base-danger $base-info );
100
+ & -customer
101
+ position : absolute ;
102
+ display : flex ;
103
+ justify-content : center ;
104
+ align-items : center ;
105
+ .mooc-timeline-item-wrapper
121
106
position : relative ;
122
107
top : 0 ;
123
108
padding-left : $timeline-item-wrapper-padding-left ;
124
- .timeline-item-content
125
- line-height : 1 ;
126
- color : $timeline-item-title -color ;
127
- .timeline-item-timestamp
128
- color : $base-info ;
129
- line-height : 1 ;
130
- & .top
131
- margin-bottom : 8 px ;
132
- & .bottom
133
- margin-top : 8 px ;
134
- </style >
109
+ .mooc- timeline-item-content
110
+ line-height : $timeline-item-content-line-height ;
111
+ color : $base-font-first -color ;
112
+ .mooc- timeline-item-timestamp
113
+ color : $base-info
114
+ line-height : $timeline-item-content-line-height ;
115
+ & .is- top
116
+ margin-bottom : $timeline-item-timestamp-margin ;
117
+ & .is- bottom
118
+ margin-top : $timeline-item-timestamp-margin ;
119
+ </style >
0 commit comments