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

feat(angular): allow customizing avatar, icon and loading indicator from CSS #291

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

szuperaz
Copy link
Collaborator

@szuperaz szuperaz commented Apr 19, 2024

🎯 Goal

Allow customizing avatar, icon and loading indicator components from CSS.

Corresponding GitHub issues:

It's only implemented for Angular, React can follow at it's own pace

🛠 Implementation details

This is a non-breaking change, the old CSS code remains, and can be used by React and Angular@4.

Avatar

The --str-chat__avatar-size variable allows customizing the avatar size

Screenshot 2024-04-23 at 17 13 29

Icon

Screenshot 2024-04-23 at 17 23 40

Why use fonts for icons? I generated a custom font from the icons we use in chat UI components, there is one downside that I hate: the font needs to be manually regenerated when we want to add a new icon (which is not that often). However, as far as I know fonts provide the best flexibility for setting size and color properties of icons. It's also used by big libraries such as Google Material Icons so our integrators are probably familiar with the concept.

As a comparison: in video the icons are also customizable from CSS, but we use mask-image with encoded SVGs, the downside of that solution is that we have to explicitly provide both height and width, which causes problems if an integrator wants to use an icon with a different aspect-ratio than the built-in icon.

Loading indicator

The --str-chat__loading-indicator-size allows setting avatar size from CSS

Screenshot 2024-04-24 at 18 15 00

I wasn't able to move the loading indicator SVG to CSS, I had troubles applying the color from the CSS variable to the stop color 🤷‍♀️

For the curious, here is the Angular upgrade guide with the breaking changes:
Screenshot 2024-04-24 at 18 23 45

Screenshot 2024-04-24 at 18 24 03

Screenshot 2024-04-24 at 18 24 10

🎨 UI Changes

No UI changes (hopefully 😅)

Make sure to test with both Angular and React (with both MessageList and VirtualizedMessageList components) SDKs

@szuperaz szuperaz changed the title feat(angular): allow avatar size customization from CSS feat(angular): allow customizing avatar, icon and loading indicator from CSS Apr 23, 2024

<SDKSpecific name="react">

TODO
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I want to link the part of the React docs that show how to use custom icons, where can I find that?

}
}

// File type icons
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

File type icons are different from other icons because they contain more than one color, so we can't use them as font, instead we use the encoded SVG images

@szuperaz szuperaz marked this pull request as ready for review April 25, 2024 12:37
@szuperaz szuperaz merged commit b4d1658 into main Apr 25, 2024
@szuperaz szuperaz deleted the avatar-and-icon-size branch April 25, 2024 13:59
github-actions bot pushed a commit that referenced this pull request Apr 25, 2024
# [4.15.0](v4.14.0...v4.15.0) (2024-04-25)

### Bug Fixes

* remove unnecessary selector specificity from font-family setting ([#292](#292)) ([04e110d](04e110d))

### Features

* **angular:** allow customizing avatar, icon and loading indicator from CSS ([#291](#291)) ([b4d1658](b4d1658)), closes [/github.com/GetStream/stream-video-js/blob/main/packages/styling/src/Icon/Icon-theme.scss#L16](https://github.com//github.com/GetStream/stream-video-js/blob/main/packages/styling/src/Icon/Icon-theme.scss/issues/L16)
Copy link

🎉 This PR is included in version 4.15.0 🎉

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.

2 participants