Web: Common: Added HOC withLayoutSize

This commit is contained in:
Alexey Kostenko 2020-11-17 06:29:24 +03:00
parent af8ce86d2d
commit 32e633cee9
2 changed files with 17 additions and 0 deletions

View File

@ -107,3 +107,5 @@ export function showLoader() {
document.body.classList.add("loading");
}, 1000);
}
export { withLayoutSize } from "./withLayoutSize";

View File

@ -0,0 +1,15 @@
import * as React from "react";
import { utils } from "asc-web-components";
const { Consumer } = utils.context;
export function withLayoutSize(Component) {
return function LayoutSizeComponent(props) {
return (
<Consumer>
{(context) => {
return <Component {...props} context={context} />;
}}
</Consumer>
);
};
}