Skip to content

Commit 8f4f78e

Browse files
committed
LITE-31805: Update card widget styles to match the specification
1 parent f0a1b96 commit 8f4f78e

File tree

2 files changed

+52
-21
lines changed

2 files changed

+52
-21
lines changed

components/src/stories/Card.stories.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ export const Component = {
2222
},
2323
template: `
2424
<ui-card v-bind="args" style="width: 400px">
25-
<div slot="default">
25+
<div>
2626
{{ args.content }}
2727
</div>
28-
<div slot="actions">
29-
<button>Action!</button>
30-
</div>
3128
</ui-card>`,
3229
}),
3330

@@ -37,3 +34,27 @@ export const Component = {
3734
content: 'Card Content',
3835
},
3936
};
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+
};

components/src/widgets/card/widget.vue

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
<div class="c-card">
33
<div class="c-card__header">
44
<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>
1715
</div>
1816
<div class="c-card__actions">
1917
<slot name="actions" />
@@ -53,26 +51,38 @@ export default {
5351
text-decoration: inherit;
5452
color: inherit;
5553
56-
&__header{
54+
&__header {
5755
display: flex;
58-
margin-bottom: 26px;
56+
margin-bottom: 24px;
5957
align-items: start;
6058
flex-grow: 1;
6159
justify-content: space-between;
6260
}
6361
6462
&__title {
65-
line-height: 25px;
66-
font-size: 20px;
63+
line-height: 24px;
64+
font-size: 18px;
65+
font-weight: 500;
6766
margin: 0;
67+
68+
p,
69+
& ::slotted(p) {
70+
margin: 0;
71+
}
6872
}
6973
7074
&__subtitle {
75+
margin-top: 8px;
7176
font-size: 14px;
77+
font-weight: 400;
7278
line-height: 20px;
7379
color: #707070;
74-
margin: 0;
7580
white-space: pre-wrap;
81+
82+
p,
83+
& ::slotted(p) {
84+
margin: 0;
85+
}
7686
}
7787
7888
&__title-container {

0 commit comments

Comments
 (0)