diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-04-29 12:13:34 +0200 | 
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-04-29 18:30:05 +0200 | 
| commit | 7e16f500cb7bc0cfd8bafbf6bb1555704f771231 (patch) | |
| tree | bfc2b4a475cb06a787e2c4bdf284165644e82952 /src/components/Widgets/ToC | |
| parent | 5324664e87bedfaa01ba62c0c847ef5b861e69b3 (diff) | |
chore: remove old pages, components, helpers and types
Since I'm using new components, I will also rewrite the GraphQL queries
so it is easier to start from scratch.
Diffstat (limited to 'src/components/Widgets/ToC')
| -rw-r--r-- | src/components/Widgets/ToC/ToC.tsx | 55 | 
1 files changed, 0 insertions, 55 deletions
| diff --git a/src/components/Widgets/ToC/ToC.tsx b/src/components/Widgets/ToC/ToC.tsx deleted file mode 100644 index 3f759db..0000000 --- a/src/components/Widgets/ToC/ToC.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { ExpandableWidget, OrderedList } from '@components/WidgetParts'; -import { Heading } from '@ts/types/app'; -import useHeadingsTree from '@utils/hooks/useHeadingsTree'; -import { FormattedMessage, useIntl } from 'react-intl'; - -const ToC = () => { -  const intl = useIntl(); -  const headingsTree = useHeadingsTree('article'); -  const title = intl.formatMessage({ -    defaultMessage: 'Table of contents', -    description: 'ToC: widget title', -    id: 'Zg4L7U', -  }); - -  const getItems = (headings: Heading[]) => { -    return headings.map((heading) => { -      return ( -        <li key={heading.id}> -          <a href={`#${heading.id}`}> -            <FormattedMessage -              defaultMessage="<a11y>Jump to </a11y>{title}" -              description="ToC: link" -              id="GgIWnN" -              values={{ -                title: heading.title, -                a11y: (chunks: string) => ( -                  <span className="screen-reader-text">{chunks}</span> -                ), -              }} -            /> -          </a> -          {heading.children.length > 0 && ( -            <OrderedList items={getItems(heading.children)} /> -          )} -        </li> -      ); -    }); -  }; - -  return ( -    <ExpandableWidget title={title} kind="toc" expand={true} withBorders={true}> -      <noscript> -        {intl.formatMessage({ -          defaultMessage: -            'Javascript is required to use the table of contents.', -          description: 'ToC: noscript tag', -          id: 'RZzx/4', -        })} -      </noscript> -      <OrderedList items={getItems(headingsTree)} /> -    </ExpandableWidget> -  ); -}; - -export default ToC; | 
