From c82084576a786d6637e8d7b40d3a849a986d11d7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 3 Jun 2025 10:09:19 +0200 Subject: [PATCH] refactor(source): text-view (#227) * refactor text-view * lint fix --- .../ItemPopupComponents/TextView.tsx | 145 ++++++------------ src/assets/css/markdown.css | 63 ++++++++ src/css.tsx | 1 + 3 files changed, 108 insertions(+), 101 deletions(-) create mode 100644 src/assets/css/markdown.css diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index 5ff21325..508e210f 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -4,7 +4,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-call */ -import { memo } from 'react' import Markdown from 'react-markdown' import remarkBreaks from 'remark-breaks' @@ -26,14 +25,12 @@ export const TextView = ({ text, truncate = false, rawText, - itemTextField, }: { item?: Item itemId?: string text?: string truncate?: boolean rawText?: string - itemTextField?: string }) => { if (item) { text = item.text @@ -41,8 +38,6 @@ export const TextView = ({ } const tags = useTags() const addFilterTag = useAddFilterTag() - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const itemTextFieldDummy = itemTextField let innerText = '' let replacedText = '' @@ -86,53 +81,15 @@ export const TextView = ({ }) } - const CustomH1 = ({ children }) =>

{children}

- - const CustomH2 = ({ children }) =>

{children}

- - const CustomH3 = ({ children }) =>

{children}

- - const CustomH4 = ({ children }) =>

{children}

- - const CustomH5 = ({ children }) =>
{children}
- - const CustomH6 = ({ children }) =>
{children}
- - const CustomParagraph = ({ children }) =>

{children}

- - const CustomUnorderdList = ({ children }) => ( - - ) - - const CustomOrderdList = ({ children }) => ( -
    {children}
- ) - - const CustomHorizontalRow = ({ children }) =>
{children} - // eslint-disable-next-line react/prop-types - const CustomImage = ({ alt, src, title }) => ( - {alt} - ) - - const CustomExternalLink = ({ href, children }) => ( - - {' '} - {children} - - ) - - const CustomHashTagLink = ({ - children, - tag, - itemId, - }: { - children: string - tag: Tag - itemId?: string - }) => { + const HashTag = ({ children, tag, itemId }: { children: string; tag: Tag; itemId?: string }) => { return ( { e.stopPropagation() @@ -144,62 +101,48 @@ export const TextView = ({ ) } - // eslint-disable-next-line react/display-name - const MemoizedVideoEmbed = memo(({ url }: { url: string }) => ( -