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(ui-library): add hover state to the icon and password icon in pas… #295

Merged
merged 8 commits into from
Aug 18, 2023

Conversation

DenizSaganak
Copy link
Contributor

Copy link
Contributor

@davidken91 davidken91 left a comment

Choose a reason for hiding this comment

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

Just a few small things I noticed:

  • In forms.css.js, on line 32, could we change the border colour to use the Hover state? I think it will remain the same colour but at least we have the ability to change the hover colour if or when the tokens change
  • I think we need to add different styles for the states for the password icon. For example hover, readonly, disabled etc...
  • We need to style the password eye icon so that it gets a darker shade of grey when the input field is hovered. You can do this using the sibling selector in CSS (use the + symbol). This might be a little tedious to get the right syntax for scss but give it a try and reach out to me if you have any issues

Copy link
Contributor

@davidken91 davidken91 left a comment

Choose a reason for hiding this comment

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

On line 50 of forms.css.js, after the :hover rules, you can add something like this to modify a sibling element:
&:hover + .blr-input-icon { color: ${InputIcon.Hover}; }
Then on line 190 you can add a second hover state so that the icon will remain in that hover state when the cursor switches from the text input field to the icon:
&:hover { color: ${InputIcon.Hover}; }
However, starting from line 220, you will have some conflicts that will undo the hover states that you added. You may need to refactor this or remove it entirely. I don't think you will need a hover state when it is disabled or readonly, so you may need to add a rule similar to this:
&:not(:disabled, [readonly]) {
Take a look at the checkbox or radio css files for more details on how to implement it

@DenizSaganak
Copy link
Contributor Author

With the latest push,

  • Icon color changes when hovered over input field
  • When disabled, icon color stays the same
  • When readOnly, icon disappears
  • When hovered over the icon, cursor becomes pointer
  • In disable and readOnly states, pointerEvents are disabled

@@ -208,6 +217,12 @@ export const { tokenizedLight: formLight, tokenizedDark: formDark } = renderThem
right: ${Select.LG.IconPaddingRight};
}
}

&:hover {
& input:not(:disabled) + .blr-input-icon {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is a little messy, but we need one more condition to check that no error is present. Otherwise the hover state will be applied to when there is an error
I think this will resolve it:
& input:not(:disabled, .error) + .blr-input-icon {

Copy link
Contributor

@davidken91 davidken91 left a comment

Choose a reason for hiding this comment

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

I noticed that the values coming back from the tokens for the input container are causing a minor issue. I think we need to change the css from 'padding-bottom' to simply 'padding'. It should be on lines 197, 206 and 215

Copy link
Contributor

@davidken91 davidken91 left a comment

Choose a reason for hiding this comment

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

One last thing (it's not hugely important), but can we add a 'cursor: not-allowed;' on line 84? We use this on other components when the state is disabled and it's a nice visual reminder to the user that they can't interact with it

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

Successfully merging this pull request may close these issues.

4 participants