diff --git a/src/components/Toc/Toc.tsx b/src/components/Toc/Toc.tsx index 05d2979b..00bad260 100644 --- a/src/components/Toc/Toc.tsx +++ b/src/components/Toc/Toc.tsx @@ -2,9 +2,7 @@ import React from 'react'; import block from 'bem-cn-lite'; import {omit} from 'lodash'; -import {WithTranslation} from 'react-i18next'; -import {withTranslation} from '../../hoc/withTranslation'; import {PopperPosition} from '../../hooks'; import {ControlSizes, Router, TocData, TocItem} from '../../models'; import {isActiveItem, normalizeHash, normalizePath} from '../../utils'; @@ -23,7 +21,7 @@ function zip(array: string[], fill: T): Record { return array.reduce((acc, item) => Object.assign(acc, {[item]: fill}), {}); } -export interface TocProps extends TocData, WithTranslation { +export interface TocProps extends TocData { router: Router; headerHeight?: number; tocTitleIcon?: React.ReactNode; @@ -155,7 +153,7 @@ class Toc extends React.Component { private renderList = (items: TocItem[]) => { const {toggleItem} = this; - const {singlePage, t} = this.props; + const {singlePage, title} = this.props; const {activeId, fixedById} = this.state; const activeItem = activeId && this.state.registry.getItemById(activeId); @@ -164,7 +162,7 @@ class Toc extends React.Component { : {}; return ( -
    +
      {items.map((item, index) => { const main = !this.state.registry.getParentId(item.id); const active = @@ -338,4 +336,4 @@ class Toc extends React.Component { }; } -export default withTranslation('toc')(Toc); +export default Toc; diff --git a/src/hoc/withTranslation.ts b/src/hoc/withTranslation.ts deleted file mode 100644 index 18de5f93..00000000 --- a/src/hoc/withTranslation.ts +++ /dev/null @@ -1,9 +0,0 @@ -import {withTranslation as withTranslationReacti18n} from 'react-i18next'; - -import {configure} from '../config'; - -export function withTranslation(namespace: string) { - configure(); - - return withTranslationReacti18n(namespace); -}