Skip to content
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

feat(coachmark): S2 migration #3412

Open
wants to merge 13 commits into
base: spectrum-two
Choose a base branch
from

Conversation

cdransf
Copy link
Member

@cdransf cdransf commented Nov 21, 2024

Description

CSS-1024

S2 coachmark migration

This migrates the coachmark component to S2. Custom properties have been remapped per the design spec.

Before After
--spectrum-heading-sans-serif-font-weight --spectrum-title-sans-serif-font-weight
--spectrum-coach-mark-title-size --spectrum-coach-mark-title-font-size
--spectrum-heading-line-height --spectrum-title-line-height
--spectrum-coach-mark-body-size --spectrum-coach-mark-body-font-size
--spectrum-body-sans-serif-font-style --spectrum-body-serif-font-style
--spectrum-coach-mark-pagination-body-size --spectrum-coach-mark-pagination-body-font-size

Additions

Adds --spectrum-coachmark-media-fixed-height for fixed 4:3 image variant and an accompanying --mod-coachmark-media-fixed-height mod. This variation has been added to the coachmark component story as a boolean control labeled as Image fixed height. The class is conditionally added within the hasImage block and, as such, will only impact rendering when hasImage is also true.


Validation steps

  1. Open the URL for the PR.
  2. Navigate to the coachmark component and verify no regressions have occurred.

Note: the new font-family tokens set the font to Adobe Clean but Adobe Clean is not loading on the branch created from the spectrum-two base branch.

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

@cdransf cdransf added size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete. skip_vrt Add to a PR to skip running VRT (but still pass the action) ready-for-review labels Nov 21, 2024
@cdransf cdransf self-assigned this Nov 21, 2024
Copy link

changeset-bot bot commented Nov 21, 2024

🦋 Changeset detected

Latest commit: b1b6909

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@spectrum-css/coachmark Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 21, 2024

🚀 Deployed on https://pr-3412--spectrum-css.netlify.app

Copy link
Contributor

github-actions bot commented Nov 21, 2024

File metrics

Summary

Total size: 1.73 MB*
Total change (Δ): 🔴 ⬆ 1.99 KB (0.11%)

Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.

Package Size Δ
coachmark 7.48 KB 🔴 ⬆ 1.99 KB

Details

coachmark

Filename Head Compared to base
index.css 7.48 KB 🔴 ⬆ 1.99 KB (36.14%)
* Size determined by adding together the size of the main file for all packages in the library.
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

Copy link
Collaborator

@jawinn jawinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing a few things on the design not represented yet.

Line-height changes
I see body and pagination in the S2 specs marked as using line-height-200. I don't see the CSS using this token.
Screenshot 2024-11-22 at 10 55 57 AM

Keyboard shortcut
I don't see this new feature represented yet in our Docs examples or styles or controls. Does design need to define tokens for these keyboard shortcut elements on the specs?
Screenshot 2024-11-22 at 11 22 12 AM
Screenshot 2024-11-22 at 11 20 35 AM
Screenshot 2024-11-22 at 11 20 18 AM

4:3 and 16:19 image
The design shows an example of images at both of these aspect ratios, that we should demonstrate in our docs and maybe have a control for. I'm not exactly sure how this ties in with the sizing of the image and tokens.

