-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(angular): allow customizing avatar, icon and loading indicator f…
…rom CSS (#291) ### 🎯 Goal Allow customizing avatar, icon and loading indicator components from CSS. Corresponding GitHub issues: - #84 - #84 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](https://github.com/GetStream/stream-chat-css/assets/6690098/59f6dccf-25b9-4c61-95cc-36ddc31cc66a) #### Icon ![Screenshot 2024-04-23 at 17 23 40](https://github.com/GetStream/stream-chat-css/assets/6690098/bb9da2b0-5431-4e32-b7d5-f0f8a3392301) 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](https://fonts.google.com/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`](https://github.com/GetStream/stream-video-js/blob/main/packages/styling/src/Icon/Icon-theme.scss#L16) 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](https://github.com/GetStream/stream-chat-css/assets/6690098/2f89a466-cd53-466a-9ef6-688b11f26a23) 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](https://github.com/GetStream/stream-chat-css/assets/6690098/ae947f85-2670-48af-9023-ea2db7dcdf4a) ![Screenshot 2024-04-24 at 18 24 03](https://github.com/GetStream/stream-chat-css/assets/6690098/ecf29085-822c-457c-960c-eefa60d8c010) ![Screenshot 2024-04-24 at 18 24 10](https://github.com/GetStream/stream-chat-css/assets/6690098/e9a743c0-076a-4e5c-afc7-f76fb7270e68) ### 🎨 UI Changes No UI changes (hopefully 😅) Make sure to test with both Angular and React (with both `MessageList` and `VirtualizedMessageList` components) SDKs
- Loading branch information
Showing
35 changed files
with
504 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.