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

FeatureUpsell story: Allow toggling upsell state within the story #20263

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

d-claassen
Copy link
Contributor

@d-claassen d-claassen commented May 5, 2023

Context

  • Allow anyone interested in our FeatureUpsell to switch between the upsell and non-upsell state.

Summary

This PR can be summarized in the following changelog entry:

  • Allows anyone interested in our FeatureUpsell to switch between the upsell and non-upsell state.

Relevant technical choices:

  • Start with the initial args.shouldUpsell to allow switching from the Storybook controls.
  • Adding an onClick to an <a> tag, so that callback needs event.preventDefault etc.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Pull this PR,
  • Start the storybook with $ yarn workspace @yoast/ui-library storybook
  • Navigate to the "Feature upsell" component stories,
  • Try clicking the upsell buttons in any of the stories,
  • Expect to see the content unlocked,
  • Play around with the options in the controls and ensure all still work correctly and render the FeatureUpsell component as expected.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Block/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • Only affects the Storybook of the UI library.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label and noted the work hours.

Fixes Yoast/ui-library-storybook#12

@d-claassen d-claassen added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label May 5, 2023
@d-claassen d-claassen requested a review from a team as a code owner May 5, 2023 12:03
@vraja-pro vraja-pro self-assigned this May 29, 2023
@vraja-pro
Copy link
Contributor

I think adding a story that is the same as the factory component is maybe redundant?
Maybe adding a story with active and locked content side by side and then you don't need the button for returning to the upsell state? You could also adjust the text to be "Content that would be grayscaled" and "Active content".
I also think the blue is a bit out of place with the package UI colors, maybe it's better to use a more subtle color.

@vraja-pro vraja-pro assigned d-claassen and unassigned vraja-pro May 29, 2023
Copy link

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

The FeatureUpsell component supports 2 variants in which it can render. It has
a "default" variant and a "card" variant. When the variant is not specified, the
FeatureUpsell component shows as the "card" variant.

While that behaviour remains unchanged for the component (and is documented
in the Storybook), the default Factory story does show the FeatureUpsell
in its "default" variant style. A dedicated story to show the "card" variant style
already exists.
@d-claassen d-claassen force-pushed the d-claassen/feature-upsell-story branch from 8ff31cd to 89aeb92 Compare January 27, 2025 16:08
@coveralls
Copy link

Pull Request Test Coverage Report for Build c7a0c4f5a3ac52d4cdda946d67ad2b9faa0b97ba

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 54.531%

Totals Coverage Status
Change from base Build 50c07b20a701a0eafca8bdf7a7e17f890ba58ecc: 0.0%
Covered Lines: 30155
Relevant Lines: 55724

💛 - Coveralls

@d-claassen
Copy link
Contributor Author

Hey @vraja-pro, I found this old PR of mine again and decided to update it.

I think adding a story that is the same as the factory component is maybe redundant?

I agree. The component has a bit of a silly default. I've enforced the default variant in the factory story now in
Enforce default variant in the factory story.

Maybe adding a story with active and locked content side by side and then you don't need the button for returning to the upsell state?

I personally prefer the button to give that interactive feeling. We have similar buttons to toggle toasts and modals.

You could also adjust the text to be "Content that would be grayscaled" and "Active content". I also think the blue is a bit out of place with the package UI colors, maybe it's better to use a more subtle color.

You're right. I've added additional explanatory copy behind the upsell to better tell (and show) what's happening in Clarify the behaviour op the locked content in a FeatureUpsell story. And I've removed the strange blue background color in preference of the primary button, which demonstrates the same effect in Realistic grayscale example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve FeatureUpsell stories by showing the state without upsell
3 participants