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

fix(coachmark): add "step-count" slot for custom/internationalized pagination content #4215

Merged
merged 16 commits into from Apr 2, 2024

Conversation

Rajdeepc
Copy link
Contributor

@Rajdeepc Rajdeepc commented Mar 26, 2024

Description

This PR adds the ability for users to customize the separator between the current step and the total steps in the YourComponent component. By default, the separator is 'of', but users can now specify a custom separator using the separator attribute.

Changes Made

Added a new separator property to the YourComponent component to allow customization of the separator.
Updated the component's template to use the separator property for the separator between the current step and the total steps.

Related issue(s)

Motivation and context

How has this been tested?

  • Test case 1
    1. Go here
    2. Use the separator attribute to specify a custom separator.
    3. Verify that the component renders with the custom separator between the current step and the total steps.
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Screenshot 2024-03-26 at 4 23 54 PM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

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.

@Rajdeepc Rajdeepc linked an issue Mar 26, 2024 that may be closed by this pull request
1 task
Copy link

github-actions bot commented Mar 26, 2024

Lighthouse scores

Category Latest (report) Main (report) Branch (report)
Performance 0.93 0.98 0.98
Accessibility 1 1 1
Best Practices 1 1 1
SEO 1 0.92 0.92
PWA 1 1 1
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 main ("Main"). Higher scores are better, but note that the SEO scores on Netlify URLs are artifically constrained to 0.92.

Transfer Size

Category Latest Main Branch
Total 228.512 kB 217.371 kB 🏆 217.46 kB
Scripts 60.393 kB 54.42 kB 🏆 54.524 kB
Stylesheet 35.524 kB 30.924 kB 30.914 kB 🏆
Document 5.883 kB 5.255 kB 5.25 kB 🏆
Third Party 126.712 kB 🏆 126.772 kB 126.772 kB

Request Count

Category Latest Main Branch
Total 43 43 43
Scripts 35 35 35
Stylesheet 5 5 5
Document 1 1 1
Third Party 2 2 2

Copy link

github-actions bot commented Mar 26, 2024

Tachometer results

Chrome

coachmark permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 626 kB 127.46ms - 130.68ms - unsure 🔍
-2% - +2%
-2.24ms - +2.13ms
branch 617 kB 127.64ms - 130.60ms unsure 🔍
-2% - +2%
-2.13ms - +2.24ms
-
Firefox

coachmark permalink

basic-test

Version Bytes Avg Time vs remote vs branch
npm latest 626 kB 356.76ms - 364.52ms - unsure 🔍
-2% - +1%
-5.77ms - +4.85ms
branch 617 kB 357.47ms - 364.73ms unsure 🔍
-1% - +2%
-4.85ms - +5.77ms
-

@Rajdeepc Rajdeepc self-assigned this Mar 26, 2024
@Rajdeepc Rajdeepc requested a review from Westbrook March 26, 2024 12:12
@Rajdeepc Rajdeepc changed the title chore(coachmark): added separator property chore(coachmark): added separator property on step count Mar 26, 2024
@Westbrook
Copy link
Collaborator

Can you sync with the internationalization team to confirm that this works across the actual usage of our target languages? Naively, I've seeing 1 of 4 translate to 4 件中 1 件 in Japanese which I'm not sure how this API covers. Even a greatly simplified 4分の1 which might benefit from this change requires a content order change that I'm not sure a good path to managing here.

@Rajdeepc
Copy link
Contributor Author

Rajdeepc commented Mar 26, 2024

Can you sync with the internationalization team to confirm that this works across the actual usage of our target languages? Naively, I've seeing 1 of 4 translate to 4 件中 1 件 in Japanese which I'm not sure how this API covers. Even a greatly simplified 4分の1 which might benefit from this change requires a content order change that I'm not sure a good path to managing here.

Based on the feedback from the Internationalisation team, we'll need to update our component to allow users to provide the entire string for the step count dynamically using a slot.

protected renderSteps = (): TemplateResult => {
   return html`
       <div class="step" role="status">
           <span aria-live="polite">
               <slot name="step-count"></slot>
           </span>
       </div>
   `;
};

Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

I'd like one of the stories to deliver a previously unachievable page count text to ensure that we can continue to achieve it over time.

packages/coachmark/src/Coachmark.ts Outdated Show resolved Hide resolved
packages/coachmark/README.md Outdated Show resolved Hide resolved
@Rajdeepc Rajdeepc requested a review from Westbrook March 27, 2024 14:14
@Rajdeepc
Copy link
Contributor Author

Rajdeepc commented Mar 29, 2024

@Westbrook Let me know if we are good to land this or do you see any additional work that needs to be done here?

@Westbrook
Copy link
Collaborator

I'd like one of the stories to deliver a previously unachievable page count text to ensure that we can continue to achieve it over time.

Can we see this in a story that surfaces to VRT to ensure we're covered over time? Something like 4分の1 or other.

Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit: 🎆

Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

Sorry, I missed one thing that I can't place inline...

Can you add:

 * @slot step-count - Override the default pagination delivery with your own internationalized content

At or around line 40 so that it gets into the docs site.

@Westbrook Westbrook changed the title chore(coachmark): added separator property on step count fix(coachmark): add "step-count" slot for custom/internationalized pagination content Apr 1, 2024
@Rajdeepc Rajdeepc requested a review from Westbrook April 2, 2024 06:33
Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

:shipit: but, like, for real this time 😉

@Westbrook Westbrook merged commit f4136a6 into main Apr 2, 2024
49 checks passed
@Westbrook Westbrook deleted the feature/coachmark-localization branch April 2, 2024 13:15
TarunAdobe pushed a commit that referenced this pull request Apr 26, 2024
…gination content (#4215)

* chore(coachmark): added separator property

* chore(coachmark): updated tests

* chore(coachmark): updated golden image cache

* fix(coachmark): localized the step count

* chore(coachmark): updated golden image cache

* chore(coachmark): update readme and coachmark to default to english

* chore(coachmark): removed separator from the props

* chore(coachmark): updated to check for 1 of 4 stepcount context

* chore(coachmark): updated golden image cache

* chore(coachmark): added locallixation story for step count

* chore(coachmark): updated golden image cache

* chore(coachmark): update readme to include slot for docs site

---------

Co-authored-by: Rajdeep Chandra <rajdeepchandra@Rajdeeps-MacBook-Pro-2.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat]: Add localization to "1 of 8" step indicator in coachmark
2 participants