From 32e633cee976e91456a9486c259ebd80b746594c Mon Sep 17 00:00:00 2001 From: Alexey Kostenko Date: Tue, 17 Nov 2020 06:29:24 +0300 Subject: [PATCH] Web: Common: Added HOC withLayoutSize --- web/ASC.Web.Common/src/utils/index.js | 2 ++ web/ASC.Web.Common/src/utils/withLayoutSize.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 web/ASC.Web.Common/src/utils/withLayoutSize.js diff --git a/web/ASC.Web.Common/src/utils/index.js b/web/ASC.Web.Common/src/utils/index.js index e7eafe4697..5e287d558f 100644 --- a/web/ASC.Web.Common/src/utils/index.js +++ b/web/ASC.Web.Common/src/utils/index.js @@ -107,3 +107,5 @@ export function showLoader() { document.body.classList.add("loading"); }, 1000); } + +export { withLayoutSize } from "./withLayoutSize"; diff --git a/web/ASC.Web.Common/src/utils/withLayoutSize.js b/web/ASC.Web.Common/src/utils/withLayoutSize.js new file mode 100644 index 0000000000..3f4ad8e987 --- /dev/null +++ b/web/ASC.Web.Common/src/utils/withLayoutSize.js @@ -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 ( + + {(context) => { + return ; + }} + + ); + }; +}