Skip to content

Commit

Permalink
feat(card): use core tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
mlogsdon18 authored and Westbrook committed Jun 30, 2023
1 parent 738dfc8 commit 9cccd26
Show file tree
Hide file tree
Showing 7 changed files with 657 additions and 684 deletions.
2 changes: 1 addition & 1 deletion packages/card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@spectrum-web-components/styles": "^0.33.2"
},
"devDependencies": {
"@spectrum-css/card": "^5.0.40"
"@spectrum-css/card": "^6.0.0"
},
"types": "./src/index.d.ts",
"customElements": "custom-elements.json",
Expand Down
13 changes: 12 additions & 1 deletion packages/card/src/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import '@spectrum-web-components/asset/sp-asset.js';
import { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox';
import '@spectrum-web-components/checkbox/sp-checkbox.js';
import '@spectrum-web-components/quick-actions/sp-quick-actions.js';
import '@spectrum-web-components/divider/sp-divider.js';
import cardStyles from './card.css.js';
import headingStyles from '@spectrum-web-components/styles/heading.js';
import detailStyles from '@spectrum-web-components/styles/detail.js';
Expand Down Expand Up @@ -220,6 +221,11 @@ export class Card extends LikeAnchor(
<sp-asset id="preview" variant=${ifDefined(this.asset)}>
<slot name="preview"></slot>
</sp-asset>
${this.variant !== 'quiet' && !this.horizontal
? html`
<sp-divider size="s"></sp-divider>
`
: html``}
`;
}

Expand All @@ -228,6 +234,11 @@ export class Card extends LikeAnchor(
<sp-asset id="cover-photo" variant=${ifDefined(this.asset)}>
<slot name="cover-photo"></slot>
</sp-asset>
${this.variant !== 'quiet' && !this.horizontal
? html`
<sp-divider size="s"></sp-divider>
`
: html``}
`;
}

Expand Down Expand Up @@ -259,6 +270,7 @@ export class Card extends LikeAnchor(

protected override render(): TemplateResult {
return html`
${this.renderImage()}
<div class="body">
<div class="header">
${this.renderHeading}
Expand Down Expand Up @@ -295,7 +307,6 @@ export class Card extends LikeAnchor(
<slot name="footer"></slot>
`
: html``}
${this.renderImage()}
${this.toggles
? html`
<sp-quick-actions
Expand Down
15 changes: 7 additions & 8 deletions packages/card/src/card.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,12 @@ slot[name='description'] {
);
}

#preview,
#cover-photo {
overflow: hidden;
order: -1;
}

#preview + #cover-photo {
display: none;
}

#preview ::slotted(*),
#cover-photo ::slotted(*) {
#cover-photo ::slotted(*),
:host(:not([variant='quiet'])) #preview ::slotted(*) {
width: 100%;
display: block;

Expand Down Expand Up @@ -88,3 +82,8 @@ sp-quick-actions {
/* Override until https://github.com/adobe/spectrum-css/issues/1054 is fixed */
text-transform: none;
}

:host:before,
:host:after {
pointer-events: none;
}
Loading

0 comments on commit 9cccd26

Please sign in to comment.