Skip to content

Commit 3618e93

Browse files
committed
Reintroduce --border-width and --border-radius, fixes #531
1 parent cfa9530 commit 3618e93

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/components/card/card.css

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
:host {
22
--spacing: var(--wa-space-xl);
3+
--border-width: var(--wa-panel-border-width);
4+
--border-radius: var(--wa-panel-border-radius);
5+
6+
--inner-border-radius: calc(var(--border-radius) - var(--border-width));
37

48
display: flex;
59
flex-direction: column;
610
background-color: var(--wa-color-surface-default);
711
border-color: var(--wa-color-surface-border);
8-
border-radius: var(--wa-panel-border-radius);
12+
border-radius: var(--border-radius);
913
border-style: var(--wa-panel-border-style);
10-
border-width: var(--wa-panel-border-width);
1114
box-shadow: var(--wa-shadow-s);
15+
border-width: var(--border-width);
1216
color: var(--wa-color-text-normal);
1317
}
1418

19+
.image,
20+
:host(:not([with-image])) .header {
21+
border-start-start-radius: var(--inner-border-radius);
22+
border-start-end-radius: var(--inner-border-radius);
23+
}
24+
1525
.image {
1626
display: flex;
17-
border-top-left-radius: inherit;
18-
border-top-right-radius: inherit;
19-
margin: calc(-1 * var(--border-width));
20-
overflow: hidden;
2127

2228
&::slotted(img) {
2329
display: block;
2430
width: 100%;
25-
border-bottom-left-radius: 0 !important;
26-
border-bottom-right-radius: 0 !important;
31+
border-start-start-radius: inherit !important;
32+
border-start-end-radius: inherit !important;
2733
}
2834
}
2935

@@ -33,11 +39,6 @@
3339
padding: calc(var(--spacing) / 2) var(--spacing);
3440
}
3541

36-
:host(:not([with-image])) .header {
37-
border-top-left-radius: inherit;
38-
border-top-right-radius: inherit;
39-
}
40-
4142
.body {
4243
display: block;
4344
padding: var(--spacing);
@@ -46,8 +47,8 @@
4647
.footer {
4748
display: block;
4849
border-top: inherit;
49-
border-bottom-left-radius: inherit;
50-
border-bottom-right-radius: inherit;
50+
border-end-start-radius: var(--inner-border-radius);
51+
border-end-end-radius: var(--inner-border-radius);
5152
padding: var(--spacing);
5253
}
5354

src/components/card/card.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import styles from './card.css';
1919
* @csspart body - The container that wraps the card's main content.
2020
* @csspart footer - The container that wraps the card's footer.
2121
*
22+
* @cssproperty --border-radius - The radius for the card's corners. Expects a single value. Defaults to `var(--wa-panel-border-radius)`.
23+
* @cssproperty --border-width - The width of the card's borders. Expects a single value. Defaults to `var(--wa-panel-border-width)`.
2224
* @cssproperty --spacing - The amount of space around and between sections of the card. Expects a single value.
2325
*/
2426
@customElement('wa-card')

0 commit comments

Comments
 (0)