Skip to content

Commit 9cccd26

Browse files
mlogsdon18Westbrook
authored andcommitted
feat(card): use core tokens
1 parent 738dfc8 commit 9cccd26

File tree

7 files changed

+657
-684
lines changed

7 files changed

+657
-684
lines changed

packages/card/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"@spectrum-web-components/styles": "^0.33.2"
6767
},
6868
"devDependencies": {
69-
"@spectrum-css/card": "^5.0.40"
69+
"@spectrum-css/card": "^6.0.0"
7070
},
7171
"types": "./src/index.d.ts",
7272
"customElements": "custom-elements.json",

packages/card/src/Card.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import '@spectrum-web-components/asset/sp-asset.js';
3131
import { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox';
3232
import '@spectrum-web-components/checkbox/sp-checkbox.js';
3333
import '@spectrum-web-components/quick-actions/sp-quick-actions.js';
34+
import '@spectrum-web-components/divider/sp-divider.js';
3435
import cardStyles from './card.css.js';
3536
import headingStyles from '@spectrum-web-components/styles/heading.js';
3637
import detailStyles from '@spectrum-web-components/styles/detail.js';
@@ -220,6 +221,11 @@ export class Card extends LikeAnchor(
220221
<sp-asset id="preview" variant=${ifDefined(this.asset)}>
221222
<slot name="preview"></slot>
222223
</sp-asset>
224+
${this.variant !== 'quiet' && !this.horizontal
225+
? html`
226+
<sp-divider size="s"></sp-divider>
227+
`
228+
: html``}
223229
`;
224230
}
225231

@@ -228,6 +234,11 @@ export class Card extends LikeAnchor(
228234
<sp-asset id="cover-photo" variant=${ifDefined(this.asset)}>
229235
<slot name="cover-photo"></slot>
230236
</sp-asset>
237+
${this.variant !== 'quiet' && !this.horizontal
238+
? html`
239+
<sp-divider size="s"></sp-divider>
240+
`
241+
: html``}
231242
`;
232243
}
233244

@@ -259,6 +270,7 @@ export class Card extends LikeAnchor(
259270

260271
protected override render(): TemplateResult {
261272
return html`
273+
${this.renderImage()}
262274
<div class="body">
263275
<div class="header">
264276
${this.renderHeading}
@@ -295,7 +307,6 @@ export class Card extends LikeAnchor(
295307
<slot name="footer"></slot>
296308
`
297309
: html``}
298-
${this.renderImage()}
299310
${this.toggles
300311
? html`
301312
<sp-quick-actions

packages/card/src/card.css

+7-8
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,12 @@ slot[name='description'] {
4343
);
4444
}
4545

46-
#preview,
47-
#cover-photo {
48-
overflow: hidden;
49-
order: -1;
50-
}
51-
5246
#preview + #cover-photo {
5347
display: none;
5448
}
5549

56-
#preview ::slotted(*),
57-
#cover-photo ::slotted(*) {
50+
#cover-photo ::slotted(*),
51+
:host(:not([variant='quiet'])) #preview ::slotted(*) {
5852
width: 100%;
5953
display: block;
6054

@@ -88,3 +82,8 @@ sp-quick-actions {
8882
/* Override until https://github.com/adobe/spectrum-css/issues/1054 is fixed */
8983
text-transform: none;
9084
}
85+
86+
:host:before,
87+
:host:after {
88+
pointer-events: none;
89+
}

0 commit comments

Comments
 (0)