From 354628802bda63808ace155efa3df7ad02734ecf Mon Sep 17 00:00:00 2001 From: martyanov-av Date: Mon, 26 Feb 2024 11:43:27 +0300 Subject: [PATCH] chore: lint --- src/components/Control/Control.tsx | 6 +- .../Controls/single-controls/LangControl.tsx | 1 - src/components/DocPage/DocPage.tsx | 88 +++++++++---------- .../controls/DislikeVariantsPopup.tsx | 6 +- .../Feedback/controls/SuccessPopup.tsx | 6 +- src/components/Subscribe/utils.ts | 12 ++- src/utils/index.ts | 11 ++- 7 files changed, 68 insertions(+), 62 deletions(-) diff --git a/src/components/Control/Control.tsx b/src/components/Control/Control.tsx index 659c388f..549ab2f0 100644 --- a/src/components/Control/Control.tsx +++ b/src/components/Control/Control.tsx @@ -5,7 +5,7 @@ import block from 'bem-cn-lite'; import {PopperPosition, usePopupState} from '../../hooks'; import {ControlSizes} from '../../models'; -import {getPopupPosition} from "../../utils"; +import {getPopupPosition} from '../../utils'; import './Control.scss'; @@ -65,8 +65,8 @@ const Control = forwardRef((props: ControlProps, ref) => { return popupPosition; } - return getPopupPosition(isVerticalView, direction) - }, [isVerticalView, popupPosition]); + return getPopupPosition(isVerticalView, direction); + }, [isVerticalView, popupPosition, direction]); useImperativeHandle(ref, () => controlRef.current, [controlRef]); diff --git a/src/components/Controls/single-controls/LangControl.tsx b/src/components/Controls/single-controls/LangControl.tsx index 300065c1..2193b263 100644 --- a/src/components/Controls/single-controls/LangControl.tsx +++ b/src/components/Controls/single-controls/LangControl.tsx @@ -11,7 +11,6 @@ import {getPopupPosition} from '../../../utils'; import {Control} from '../../Control'; import {ControlsLayoutContext} from '../ControlsLayout'; - import '../Controls.scss'; const ICONS: Record = { diff --git a/src/components/DocPage/DocPage.tsx b/src/components/DocPage/DocPage.tsx index 1c29859c..f4caf820 100644 --- a/src/components/DocPage/DocPage.tsx +++ b/src/components/DocPage/DocPage.tsx @@ -144,50 +144,50 @@ class DocPage extends React.Component { }; return ( - - - {this.renderSearchBar()} - {this.renderBreadcrumbs()} - {this.renderControls()} -
-
- {this.renderTitle()} - {this.renderPageContributors()} - {hideMiniToc ? null : this.renderContentMiniToc()} - {this.renderBody()} - {this.renderFeedback()} -
- {this.renderTocNavPanel()} -
- {this.renderLoader()} - {this.renderSinglePageControls()} -
- - {/* This key allows recalculating the offset for the mini-toc for Safari */} -
- {hideMiniToc ? null : this.renderAsideMiniToc()} -
-
-
+ + + {this.renderSearchBar()} + {this.renderBreadcrumbs()} + {this.renderControls()} +
+
+ {this.renderTitle()} + {this.renderPageContributors()} + {hideMiniToc ? null : this.renderContentMiniToc()} + {this.renderBody()} + {this.renderFeedback()} +
+ {this.renderTocNavPanel()} +
+ {this.renderLoader()} + {this.renderSinglePageControls()} +
+ + {/* This key allows recalculating the offset for the mini-toc for Safari */} +
+ {hideMiniToc ? null : this.renderAsideMiniToc()} +
+
+
); } diff --git a/src/components/Feedback/controls/DislikeVariantsPopup.tsx b/src/components/Feedback/controls/DislikeVariantsPopup.tsx index 156e074f..231e0a7f 100644 --- a/src/components/Feedback/controls/DislikeVariantsPopup.tsx +++ b/src/components/Feedback/controls/DislikeVariantsPopup.tsx @@ -15,7 +15,7 @@ import {Button, Checkbox, Popup, TextArea, useDirection} from '@gravity-ui/uikit import block from 'bem-cn-lite'; import {PopperPosition, useTranslation} from '../../../hooks'; -import {getPopupPosition} from "../../../utils"; +import {getPopupPosition} from '../../../utils'; import {ControlsLayoutContext} from '../../Controls/ControlsLayout'; import {FeedbackView} from '../Feedback'; @@ -136,11 +136,11 @@ const DislikeVariantsPopup: React.FC = memo( const position = useMemo(() => { if (!view || view === FeedbackView.Regular) { - return getPopupPosition(isVerticalView, direction) + return getPopupPosition(isVerticalView, direction); } return PopperPosition.RIGHT; - }, [isVerticalView, view]); + }, [isVerticalView, view, direction]); const feedbackComment = useRef | null>(null); const feedbackCheckboxes = useRef | null>(null); diff --git a/src/components/Feedback/controls/SuccessPopup.tsx b/src/components/Feedback/controls/SuccessPopup.tsx index 496cfab1..84b613f9 100644 --- a/src/components/Feedback/controls/SuccessPopup.tsx +++ b/src/components/Feedback/controls/SuccessPopup.tsx @@ -4,7 +4,7 @@ import {Popup, useDirection} from '@gravity-ui/uikit'; import block from 'bem-cn-lite'; import {PopperPosition, useTranslation} from '../../../hooks'; -import {getPopupPosition} from "../../../utils"; +import {getPopupPosition} from '../../../utils'; import {ControlsLayoutContext} from '../../Controls/ControlsLayout'; import {FeedbackView} from '../Feedback'; @@ -24,11 +24,11 @@ const SuccessPopup = memo(({visible, anchor, onOutsideClick, const position = useMemo(() => { if (!view || view === FeedbackView.Regular) { - return getPopupPosition(isVerticalView, direction) + return getPopupPosition(isVerticalView, direction); } return PopperPosition.RIGHT; - }, [isVerticalView, view]); + }, [isVerticalView, view, direction]); return ( { +export const getSubscribePopupPosition = ( + isVerticalView: boolean | undefined, + view?: SubscribeView, + direction?: ThemeContextProps['direction'], +) => { if (!view || view === SubscribeView.Regular) { - return getPopupPosition(isVerticalView, direction) + return getPopupPosition(isVerticalView, direction); } return PopperPosition.RIGHT; diff --git a/src/utils/index.ts b/src/utils/index.ts index 4ed70fb0..c95e0f75 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,8 +1,8 @@ import {parse} from 'url'; -import {ThemeContextProps} from "@gravity-ui/uikit"; +import {ThemeContextProps} from '@gravity-ui/uikit'; -import {PopperPosition} from "../hooks"; +import {PopperPosition} from '../hooks'; import {Contributor, Router} from '../models'; export type InnerProps, TDefaultProps> = Omit< @@ -87,8 +87,11 @@ export function isContributor(contributor: unknown): contributor is Contributor return false; } -export const getPopupPosition = (isVerticalView: boolean | undefined, direction?: ThemeContextProps['direction']) => { - if(isVerticalView && direction === 'rtl') { +export const getPopupPosition = ( + isVerticalView: boolean | undefined, + direction?: ThemeContextProps['direction'], +) => { + if (isVerticalView && direction === 'rtl') { return PopperPosition.RIGHT_START; }