You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

JitsiThemeProvider.web.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // @flow
  2. import { ThemeProvider } from '@material-ui/core/styles';
  3. import * as React from 'react';
  4. import { connect } from '../../../base/redux';
  5. import BaseTheme from './BaseTheme';
  6. type Props = {
  7. /**
  8. * The default theme or theme set through advanced branding.
  9. */
  10. _theme: Object,
  11. /**
  12. * The children of the component.
  13. */
  14. children: React.ChildrenArray<any>
  15. }
  16. /**
  17. * The theme provider for the web app.
  18. *
  19. * @param {Object} props - The props of the component.
  20. * @returns {React.ReactNode}
  21. */
  22. function JitsiThemeProvider(props: Props) {
  23. return <ThemeProvider theme = { props._theme }>{ props.children }</ThemeProvider>;
  24. }
  25. /**
  26. * Maps part of the Redux state to the props of this component.
  27. *
  28. * @param {Object} state - The Redux state.
  29. * @returns {Props}
  30. */
  31. function _mapStateToProps(state) {
  32. const { muiBrandedTheme } = state['features/dynamic-branding'];
  33. return {
  34. _theme: muiBrandedTheme || BaseTheme
  35. };
  36. }
  37. export default connect(_mapStateToProps)(JitsiThemeProvider);