aws / amazon-chime-sdk-component-library-react

Amazon Chime React Component Library with integrations with the Amazon Chime SDK.
Apache License 2.0
268 stars 161 forks source link

More Flexible SDK Components #196

Open shanepadgett opened 4 years ago

shanepadgett commented 4 years ago

Currently we are using this library for the hooks and providers -- they have been an immense help to interface with the SDK. We have reviewed the SDK components provided by this library and, while they provide all of the functionality we require, we cannot use them due to the UI styling. We have our own internal design system and there is no simple way to just inject classes into your UI components to make them fit into our design language. So currently we are replicating all of the functionality provided by your SDK components and using our own UI components. We are also required to install styled-components as a peer dependency to use this library, which is something we would prefer to not do if possible.

Anything you can do to make this library more flexible in how it handles UI components would be greatly appreciated.

Some of the SDK components we currently copy the logic from: MicSelection, CameraSelection, LocalVideo, RemoteVideo, VideoPreview

nicklera1 commented 4 years ago

Thank you @shanepadgett for a great feedback, we will definitely look into designing our components to be more flexible.

p-foucht commented 4 years ago

Hey @shanepadgett -- we're thinking about ways to address this, and have two main options. Let me know if you have any feedback, or alternative suggestions

  1. More/better hooks - Building out more hooks so that developers can more easily build out their own UI

Example - a useLocalVideoElement hook that handles the binding and active state of the local video. You render whatever you want, and the hooks will try to handle as much of the SDK integration as they can

This would allow you to remove the StyledComponents dependency, but there will be more work/effort in handling all the hooks yourself as opposed to just dropping in a <LocalVideo /> component

  1. Component injection - Allow a component to be passed through props that the SDK components will use for rendering

Example - <LocalVideo component={CustomVideoEl} />

The LocalVideo will render the video element as CustomVideoEl, and it will need to make sure to use the props pass correctly (such as setting the ref)

This would not get rid of the StyledComponents dependency though, since the default component would still be the styled component. Developers would need to make sure they're handling the passed props to their custom component properly

Other alternatives

Example - <LocalVIdeo component={VideoTile} /> and <LocalVideo component={CustomVideo} />

wootsbot commented 4 years ago

@p-foucht I really value the ease that reach-ui provides to override the style.

It could generate a discussion on the subject could be more ideas.

p-foucht commented 3 years ago

Closing due to inactivity

vidya-mohan commented 3 years ago

Reactivating as this is still an issue

prashanthacharyam commented 3 years ago

@p-foucht i would prefer approach 1. Library to provide hooks and using that to manage the UI. We also have the same issue where we are replicating the components to use with our own UI.

CodySchaaf commented 1 year ago

I would consider how MUI https://github.com/mui/material-ui accomplishes this. All of their components are 100% customizable. This is usually accomplished by top level theming, passing in override components, or targeting exposed selectors.