Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey committed Feb 26, 2024
1 parent 5c00166 commit 3546288
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 62 deletions.
6 changes: 3 additions & 3 deletions src/components/Control/Control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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]);

Expand Down
1 change: 0 additions & 1 deletion src/components/Controls/single-controls/LangControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {getPopupPosition} from '../../../utils';
import {Control} from '../../Control';
import {ControlsLayoutContext} from '../ControlsLayout';


import '../Controls.scss';

const ICONS: Record<string, string> = {
Expand Down
88 changes: 44 additions & 44 deletions src/components/DocPage/DocPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,50 +144,50 @@ class DocPage extends React.Component<DocPageInnerProps, DocPageState> {
};

return (
<DocLayout
toc={toc}
router={router}
headerHeight={headerHeight}
className={b(modes)}
fullScreen={fullScreen}
hideRight={hideMiniToc}
tocTitleIcon={tocTitleIcon}
wideFormat={wideFormat}
hideTocHeader={hideTocHeader}
hideToc={hideToc}
loading={this.state.loading}
footer={footer}
singlePage={singlePage}
onChangeSinglePage={onChangeSinglePage}
pdfLink={pdfLink}
>
<DocLayout.Center>
{this.renderSearchBar()}
{this.renderBreadcrumbs()}
{this.renderControls()}
<div className={b('main')}>
<main className={b('content')}>
{this.renderTitle()}
{this.renderPageContributors()}
{hideMiniToc ? null : this.renderContentMiniToc()}
{this.renderBody()}
{this.renderFeedback()}
</main>
{this.renderTocNavPanel()}
</div>
{this.renderLoader()}
{this.renderSinglePageControls()}
</DocLayout.Center>
<DocLayout.Right>
{/* This key allows recalculating the offset for the mini-toc for Safari */}
<div
className={b('aside')}
key={getStateKey(this.showMiniToc, wideFormat, singlePage)}
>
{hideMiniToc ? null : this.renderAsideMiniToc()}
</div>
</DocLayout.Right>
</DocLayout>
<DocLayout
toc={toc}
router={router}
headerHeight={headerHeight}
className={b(modes)}
fullScreen={fullScreen}
hideRight={hideMiniToc}
tocTitleIcon={tocTitleIcon}
wideFormat={wideFormat}
hideTocHeader={hideTocHeader}
hideToc={hideToc}
loading={this.state.loading}
footer={footer}
singlePage={singlePage}
onChangeSinglePage={onChangeSinglePage}
pdfLink={pdfLink}
>
<DocLayout.Center>
{this.renderSearchBar()}
{this.renderBreadcrumbs()}
{this.renderControls()}
<div className={b('main')}>
<main className={b('content')}>
{this.renderTitle()}
{this.renderPageContributors()}
{hideMiniToc ? null : this.renderContentMiniToc()}
{this.renderBody()}
{this.renderFeedback()}
</main>
{this.renderTocNavPanel()}
</div>
{this.renderLoader()}
{this.renderSinglePageControls()}
</DocLayout.Center>
<DocLayout.Right>
{/* This key allows recalculating the offset for the mini-toc for Safari */}
<div
className={b('aside')}
key={getStateKey(this.showMiniToc, wideFormat, singlePage)}
>
{hideMiniToc ? null : this.renderAsideMiniToc()}
</div>
</DocLayout.Right>
</DocLayout>
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/Feedback/controls/DislikeVariantsPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -136,11 +136,11 @@ const DislikeVariantsPopup: React.FC<DislikeVariantsPopupProps> = 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<FormPart<string> | null>(null);
const feedbackCheckboxes = useRef<FormPart<string[]> | null>(null);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Feedback/controls/SuccessPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -24,11 +24,11 @@ const SuccessPopup = memo<SuccessPopupProps>(({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 (
<Popup
Expand Down
12 changes: 8 additions & 4 deletions src/components/Subscribe/utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {ThemeContextProps} from "@gravity-ui/uikit";
import {ThemeContextProps} from '@gravity-ui/uikit';

import {PopperPosition} from '../../hooks';
import {getPopupPosition} from "../../utils";
import {getPopupPosition} from '../../utils';

import {SubscribeView} from './Subscribe';

export const getSubscribePopupPosition = (isVerticalView: boolean | undefined, view?: SubscribeView, direction?: ThemeContextProps['direction']) => {
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;
Expand Down
11 changes: 7 additions & 4 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -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<TProps extends Partial<TDefaultProps>, TDefaultProps> = Omit<
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 3546288

Please sign in to comment.