Skip to content

Conversation

@vraja-pro
Copy link
Contributor

@vraja-pro vraja-pro commented Nov 4, 2025

Context

  • We want to move the ai buttons out of the ai-frontend packge to the ui library for reusability and the GradientButton in ai-frontend is not a pattern.

Summary

This PR can be summarized in the following changelog entry:

  • [@yoast/ui-library 0.0.1 enhancement] Adds two button variants for AI features and improves button icons accessibility.
  • [@yoast/tailwindcss-preset 0.0.1 enhancement] Adds AI gradients background colors.
  • Implements AI button variants in the upsell modals and editor.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • On a new site, or after resetting introduction user meta _yoast_wpseo_introductions
  • Go to Yoast SEO -> Settings or any admin page.
  • Check you see the AI insights intrduction modal with the AI button and the focus is on the button.
Screenshot 2025-11-05 at 09 29 30
  • Edit a post and check the AI generator button design is correct, check also the hover design.
Screenshot 2025-12-04 at 14 35 41
  • Make sure you have premium disabled and the domain is not registered in myyoast, revoke consent if it was granted and reset yoast options using the yoast hepler.
  • Click on the Generate button and check the the button in the upsell design is correct.
  • Check also the hover design.
Screenshot 2025-11-05 at 09 32 22

For DEVS

  • Spin the @yoast/ui-library storybook.
  • Check the button has the two new variants (ai-primary,ai-secondary) in the variants story and in the props variant list for the main story.
  • Check the documentation has the new variants.
  • Check the Badge component, check the ai variant has the gradient background.
Screenshot 2025-12-01 at 16 35 00

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 (Default Block/Gutenberg/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:

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. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that 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.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes Add gradient variants to ui library button

@vraja-pro vraja-pro requested a review from a team as a code owner November 4, 2025 13:14
@vraja-pro vraja-pro added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Nov 4, 2025
@coveralls
Copy link

coveralls commented Nov 4, 2025

Pull Request Test Coverage Report for Build f5708935df1c39bbe1b43037349b813ff21487a3

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 155 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.02%) to 53.07%

Files with Coverage Reduction New Missed Lines %
packages/js/src/helpers/get-premium-benefits.js 5 23.81%
packages/js/src/general/routes/task-list.js 15 1.92%
packages/js/src/shared-admin/components/premium-upsell-card.js 19 3.7%
packages/js/src/settings/app.js 23 0.0%
packages/js/src/admin-global.js 93 0.0%
Totals Coverage Status
Change from base Build 8218b111533b92ec47f94130a94bcd0102263a45: -0.02%
Covered Lines: 32423
Relevant Lines: 61423

💛 - Coveralls

@JorPV JorPV requested a review from Copilot December 2, 2025 07:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates AI-related button variants from the ai-frontend package to the ui-library for reusability, replacing custom gradient button implementations with standardized variants.

Key changes:

  • Adds ai-primary and ai-secondary button variants to the UI library with gradient styling
  • Introduces a reusable SparklesIcon component with gradient support
  • Replaces custom CSS classes and GradientButton component usage with new standardized variants

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/ui-library/src/elements/button/style.css Adds CSS styles for ai-primary and ai-secondary button variants with gradient backgrounds and borders
packages/ui-library/src/elements/button/stories.js Adds ai-primary and ai-secondary variants to Storybook examples
packages/ui-library/src/elements/button/spark-icon.js Creates new SparklesIcon component with gradient color support
packages/ui-library/src/elements/button/index.js Integrates SparklesIcon into Button component and adds variant mappings
packages/ui-library/src/elements/button/docs/variants.md Documents the new AI button variants and their usage guidelines
packages/ui-library/src/elements/badge/style.css Updates AI badge to use new gradient color variable
packages/tailwindcss-preset/index.js Adds ai-100, ai-300, ai-500, and ai-600 gradient background utilities
packages/js/src/introductions/components/modals/ai-brand-insights-pre-launch.js Migrates from custom button styling to ai-primary variant
packages/js/src/introductions/components/modals/ai-brand-insights-post-launch.js Migrates from custom button styling to ai-primary variant
packages/js/src/ai-generator/components/upsell-modal-content.js Replaces GradientButton with ai-secondary variant
packages/js/src/ai-generator/components/app.js Replaces GradientButton with ai-secondary variant
css/src/introductions.css Removes custom AI button CSS now handled by ui-library
css/src/ai-generator.css Removes custom SVG margin styles

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.yst-button--ai-secondary {
@apply yst-bg-transparent yst-relative yst-text-slate-800 yst-ps-2 yst-gap-1.5;

border-image: linear-gradient(to bottom right, #cd82ab, #a5b4fc) 1;
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

Hard-coded gradient colors duplicate values from the tailwindcss-preset ai-300 gradient. Consider referencing the Tailwind gradient or using CSS custom properties for consistency.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

@vraja-pro vraja-pro Dec 3, 2025

Choose a reason for hiding this comment

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

This one is tricky because ai-300 is only used for backgroundImage not borderImage. Border image css is not supported by tailwindcss.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the variables in the tailwind config.

Copy link
Contributor

@JorPV JorPV left a comment

Choose a reason for hiding this comment

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

Good job 🚀 I left some suggestion comments 🙂

vraja-pro and others added 4 commits December 3, 2025 15:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JorPV JorPV added this to the 26.7 milestone Dec 4, 2025
@JorPV
Copy link
Contributor

JorPV commented Dec 4, 2025

AT + CR ✅

@JorPV JorPV merged commit 1398b97 into trunk Dec 4, 2025
24 checks passed
@JorPV JorPV deleted the 800-add-gradient-variants-to-ui-library-button branch December 4, 2025 13:27
@JorPV JorPV modified the milestones: 26.7, 26.8 Dec 16, 2025
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.

3 participants