Skip to content

Commit 339bbb4

Browse files
committed
fix: remove withThemeValueContext
1 parent dee1176 commit 339bbb4

File tree

4 files changed

+7
-35
lines changed

4 files changed

+7
-35
lines changed

src/containers/PageConstructor/PageConstructor.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useMemo} from 'react';
1+
import React, {useContext, useMemo} from 'react';
22
import _ from 'lodash';
33

44
import {
@@ -20,9 +20,9 @@ import {
2020
getThemedValue,
2121
getCustomItems,
2222
} from '../../utils';
23-
import {withThemeValue, WithThemeValueProps} from '../../context/theme/withThemeValue';
2423
import {AnimateContext} from '../../context/animateContext';
2524
import {InnerContext} from '../../context/innerContext';
25+
import {ThemeValueContext} from '../../context/theme/ThemeValueContext';
2626
import {ConstructorRow} from './components/ConstructorRow';
2727
import {ConstructorFootnotes} from './components/ConstructorFootnotes';
2828
import {ConstructorHeader} from './components/ConstructorItem';
@@ -40,9 +40,7 @@ export interface PageConstructorProps {
4040
renderMenu?: () => React.ReactNode;
4141
}
4242

43-
type Props = PageConstructorProps & WithThemeValueProps;
44-
45-
export const Constructor = (props: Props) => {
43+
export const Constructor = (props: PageConstructorProps) => {
4644
const {context, headerBlockTypes} = useMemo(
4745
() => ({
4846
context: {
@@ -59,10 +57,10 @@ export const Constructor = (props: Props) => {
5957
[props.custom],
6058
);
6159

60+
const {themeValue: theme} = useContext(ThemeValueContext);
6261
const {
6362
content: {blocks = [], background = {}, footnotes = []} = {},
6463
renderMenu,
65-
themeValue: theme,
6664
shouldRenderBlock,
6765
} = props;
6866

@@ -100,14 +98,12 @@ export const Constructor = (props: Props) => {
10098
);
10199
};
102100

103-
const ThemedConstructor = withThemeValue(Constructor);
104-
105101
export const PageConstructor = (props: PageConstructorProps) => {
106102
const {content: {animated = true} = {}, ...rest} = props;
107103

108104
return (
109105
<AnimateContext.Provider value={{animated}}>
110-
<ThemedConstructor content={props.content} {...rest} />
106+
<Constructor content={props.content} {...rest} />
111107
</AnimateContext.Provider>
112108
);
113109
};

src/context/locationContext/locationContext.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import {RouterLinkProps} from '../../components/RouterLink/RouterLink';
3+
import {WithChildren} from '../../models';
34

45
export interface History {
56
action: 'PUSH' | 'POP' | 'REPLACE' | '';
@@ -15,7 +16,7 @@ export interface History {
1516

1617
export type RouterLink =
1718
| React.ComponentClass<RouterLinkProps>
18-
| React.FunctionComponent<RouterLinkProps>;
19+
| React.FC<WithChildren<RouterLinkProps>>;
1920

2021
export type LocationContextProps = {
2122
history?: History;

src/context/theme/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
export * from './ThemeContext';
22
export * from './ThemeProvider';
33
export * from './useTheme';
4-
export * from './useThemeValue';
54
export * from './withTheme';
6-
export * from './withThemeValue';

src/context/theme/withThemeValue.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)