Skip to content

Commit

Permalink
Merge pull request #26060 from JKobrynski/migrateThemeStylesProviderT…
Browse files Browse the repository at this point in the history
…oTypeScript

[No QA] [TS Migration] Migrate ThemeStylesProvider component to TypeScript
  • Loading branch information
roryabraham authored Sep 12, 2023
2 parents fed156a + 58ddcf1 commit 86f8720
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, {useMemo} from 'react';
import PropTypes from 'prop-types';
import useTheme from './themes/useTheme';
import StylesContext from './ThemeStylesContext';
import defaultStyles from './styles';

const propTypes = {
/** Rendered child component */
children: PropTypes.node.isRequired,
type ThemeStylesProviderProps = {
children: React.ReactNode;
};

function ThemeStylesProvider(props) {
function ThemeStylesProvider({children}: ThemeStylesProviderProps) {
const theme = useTheme();

const appContentStyle = useMemo(
Expand All @@ -29,9 +27,9 @@ function ThemeStylesProvider(props) {
[appContentStyle],
);

return <StylesContext.Provider value={styles}>{props.children}</StylesContext.Provider>;
return <StylesContext.Provider value={styles}>{children}</StylesContext.Provider>;
}
ThemeStylesProvider.propTypes = propTypes;

ThemeStylesProvider.displayName = 'ThemeStylesProvider';

export default ThemeStylesProvider;

0 comments on commit 86f8720

Please sign in to comment.