Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Sep 12, 2023
1 parent 79b31e0 commit 6fef4b7
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 19 deletions.
3 changes: 3 additions & 0 deletions demo/src/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@gravity-ui/eslint-config/client"
}
3 changes: 2 additions & 1 deletion demo/src/Components/DocLeadingPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {useState} from 'react';

import {DEFAULT_SETTINGS, DocLeadingPage, DocLeadingPageData} from '@doc-tools/components';
import cn from 'bem-cn-lite';
import React, {useState} from 'react';

import getLangControl from '../../controls/lang';
import {getIsMobile} from '../../controls/settings';
Expand Down
6 changes: 3 additions & 3 deletions demo/src/Components/DocPage/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, {useCallback, useEffect, useState} from 'react';
import {join} from 'path';

import cn from 'bem-cn-lite';
import {configure as configureUikit} from '@gravity-ui/uikit';
import React, {useCallback, useEffect, useState} from 'react';

import {
DEFAULT_SETTINGS,
Expand All @@ -12,6 +10,8 @@ import {
Theme,
configure as configureDocs,
} from '@doc-tools/components';
import {configure as configureUikit} from '@gravity-ui/uikit';
import cn from 'bem-cn-lite';

import {getIsMobile} from '../../controls/settings';
import getVcsControl from '../../controls/vcs';
Expand Down
3 changes: 2 additions & 1 deletion demo/src/Components/ErrorPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import {ERROR_CODES, ErrorPage} from '@doc-tools/components';
import {radios, text} from '@storybook/addon-knobs';
import React from 'react';

import getLangControl from '../../controls/lang';
import {getIsMobile} from '../../controls/settings';
Expand Down
3 changes: 2 additions & 1 deletion demo/src/Components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

import {
ControlSizes,
DividerControl,
Expand All @@ -7,7 +9,6 @@ import {
} from '@doc-tools/components';
import {TextInput} from '@gravity-ui/uikit';
import cn from 'bem-cn-lite';
import React from 'react';

import './Header.scss';

Expand Down
3 changes: 2 additions & 1 deletion demo/src/Components/Paginator/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Paginator} from '@doc-tools/components';
import React, {useState} from 'react';

import {Paginator} from '@doc-tools/components';

const PaginatorDemo = () => {
const [page, setPage] = useState(1);

Expand Down
3 changes: 2 additions & 1 deletion demo/src/Components/SearchItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {SearchItem} from '@doc-tools/components';
import React from 'react';

import {SearchItem} from '@doc-tools/components';

import data from './page.json';

const SearchItemDemo = () => {
Expand Down
3 changes: 2 additions & 1 deletion demo/src/Components/SearchPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {ISearchItem, SearchPage} from '@doc-tools/components';
import React, {useState} from 'react';

import {ISearchItem, SearchPage} from '@doc-tools/components';

import getLangControl from '../../controls/lang';
import {getIsMobile} from '../../controls/settings';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "React components for drawing Diplodoc documentation",
"author": "YFM Team <[email protected]>",
"license": "MIT",
"version": "3.0.0-alpha-1",
"version": "3.0.0-alpha-4",
"repository": {
"type": "git",
"url": "[email protected]:yandex-cloud/docs-components.git"
Expand Down
2 changes: 0 additions & 2 deletions src/components/Controls/Controls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
}

@media (min-width: map-get($screenBreakpoints, 'md')) {
right: 0;

&_vertical {
flex-direction: column;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DocPage/DocPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

&__controls {
display: flex;
top: var(--dc-header-height, #{$headerHeight});
top: 0;
align-items: center;
height: 40px;
z-index: 102;
Expand Down
10 changes: 5 additions & 5 deletions src/components/TocNavPanel/TocNavPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ function getBoundingItems(flatToc: FlatTocItem[], router: Router) {
};
}

const TocNavControl = memo<{isNext?: boolean; item: FlatTocItem}>(({item, isNext}) => {
const TocNavControl = memo<{isNext?: boolean; item: FlatTocItem | null}>(({item, isNext}) => {
const {t} = useTranslation('toc-nav-panel');
const keyHint = isNext ? 'hint_next' : 'hint_previous';
const isExternal = isExternalHref(item.href);
const isExternal = item && isExternalHref(item.href);
const linkAttributes = {
href: item.href,
href: item?.href,
target: isExternal ? '_blank' : '_self',
rel: isExternal ? 'noopener noreferrer' : undefined,
};
Expand Down Expand Up @@ -99,8 +99,8 @@ const TocNavPanel = memo<TocNavPanelProps>(({items, router, fixed, className}) =
return (
<div className={b({fixed}, className)}>
<div className={b('content')}>
{prevItem && <TocNavControl item={prevItem} />}
{nextItem && <TocNavControl item={nextItem} isNext={true} />}
{<TocNavControl item={prevItem} />}
{<TocNavControl item={nextItem} isNext={true} />}
</div>
</div>
);
Expand Down
7 changes: 7 additions & 0 deletions src/internal-typings/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
declare module 'url' {
export const parse: (href: string) => {
hash?: string;
pathname?: string;
};
}

declare module '*.svg' {
const content: SVGIconData;

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"module": "ESNext",
"target": "ES2017",
"outDir": "build/cjs",
"outDir": "build/esm",
},
"include": ["src/**/*.ts", "src/**/*.tsx"]
}

0 comments on commit 6fef4b7

Please sign in to comment.