Wait on popover to finalize?
This component is heavily reliant on popover, which has its S2 migration in progress and has been discussing and updating some items related to coachmark (#3365). So it may be worth waiting on that to merge before final review of its design.

components/coachmark/index.css Outdated Show resolved Hide resolved
components/coachmark/index.css Outdated Show resolved Hide resolved
@cdransf cdransf added the blocks Anything where Spectrum-CSS is blocking someone else label Nov 22, 2024
@cdransf
Copy link
Member Author

cdransf commented Nov 22, 2024

I'm seeing a few things on the design not represented yet.

Line-height changes I see body and pagination in the S2 specs marked as using line-height-200. I don't see the CSS using this token. Screenshot 2024-11-22 at 10 55 57 AM

Keyboard shortcut I don't see this new feature represented yet in our Docs examples or styles or controls. Does design need to define tokens for these keyboard shortcut elements on the specs? Screenshot 2024-11-22 at 11 22 12 AM Screenshot 2024-11-22 at 11 20 35 AM Screenshot 2024-11-22 at 11 20 18 AM

4:3 and 16:19 image The design shows an example of images at both of these aspect ratios, that we should demonstrate in our docs and maybe have a control for. I'm not exactly sure how this ties in with the sizing of the image and tokens.

Wait on popover to finalize? This component is heavily reliant on popover, which has its S2 migration in progress and has been discussing and updating some items related to coachmark (#3365). So it may be worth waiting on that to merge before final review of its design.

Awesome catches! I updated the line-height and font tokens. I marked this blocked pending the popover work and started a thread about the image implementation (one token includes -minimum- which seems odd semantically.

@cdransf cdransf added blocked See description and comments for what is blocking this issue and removed blocks Anything where Spectrum-CSS is blocking someone else labels Nov 25, 2024
@cdransf
Copy link
Member Author

cdransf commented Nov 27, 2024

I'm seeing a few things on the design not represented yet.
Line-height changes I see body and pagination in the S2 specs marked as using line-height-200. I don't see the CSS using this token. Screenshot 2024-11-22 at 10 55 57 AM
Keyboard shortcut I don't see this new feature represented yet in our Docs examples or styles or controls. Does design need to define tokens for these keyboard shortcut elements on the specs? Screenshot 2024-11-22 at 11 22 12 AM Screenshot 2024-11-22 at 11 20 35 AM Screenshot 2024-11-22 at 11 20 18 AM
4:3 and 16:19 image The design shows an example of images at both of these aspect ratios, that we should demonstrate in our docs and maybe have a control for. I'm not exactly sure how this ties in with the sizing of the image and tokens.
Wait on popover to finalize? This component is heavily reliant on popover, which has its S2 migration in progress and has been discussing and updating some items related to coachmark (#3365). So it may be worth waiting on that to merge before final review of its design.

Awesome catches! I updated the line-height and font tokens. I marked this blocked pending the popover work and started a thread about the image implementation (one token includes -minimum- which seems odd semantically.

Spoke with design and it sounds like the minimum token is the minimum dimension for the coach mark image and 4:3 is not a strict max. This is the current state:

.spectrum-CoachMark-image-wrapper {
  block-size: var(--mod-coachmark-media-height, var(--spectrum-coachmark-media-height));
  min-block-size: var(--mod-coachmark-media-min-height, var(--spectrum-coachmark-media-min-height));
...
}

@cdransf cdransf requested a review from jawinn December 3, 2024 00:01
@castastrophe castastrophe force-pushed the spectrum-two branch 3 times, most recently from cdb180d to 27d01df Compare December 4, 2024 14:54
@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch 2 times, most recently from e9b9444 to 28878d9 Compare December 10, 2024 15:18
@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch from 28878d9 to 63bbe7a Compare December 17, 2024 14:24
@cdransf cdransf removed the blocked See description and comments for what is blocking this issue label Dec 17, 2024
@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch from fcc97e9 to db908ca Compare December 18, 2024 22:53
Copy link
Collaborator

@jawinn jawinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line-height looks good, and thanks for finding out the intentions on the 4:3 and 16:9 examples (where 4:3 is now a variant class).

It looks like the use of the heights needs a little adjustments.
And the newly added keyboard shortcut feature needs to be built and documented.

The stories on the "Docs" page appear cut off, but that appears to be more popover related? That is possibly something that was already fixed in main as I don't see that issue there.

Copy link
Collaborator

@jawinn jawinn Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend documenting how images are displayed and the new fixed height class, by

  • adding a story for the Fixed height / 4:3 image, that includes the class name in the story description.
  • adding some description to the default image story to mention that the image has a minimum height but can grow to any height based on its dimensions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this as unresolved as I don't see this in the stories/documentation yet. It's important to document because of the addition of a variant and for clarity around how the image sizing works. What I was suggesting was:

  • "With media" Docs story: include info in the description about how the image is sized/displayed here (image has a minimum height but can grow to any height based on its dimensions)
  • "With media, fixed image height" add a Docs story that shows and explains this and mentions the added class in the description

components/coachmark/index.css Show resolved Hide resolved
@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch 2 times, most recently from 2c5d15c to 4715dab Compare December 19, 2024 23:00
@castastrophe castastrophe force-pushed the spectrum-two branch 4 times, most recently from fc916f1 to 9d7f088 Compare December 29, 2024 19:50
@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch 4 times, most recently from 45aaa69 to 441d81e Compare January 3, 2025 22:10
@cdransf cdransf requested a review from jawinn January 3, 2025 22:25
@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch 2 times, most recently from f3dea08 to 9519ce5 Compare January 6, 2025 17:10
@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch from 9519ce5 to 7630128 Compare January 6, 2025 20:40
Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a first pass and mainly focused on the stories and template files.

❓ Do you know why the coach indicator has a class name with --undefined in it? Is it a size? I'm unsure if it's coming from coach mark or popover (I think it's popover?) so maybe that's something I can address in the popover PR. It's like this on main as well, so this is just a curiosity.
❓ What would you think about renaming the WithMedia story to actual be Without media? Just based on Figma, it seems like the coach mark has a cover image by default. If that's true (and I would have to check, I don't actually know- that's just a guess based on the dev mode component), the default story and the with media story are the same right now. We'd also have to fix the sentence-casing of the story name and put that documentation elsewhere:
Screenshot 2025-01-06 at 5 11 35 PM

❓ Maybe we need to expedite those new keyboard command components. There's a few older cards for them (css-230 and css-231), so maybe we just need a coachmark follow up for when those are done? Would not having those block this currently? Just thinking out loud on this one...

I'll do a second pass for tokens & CSS tomorrow!

hasPagination,
() => html`
<div class="spectrum-CoachMark-step">
<bdo dir="ltr">${currentStep} of ${totalStepCount}</bdo>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoooa I've never seen a <bdo> tag! Add it to my list of things to look up!

So this doesn't respond to RTL then? Do you know why that is? I only found this bit in the documentation, and I suppose I was expecting it to work like our actual pagination component (where it flips for RTL languages). In that screenshot it looks like to me the pagination for the coachmark flipped. What do you think? Maybe this is a question for design?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo

The <bdo> HTML element overrides the current directionality of text, so that the text within is rendered in a different direction.

Huh. I think keeping to what the pagination component does makes the most sense. This is the same pattern in a different component so I'd be inclined to go with what we're doing in the component dedicated to this behavior. But that's a very good question. 😅

components/coachmark/stories/coachmark.stories.js Outdated Show resolved Hide resolved
components/coachmark/stories/coachmark.stories.js Outdated Show resolved Hide resolved
category: "Content",
},
control: { type: "file", accept: ".svg,.png,.jpg,.jpeg,.webc" },
},
},
args: {
rootClass: "spectrum-CoachMark",
hasActionMenu: true,
hasPagination: true,
hasImage: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was messing around in Figma and noticed that maybe some of these args have changed for the default coach mark now? The "default variant" doesn't have the action menu and does have the cover image. Should those args here be updated?

hasActionMenu: false,
hasImage: true

And then we'd have to update the default args for the CoachContainer template too I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this then make the With Media example on the docs page unnecessary if the default has media?

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marissahuysentruyt @jawinn I updated the stories in this commit 0008d0. If we run with...

hasActionMenu: false,
hasImage: true

...as default args, I've shuffled around the leading example to adhere to that state, the second in that block to show the action menu on and the media off. The 2nd block now shows the media variations added in the S2 migration.

},
};

export const Default = CoachMarkGroup.bind({});
Default.tags = ["!autodocs"];
Default.args = {};
Default.args = {
image: "example-card-landscape.png",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we want to show the landscape image with the Standard story that's on the docs page as well? This Default isn't the only on the docs page, so right now, all the images are the portrait ones, and they get cut off because of the defined story height.

Standard.args = { image: "example-card-landscape.png", };

Screenshot 2025-01-06 at 5 03 12 PM

I think regardless, with the updates to the coachmark spacing, we should increase the story heights (maybe to 450ish?)

Screenshot 2025-01-06 at 5 02 49 PM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the height(s) in 0008d0 while adjusting other aspects of the story(ies). ✨

components/coachmark/index.css Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this as unresolved as I don't see this in the stories/documentation yet. It's important to document because of the addition of a variant and for clarity around how the image sizing works. What I was suggesting was:

  • "With media" Docs story: include info in the description about how the image is sized/displayed here (image has a minimum height but can grow to any height based on its dimensions)
  • "With media, fixed image height" add a Docs story that shows and explains this and mentions the added class in the description

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still looking for the keyboard shortcut feature that is part of the S2 design spec. Were you planning to add that (markup, new CSS, stories)?
Screenshot 2024-11-22 at 11 20 35 AM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally missed that! Will be digging into it shortly (and may have some questions on how best to approach it).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that spectrum-two has the .test.js files for Chromatic, it'd be a good idea to make sure everything that we want covered by VRTs is added there. Things that come to mind are the fixed height media, and the regular media with a landscape image that is affected by its minimum height.

@cdransf cdransf force-pushed the cdransf/s2-migration-coachmark branch from 0008d0a to b1b6909 Compare January 6, 2025 23:50
@cdransf cdransf added size-3 M ~18-30hrs; moderate effort or complexity, several work days needed. and removed size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete. labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review size-3 M ~18-30hrs; moderate effort or complexity, several work days needed. skip_vrt Add to a PR to skip running VRT (but still pass the action)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants