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

Removed theme-dependent SCSS variables #886

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

shruti862
Copy link
Contributor

@shruti862 shruti862 commented Jan 12, 2025

Description

This PR removes theme-dependent SCSS variables in the file lib/keen/styles/variables.scss and replace them with the corresponding JS/Vue theme variables.

Issue addressed

Addresses issue #617

Addresses #PR# HERE

Before/after screenshots

Changelog

  • Description: Removed SCSS variables in lib/keen/styles/variables.scss that relied on theming SCSS variables. Replaced their usage in KDS components and styles with direct references to the corresponding JS/Vue theme variables using inline style bindings or dynamic classes.
  • Products impact: none
  • Addresses: Issue Remove theme-dependent SCSS variables: Remove variables within KDS files that rely on theming SCSS variables #617
  • Components: No public KDS components directly affected.
  • Breaking: no
  • Impacts a11y: no
  • Guidance: Consumers of KDS should ensure they are not relying on the removed SCSS variables. If theming is applied, they must directly reference the appropriate KDS color variables in Vue templates for consistency and runtime theming support.

Steps to test

  1. Step 1
  2. Step 2
  3. ...

(optional) Implementation notes

At a high level, how did you implement this?

Does this introduce any tech-debt items?

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical and brittle code paths are covered by unit tests
  • The change is described in the changelog section above

Reviewer guidance

  • Is the code clean and well-commented?
  • Are there tests for this change?
  • Are all UI components LTR and RTL compliant (if applicable)?
  • Add other things to check for here

Comments

@shruti862 shruti862 closed this Jan 12, 2025
@shruti862 shruti862 reopened this Jan 12, 2025
@MisRob MisRob added the TODO: needs review Waiting for review label Jan 15, 2025
Copy link
Member

@LianaHarris360 LianaHarris360 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 for your quick work on this, I apologize for the delayed review. I noticed that some of the variables that were taken out of variables.scss are still being used in other places. Could you please check again to make sure that all of the removed styling variables aren’t being used elsewhere?

Also, could you please fill in the Changelog descriptions in your PR template? If you need any help with this, just let us know!

@@ -33,9 +33,8 @@ $ui-input-height: rem(32px) !default;
$ui-input-margin-bottom: rem(16px) !default;

// Input label
$ui-input-label-color: $secondary-text-color !default;
Copy link
Member

Choose a reason for hiding this comment

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

Even though it has been removed, there are still a couple of places in the file lib/KSelect/index.vue where ui-input-label-color is used, this could be causing some of the tests to fail.

Copy link
Member

@akolson akolson Feb 4, 2025

Choose a reason for hiding this comment

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

usages of $ui-input-label-color still exist in KSelect Just rechecked this; we should be good

$ui-input-label-color--hover: black !default;
$ui-input-label-color--active: $brand-primary-color !default;
Copy link
Member

Choose a reason for hiding this comment

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

ui-input-border-color--active is still in use within lib/KSelect/index.vue as well

@shruti862
Copy link
Contributor Author

shruti862 commented Jan 22, 2025

Hey @LianaHarris360 ,Thank you for letting me know ! . I will surely revisit the variables that were removed from variables.scss to ensure they are not referenced elsewhere in the codebase.
Regarding the Changelog descriptions, I would appreciate a bit of guidance :)

@shruti862
Copy link
Contributor Author

Hey @LianaHarris360, I have implemented all the suggested changes and completed the changelog description in the PR template as well. Please let me know if there’s anything else that needs to be addressed.

@LianaHarris360 LianaHarris360 self-requested a review January 27, 2025 15:11
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Looks like there are still some issues w/ the variables @shruti862 - seems some of the variables removed are still referenced in the codebase.

Overall, the changes here are on the right track. The changelog LGTM as well. Thanks @shruti862

@shruti862
Copy link
Contributor Author

@nucleogenesis @LianaHarris360
For the css:

.ui-icon-button-focus-ring {
    background-color: darken($brand-primary-color, 12%);
}

I found three darken utilities: $darken1, $darken2 , and $darken3, but I'm unsure which one best matches darken($brand-primary-color, 12%).

