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

Remove size and color attributes from SDK components #84

Open
szuperaz opened this issue May 10, 2022 · 1 comment
Open

Remove size and color attributes from SDK components #84

szuperaz opened this issue May 10, 2022 · 1 comment
Labels
enhancement New feature or request theming-v2

Comments

@szuperaz
Copy link
Collaborator

szuperaz commented May 10, 2022

This is a breaking change inside SDKs. Affected components:

  • Avatar
  • LoadingIndicator
  • Icons
@szuperaz szuperaz added the enhancement New feature or request label Jun 16, 2022
@szuperaz szuperaz changed the title Avatar sizing Remove size and color attributes from SDK components Jul 8, 2022
szuperaz added a commit that referenced this issue Apr 25, 2024
…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
@szuperaz szuperaz reopened this Apr 26, 2024
@szuperaz
Copy link
Collaborator Author

Release in stream-chat-angular@5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request theming-v2
Projects
None yet
Development

No branches or pull requests

1 participant