Skip to content

Commit 3dd82a0

Browse files
vaadin-botrolfsmedsugur-vaadin
authored
refactor: consolidate card styles with dashboard widget styles (#8994) (#9210)
Co-authored-by: Rolf Smeds <rolf@vaadin.com> Co-authored-by: ugur-vaadin <ugur@vaadin.com>
1 parent ad16701 commit 3dd82a0

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed
7 Bytes
Loading
-106 Bytes
Loading
-79 Bytes
Loading

packages/card/theme/lumo/vaadin-card-styles.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import { addGlobalThemeStyles, css, registerStyles } from '@vaadin/vaadin-themab
66

77
const cardProps = css`
88
html {
9-
--vaadin-card-background: var(--lumo-shade-5pct);
9+
--vaadin-card-background: var(--lumo-contrast-5pct);
1010
--vaadin-card-border-radius: var(--lumo-border-radius-l);
1111
--vaadin-card-border-width: 0;
1212
--vaadin-card-border-color: var(--lumo-contrast-20pct);
1313
--vaadin-card-padding: var(--lumo-space-m);
1414
--vaadin-card-gap: var(--lumo-space-m);
15+
--vaadin-card-shadow: none;
1516
}
1617
`;
1718

@@ -21,36 +22,35 @@ const card = css`
2122
:host {
2223
background: var(--vaadin-card-background);
2324
border-radius: var(--vaadin-card-border-radius);
24-
box-shadow: var(--vaadin-card-box-shadow);
25+
box-shadow: var(--vaadin-card-shadow);
2526
position: relative;
2627
}
2728
2829
/* Could be an inset outline on the host as well, but rounded outlines only work since Safari 16.4 */
2930
:host::before {
3031
content: '';
3132
position: absolute;
32-
inset: 0;
33-
pointer-events: none;
34-
border-radius: inherit;
33+
inset: var(--_card-border-inset, 0);
34+
border-radius: var(--_card-border-pseudo-radius, inherit);
3535
border: var(--vaadin-card-border, var(--vaadin-card-border-width) solid var(--vaadin-card-border-color));
36+
pointer-events: none;
3637
}
3738
3839
:host([theme~='outlined']) {
3940
--vaadin-card-border-width: 1px;
40-
--vaadin-card-background: transparent;
41+
--vaadin-card-background: var(--lumo-base-color);
4142
}
4243
4344
:host([theme~='elevated']) {
44-
--vaadin-card-background: var(--lumo-tint-10pct);
45-
--vaadin-card-box-shadow: var(--lumo-box-shadow-xs);
46-
/* TODO I would like to update --lumo-box-shadow-xs to this (30pct instead of 50pct): */
47-
--lumo-box-shadow-xs: 0 1px 4px -1px var(--lumo-shade-30pct);
45+
--vaadin-card-background: linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct)) var(--lumo-base-color);
46+
--vaadin-card-shadow: var(--lumo-box-shadow-xs);
47+
--vaadin-card-border-width: 1px;
48+
--_card-border-inset: calc(-1 * var(--vaadin-card-border-width));
49+
--_card-border-pseudo-radius: calc(var(--vaadin-card-border-radius) + var(--vaadin-card-border-width));
4850
}
4951
50-
:host([theme~='elevated'][theme~='outlined']) {
51-
box-shadow:
52-
inset 0 -1px 0 0 var(--lumo-shade-10pct),
53-
var(--vaadin-card-box-shadow);
52+
:host([theme~='elevated']:not([theme~='outlined'])) {
53+
--vaadin-card-border-color: var(--lumo-contrast-10pct);
5454
}
5555
5656
:host(:where([theme~='stretch-media'])) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {

0 commit comments

Comments
 (0)