19 lines
626 B
JavaScript
19 lines
626 B
JavaScript
import * as React from 'react';
|
|
import { useCustomizationSettings } from '@fluentui/utilities';
|
|
import { createTheme } from '@fluentui/theme';
|
|
import { ThemeContext } from './ThemeContext';
|
|
/**
|
|
* Get theme from CustomizerContext or Customizations singleton.
|
|
*/
|
|
function useCompatTheme() {
|
|
return useCustomizationSettings(['theme']).theme;
|
|
}
|
|
/**
|
|
* React hook for programmatically accessing the theme.
|
|
*/
|
|
export var useTheme = function () {
|
|
var theme = React.useContext(ThemeContext);
|
|
var legacyTheme = useCompatTheme();
|
|
return theme || legacyTheme || createTheme({});
|
|
};
|
|
//# sourceMappingURL=useTheme.js.map
|