Skip to content

Commit e7cf156

Browse files
committed
fix(app): popover scroll container position
#162
1 parent afcc7bb commit e7cf156

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/app/hocs/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import withApollo from "./with-apollo";
22
import withRouter from "./with-router";
3+
import withAntd from "./with-antd";
34

45
/**
56
* @hoc Инициализирующая логика приложения
67
* FIXME: Потом какой-нибудь `compose` метод заинсталлим откуда-нить и покрасивше будет
78
*/
8-
export const withHocs = (component: Component) => withRouter(withApollo(component));
9+
export const withHocs = (component: Component) => withAntd(withRouter(withApollo(component)));

src/app/hocs/with-antd.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
import { ConfigProvider } from "antd";
3+
4+
// eslint-disable-next-line max-len
5+
// https://ant.design/docs/react/faq#How-do-I-prevent-Select-Dropdown-DatePicker-TimePicker-Popover-Popconfirm-scrolling-with-the-page
6+
7+
/**
8+
* @hoc Инициализация antd для корректного использования компонентов
9+
* @remark Для попапов в системе - возвращаем parentElement (для фикса бага) или document.body (defaultValue)
10+
* @see https://github.com/ani-team/github-client/issues/162#issuecomment-736676022
11+
*/
12+
const withAntd = (component: Component) => () => (
13+
<ConfigProvider getPopupContainer={({ parentElement }) => parentElement || document.body}>
14+
{component()}
15+
</ConfigProvider>
16+
);
17+
18+
export default withAntd;

0 commit comments

Comments
 (0)