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: avoid using deprecated sass lighten function #2767

Merged
merged 1 commit into from
Sep 21, 2024
Merged

fix: avoid using deprecated sass lighten function #2767

merged 1 commit into from
Sep 21, 2024

Conversation

asamofal
Copy link

@asamofal asamofal commented Sep 20, 2024

closes #2766

Hi! This PR adds support for Sass v1.79.0. Since the lighten function is deprecated in this version, warnings appear during the build process. More details about the sass api changes can be found here.

I replaced lighten function with color.adjust that gives exactly the same result. According to Sass recommendations it's event better to use color.scale function to avoid using absolute terms but then the colors will be changed a little bit. I'm not sure how "serious" you are here about the colors... so I decide "just to fix it" without making any other changes.

I tested it with both Sass 1.55.0 and 1.79.0 versions, building and tests are ok now.

Summary by CodeRabbit

  • New Features

    • Enhanced color manipulation for icon states and validation messages using a new color adjustment method.
  • Bug Fixes

    • Improved consistency and flexibility in color adjustments for various UI elements.

Copy link
Contributor

coderabbitai bot commented Sep 20, 2024

Walkthrough

The changes involve updating the SCSS files to replace the deprecated lighten function with the color.adjust function for color manipulation. This update affects the border colors of various icon states in _icons.scss and several color variables in variables.scss. Additionally, the sass:color module has been imported to facilitate these changes.

Changes

Files Change Summary
src/scss/_icons.scss Replaced lighten with color.adjust for border colors of .swal2-warning, .swal2-info, and .swal2-question. Added imports for sass:color and sass:math.
src/variables.scss Introduced sass:color module and replaced lighten with color.adjust for multiple color variables.

Assessment against linked issues

Objective Addressed Explanation
DEPRECATION WARNING: lighten() is deprecated (#2766)

🐇 In the garden where colors gleam,
We swapped out lighten for a new dream.
With adjustments made, our palette's bright,
No more warnings in the soft moonlight.
Hopping along, our styles now sing,
A vibrant world, oh what joy it brings! 🌈


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 76f2afd and 29b2773.

Files selected for processing (2)
  • src/scss/_icons.scss (4 hunks)
  • src/variables.scss (4 hunks)
Additional comments not posted (7)
src/scss/_icons.scss (3)

1-2: LGTM!

The imports are necessary for using the color.adjust and math.div functions. The changes look good.


78-78: Excellent fix!

The replacement of the deprecated lighten function with the color.adjust function for the .swal2-warning class is a great fix. The lightness adjustment value is also correctly updated to use a percentage value.


94-94: Great consistency!

The replacement of the deprecated lighten function with the color.adjust function for the .swal2-info and .swal2-question classes is consistent with the fix applied to the .swal2-warning class. The lightness adjustment values are also correctly updated to use percentage values.

Also applies to: 110-110

src/variables.scss (4)

14-14: Looks good!

The update to $swal2-color using color.adjust instead of lighten aligns with the deprecation warning and PR objectives. The lightness adjustment of 33% seems appropriate.


79-79: Looks good!

The update to $swal2-input-border using color.adjust instead of lighten aligns with the deprecation warning and PR objectives. The lightness adjustment of 85% seems appropriate for a light border color.


111-111: Looks good!

The update to $swal2-validation-message-background using color.adjust instead of lighten aligns with the deprecation warning and PR objectives. The lightness adjustment of 94% seems appropriate for a light background color.


112-112: Looks good!

The update to $swal2-validation-message-color using color.adjust instead of lighten aligns with the deprecation warning and PR objectives. The lightness adjustment of 40% seems appropriate for the validation message text color.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Member

@limonte limonte left a comment

Choose a reason for hiding this comment

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

Thank you @asamofal 🙌

@limonte
Copy link
Member

limonte commented Sep 21, 2024

And thanks a lot for testing with older version of Sass, I bet there are many people using that. So we'll not break anything for them <3

@limonte limonte merged commit eb16ab3 into sweetalert2:main Sep 21, 2024
2 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 21, 2024
## [11.14.1](v11.14.0...v11.14.1) (2024-09-21)

### Bug Fixes

* avoid using deprecated sass lighten function ([#2767](#2767)) ([eb16ab3](eb16ab3))
@limonte
Copy link
Member

limonte commented Sep 21, 2024

Merging your PR while listening to https://www.youtube.com/watch?v=6JxAis_v2mw

Слава Україні! 🇺🇦

@limonte
Copy link
Member

limonte commented Sep 21, 2024

🎉 This PR is included in version 11.14.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

DEPRECATION WARNING: lighten() is deprecated.
2 participants