-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(card): clarify component's slot API #4938
base: main
Are you sure you want to change the base?
Conversation
Branch previewReview the following VRT differencesWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
If the changes are expected, update the |
Lighthouse scores
What is this?Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on Transfer Size
Request Count
|
Pull Request Test Coverage Report for Build 11984367845Details
💛 - Coveralls |
Tachometer resultsChromecard permalinktest-basic
grid permalinkbasic-test
Firefoxcard permalinktest-basic
grid permalinkbasic-test
|
:host(:not([variant='quiet'])) #preview ::slotted(*) { | ||
width: 100%; | ||
#preview ::slotted(*) { | ||
inline-size: 100%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should include the quiet
variant as per spectrum-css.
This will become a breaking change! Will bring this up in our office hours! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to create a section called BREAKING CHANGE
to surface up this change to the consumers. Let's talk in the office hours and get some more opinions from other product teams. I feel there is a lot of usage of the Card and the asset components in multiple products.
import '@spectrum-web-components/checkbox/sp-checkbox.js'; | ||
import '@spectrum-web-components/popover/sp-popover.js'; | ||
import { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox'; | |
import { Checkbox } from '@spectrum-web-components/checkbox'; |
|
||
/** | ||
* @element sp-card | ||
* | ||
* @fires change - Announces a change in the `selected` property of a card | ||
* @slot preview - This is the preview image for Gallery Cards | ||
* @slot cover-photo - This is the cover photo for Default and Quiet Cards | ||
* @slot image - This is the image of the card |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @slot image - This is the image of the card | |
* @slot image - Image content |
@@ -207,7 +204,7 @@ export class Card extends LikeAnchor( | |||
this.addEventListener('pointercancel', handleEnd); | |||
} | |||
|
|||
protected get renderHeading(): TemplateResult { | |||
protected renderHeading(): TemplateResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see any computation logic here so why change to a callable function instead of keeping it as a getter?
Description
This PR addresses APIs misunderstandings regarding the
sp-card
component's slots. Previously used slotspreview
andcover-photo
are now merged into a single one namedimage
. The styles are applied exactly as before, based on thevariant
andhorizontal
properties, through using the according id that maps to spectrum CSS styles.Also, now the
quiet
variant is included in the style overrides, and a new--mod-*
CSS variable was added to allow consumers to reliably obtain the desired behaviour (the added story reflects the usage of this token).Some CSS was also changed to remove deprecated overrides and improve readability.
Related issue(s)
Motivation and context
cover-photo
slot should be used with thequiet
variant. The consumer should not need to determine which slot to use with each variant.preview
with thequiet
variantpreview
with thequiet
variantquiet
variant was included in thewidth: 100%
at a previous point in time but the change to not include it anymore wasn't documented too much. There is a need to come back to the previous behaviour (to include thequiet
variant in the full width CSS). It seems like a--mod-*
is the best common ground to allow consumers all behaviours related to using an image and how to position it inside the asset, be that cover, contain, scale-down etc. (discussion context)How has this been tested?
No functional changes were added. All the slots usage in the project have been updated. This being said, all unit tests should pass and VRTs should show changes only for the quiet variant's initial width. A new story was added to reflect the usage of the newly added token.
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.