Could you guide me on the best approach to determine the correct match? Is there a predefined scale for these variables, or should I compare them visually with the original color?

@@ -49,17 +48,14 @@ $ui-input-text-color--disabled: $disabled-text-color !default;
$ui-input-text-color--invalid: $md-red !default;
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this. It's not being used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for letting me know, I will surely remove this in my next commit.

@akolson
Copy link
Member

akolson commented Feb 3, 2025

Hi @shruti862. I have taken some time to review your changes. Great work! However I am unsure about a few things which could be down to my not understanding what needs to be done; My impression from Liana's explanation of the issue is that we should replace all usages of theme dependent scss variables with JS/Vue theme variables in KDS components only.

Wherever those SCSS variables are used in KDS components or styles, replace them with the corresponding JS/Vue theme variables.

That would mean that if the variable is not used in other areas in the codebase, then remove completely, otherwise leave as is. I also don't think the scope of these changes involves updating our KeenUI components themselves. If this is the case, then there's a few places where variables have been removed and yet still in use by Keenui components, for example. @LianaHarris360 could you please confirm if my understanding of this is correct?

@LianaHarris360
Copy link
Member

Originally, yes, that was the plan of action, but if there are places where variables that have been removed are still in use in Keen components, I think it does make sense to remove/replace them within this PR.

I do see instances within UiProgressLinear, UiButton, UiIconButton, and UiProgressCircular where they take a color prop and if that prop is "primary", $brand-primary-color is used in the css. In these cases, perhaps a computed property that returns the intended this.$themePalette.primary color should be used instead. I have not dug too deep into this solution for the Keen components and it might be complex to sort out, but if you have any doubts when implementing this, @shruti862, we can help with more guidance.

@shruti862
Copy link
Contributor Author

@nucleogenesis @LianaHarris360 For the css:

.ui-icon-button-focus-ring {
    background-color: darken($brand-primary-color, 12%);
}

I found three darken utilities: $darken1,$darken2, and $darken3, but I'm unsure which one best matches darken($brand-primary-color, 12%).

Could you guide me on the best approach to determine the correct match? Is there a predefined scale for these variables, or should I compare them visually with the original color?

Hey @LianaHarris360 , I’m currently stuck on this part and would really appreciate your help when you have a moment. Thanks!

@LianaHarris360
Copy link
Member

LianaHarris360 commented Feb 3, 2025

My apologies, I overlooked that comment accidentally. Based on the original percentage, I think $darken1 might be the best choice, although the original is a little darker, it's the closest match. Comparing it visually with the original color is a fine approach to me. When we re-review the pull request and test it in Kolibri, we will be able to confirm if there are any issues with the colors that need to be addressed :)
Screenshot 2025-02-03 at 12 24 27 PM

$ui-input-label-color--hover: black !default;
$ui-input-label-color--active: $brand-primary-color !default;
$ui-input-label-color--invalid: $md-red-800 !default;
Copy link
Member

Choose a reason for hiding this comment

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

^ should be replaced to use the KDS theme colors

$ui-input-border-color--hover: black !default;
$ui-input-border-color--active: $brand-primary-color !default;
$ui-input-border-color--invalid: $md-red !default;
$ui-input-border-width: 1px !default;
$ui-input-border-width--active: 1.5px !default;
$ui-input-border-style--disabled: dotted !default;

// Input icons
$ui-input-icon-color: $secondary-text-color !default;
Copy link
Member

Choose a reason for hiding this comment

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

^ can be removed as it not used anywhere

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

HI @shruti862! Thanks for the great work. I think we are moving in the right direction. Just a couple of things I picked up during my review;

  • $ui-input-text-color $ui-input-button-color $ui-input-button-color--hover need to be refactored as well
  • It would be helpful to pass styling themes as computed props rather than defining them inline. This would greatly improve readability and maintainability.

Thanks again, and be sure to let is know in case you have any questions or comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove theme-dependent SCSS variables: Remove variables within KDS files that rely on theming SCSS variables
5 participants