File tree Expand file tree Collapse file tree 2 files changed +52
-21
lines changed Expand file tree Collapse file tree 2 files changed +52
-21
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,9 @@ export const Component = {
22
22
} ,
23
23
template : `
24
24
<ui-card v-bind="args" style="width: 400px">
25
- <div slot="default" >
25
+ <div>
26
26
{{ args.content }}
27
27
</div>
28
- <div slot="actions">
29
- <button>Action!</button>
30
- </div>
31
28
</ui-card>` ,
32
29
} ) ,
33
30
@@ -37,3 +34,27 @@ export const Component = {
37
34
content : 'Card Content' ,
38
35
} ,
39
36
} ;
37
+
38
+ export const ComponentWithAllSlots = {
39
+ render : ( args ) => ( {
40
+ setup ( ) {
41
+ return { args } ;
42
+ } ,
43
+ template : `
44
+ <ui-card v-bind="args" style="width: 400px">
45
+ <div>
46
+ {{ args.content }}
47
+ </div>
48
+ <a slot="title" style="" href="#">Custom title, link</a>
49
+ <p slot="subtitle">My <span style="font-weight:bold">custom</span> subtitle :)</p>
50
+ <div slot="actions">
51
+ <button>Action!</button>
52
+ </div>
53
+ </ui-card>` ,
54
+ } ) ,
55
+
56
+ args : {
57
+ title : 'Card title' ,
58
+ content : 'Card Content' ,
59
+ } ,
60
+ } ;
Original file line number Diff line number Diff line change 2
2
<div class =" c-card" >
3
3
<div class =" c-card__header" >
4
4
<div class =" c-card__title-container" >
5
- <p
6
- v-if =" title"
7
- class =" c-card__title"
8
- >
9
- {{ title }}
10
- </p >
11
- <p
12
- v-if =" subtitle"
13
- class =" c-card__subtitle"
14
- >
15
- {{ subtitle }}
16
- </p >
5
+ <div class =" c-card__title" >
6
+ <slot name =" title" >
7
+ <p v-if =" title" >{{ title }}</p >
8
+ </slot >
9
+ </div >
10
+ <div class =" c-card__subtitle" >
11
+ <slot name =" subtitle" >
12
+ <p v-if =" subtitle" >{{ subtitle }}</p >
13
+ </slot >
14
+ </div >
17
15
</div >
18
16
<div class =" c-card__actions" >
19
17
<slot name =" actions" />
@@ -53,26 +51,38 @@ export default {
53
51
text-decoration : inherit ;
54
52
color : inherit ;
55
53
56
- & __header {
54
+ & __header {
57
55
display : flex ;
58
- margin-bottom : 26 px ;
56
+ margin-bottom : 24 px ;
59
57
align-items : start ;
60
58
flex-grow : 1 ;
61
59
justify-content : space-between ;
62
60
}
63
61
64
62
& __title {
65
- line-height : 25px ;
66
- font-size : 20px ;
63
+ line-height : 24px ;
64
+ font-size : 18px ;
65
+ font-weight : 500 ;
67
66
margin : 0 ;
67
+
68
+ p ,
69
+ & :: slotted( p ) {
70
+ margin : 0 ;
71
+ }
68
72
}
69
73
70
74
& __subtitle {
75
+ margin-top : 8px ;
71
76
font-size : 14px ;
77
+ font-weight : 400 ;
72
78
line-height : 20px ;
73
79
color : #70 70 70 ;
74
- margin : 0 ;
75
80
white-space : pre-wrap ;
81
+
82
+ p ,
83
+ & :: slotted( p ) {
84
+ margin : 0 ;
85
+ }
76
86
}
77
87
78
88
& __title-container {
You can’t perform that action at this time.
0 commit comments