2021-04-29 09:24:39 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { ThemeProvider } from '@material-ui/core/styles';
|
|
|
|
import * as React from 'react';
|
|
|
|
|
2021-11-15 08:37:54 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
|
|
|
|
2021-04-29 09:24:39 +00:00
|
|
|
import BaseTheme from './BaseTheme';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
2021-11-15 08:37:54 +00:00
|
|
|
/**
|
|
|
|
* The default theme or theme set through advanced branding.
|
|
|
|
*/
|
|
|
|
_theme: Object,
|
|
|
|
|
2021-04-29 09:24:39 +00:00
|
|
|
/**
|
|
|
|
* The children of the component.
|
|
|
|
*/
|
|
|
|
children: React.ChildrenArray<any>
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The theme provider for the web app.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The props of the component.
|
|
|
|
* @returns {React.ReactNode}
|
|
|
|
*/
|
2021-11-15 08:37:54 +00:00
|
|
|
function JitsiThemeProvider(props: Props) {
|
|
|
|
return <ThemeProvider theme = { props._theme }>{ props.children }</ThemeProvider>;
|
2021-04-29 09:24:39 +00:00
|
|
|
}
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @returns {Props}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
const { muiBrandedTheme } = state['features/dynamic-branding'];
|
|
|
|
|
|
|
|
return {
|
|
|
|
_theme: muiBrandedTheme || BaseTheme
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(_mapStateToProps)(JitsiThemeProvider);
|