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

[DSS-157] Avatar - Custom Icon and Color #1605

Merged
merged 10 commits into from
Oct 14, 2022
Merged

Conversation

anechol
Copy link
Contributor

@anechol anechol commented Sep 29, 2022

Description

Adds props to allow for background and foreground (icon stroke/fill) color for badges. Attempting to provide a backwards compatible solution to not disturb what's already been used in kp.

Screenshots

Screen Shot 2022-10-06 at 10 18 11 AM

Screen.Recording.2022-10-14.at.10.21.02.AM.mov

Testing in sage-lib

Rails

  • View Avatar in Rails and React
  • Check that new props work as expected

Testing in kajabi-products

(LOW) Adds props to allow for background and foreground (icon stroke/fill) color for badges.

Related

DSS-157

@anechol anechol added the improvement Improve on existing work label Sep 29, 2022
@anechol anechol self-assigned this Sep 29, 2022
@anechol anechol force-pushed the DSS-157/ae-custom-color-icon branch from e7799b7 to f1cf205 Compare October 5, 2022 15:13
@anechol anechol requested review from a team October 6, 2022 15:24
@anechol anechol marked this pull request as ready for review October 6, 2022 15:24
Copy link
Contributor

@philschanely philschanely left a comment

Choose a reason for hiding this comment

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

Looks great!

Not blocking, but what do you think about restructuring so that rather than badge, badgeColor, and badgeIcon we just have badge but it can accept just true (for default badge) or a hash/object with optional icon and color properties for encapsulating the custom settings?

Copy link
Member

@pixelflips pixelflips left a comment

Choose a reason for hiding this comment

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

I can't quite work out if it's a Storybook issue or not, but when I set the badge to true and adjust the badge color and icon, it changes the icon color and not the background color.

Happy to pair if it's not obvious.

Screen Shot 2022-10-06 at 8 34 37 AM

Copy link
Member

@teenwolfblitzer teenwolfblitzer left a comment

Choose a reason for hiding this comment

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

👍 LGTM, with one note for the badge appearance:

Requirements for the issue are unclear on this, but the Figma mocks are displaying various social media logo badges with varying background color fills.

The issue that @pixelflips is seeing is because the icon examples in Rails are using -filled variants. If the intent will be to allow the badge_color to affect the background, then we'll have to ask Design to add those versions of the icons as well. Otherwise, it's working as intended.

@anechol
Copy link
Contributor Author

anechol commented Oct 6, 2022

@pixelflips @monkeypox8 Thanks for the feedback here. I just spoke to Quinton about this issue and yes, it looks like this is going to have to be brought up to design. Filled icons are working as intended, but those with only strokes are going to look awkward. Going to bring this up in the team sync for ideas.

@anechol anechol marked this pull request as draft October 7, 2022 18:30
@anechol
Copy link
Contributor Author

anechol commented Oct 7, 2022

Per feedback from the team and design, I'll be implementing a solution for both a foreground (icon stroke/fill) and background color.

@anechol anechol marked this pull request as ready for review October 12, 2022 15:44
@anechol anechol requested review from a team, pixelflips, teenwolfblitzer, ju-Skinner and philschanely and removed request for teenwolfblitzer, pixelflips and ju-Skinner October 12, 2022 15:45
@anechol anechol removed the request for review from philschanely October 12, 2022 15:45
Copy link
Member

@pixelflips pixelflips left a comment

Choose a reason for hiding this comment

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

Code looks great, but I am seeing an issue with Storybook. When setting Badge to true and then trying to add a string for the badgeBackgroundColor the screen goes blank and an error shows in the console.

Screen.Recording.2022-10-12.at.9.02.01.AM.mov

@anechol
Copy link
Contributor Author

anechol commented Oct 12, 2022

Code looks great, but I am seeing an issue with Storybook. When setting Badge to true and then trying to add a string for the badgeBackgroundColor the screen goes blank and an error shows in the console.

Screen.Recording.2022-10-12.at.9.02.01.AM.mov

Yeah @pixelflips this is a weird issue, and I think it's Storybook related, but can't confirm entirely. If you set the background color first and then set badge to true, then it works as inspected.

Copy link
Member

@pixelflips pixelflips left a comment

Choose a reason for hiding this comment

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

While continuing to review and changing up the controls, also noticed that the icons seem to break out in some cases. Will drop a screenshot so you can see the controls.

Screen Shot 2022-10-12 at 10 16 19 AM

@pixelflips
Copy link
Member

Yeah @pixelflips this is a weird issue, and I think it's Storybook related, but can't confirm entirely. If you set the background color first and then set badge to true, then it works as inspected.

@anechol it is weird for sure, maybe @ju-Skinner or @philschanely have thoughts on the error I mentioned above. 🤞🏼

@teenwolfblitzer
Copy link
Member

teenwolfblitzer commented Oct 12, 2022

Yeah @pixelflips this is a weird issue, and I think it's Storybook related, but can't confirm entirely. If you set the background color first and then set badge to true, then it works as inspected.

Haven't had a chance to dig into it, but best I can tell is that the style conditional rendering the CSS var in the component is causing the issue.

@anechol
Copy link
Contributor Author

anechol commented Oct 12, 2022

@monkeypox8 Thanks for the pointer. I adjusted the conditional so this should work fine in storybook now.

@anechol anechol requested a review from pixelflips October 12, 2022 21:33
@anechol
Copy link
Contributor Author

anechol commented Oct 12, 2022

While continuing to review and changing up the controls, also noticed that the icons seem to break out in some cases. Will drop a screenshot so you can see the controls.

Screen Shot 2022-10-12 at 10 16 19 AM

Ahh thanks for pointing this out @pixelflips . I might have to look into this further as I'm not sure what's a good solution to handle every use case for every icon in the library 🤔

Copy link
Member

@teenwolfblitzer teenwolfblitzer left a comment

Choose a reason for hiding this comment

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

👍 LGTM! Left a note on one cleanup item to consider.

<div className="sage-avatar__badge">
<div
className={badgeClassnames}
style={({
Copy link
Member

Choose a reason for hiding this comment

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

(non-blocking) You can also drop the enclosing parentheses () here now that the conditional has been removed.

@teenwolfblitzer
Copy link
Member

teenwolfblitzer commented Oct 12, 2022

I might have to look into this further as I'm not sure what's a good solution to handle every use case for every icon in the library 🤔

Agreed; this is going to be pretty difficult to solve without a change to our icon system sizing, so I'm inclined to suggest we leave it for another day if the group's on board. Right now the use case for custom badges is limited. But if it does become an issue, we could always apply a 90% scale transform or something similar, though it'd have to be across the board.

Copy link
Collaborator

@ju-Skinner ju-Skinner left a comment

Choose a reason for hiding this comment

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

great job. Thanks for adding specs.

@anechol anechol requested a review from cameronsimony October 14, 2022 16:24
Copy link

@cameronsimony cameronsimony left a comment

Choose a reason for hiding this comment

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

👍 👍

@anechol anechol merged commit 8037987 into develop Oct 14, 2022
@anechol anechol deleted the DSS-157/ae-custom-color-icon branch October 14, 2022 16:25
@anechol anechol mentioned this pull request Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improve on existing work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants