Skip to content

Commit

Permalink
migrate ThemeStylesProvider to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
JKobrynski committed Aug 28, 2023
1 parent 3948600 commit 58ddcf1
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 58ddcf1

Please sign in to comment.