@ndla/ui 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
 
9
9
  import styled from '@emotion/styled';
10
10
  import { useTranslation } from 'react-i18next';
11
- import HTMLReactParser from 'html-react-parser';
11
+ import { parseMarkdown } from '@ndla/util';
12
12
  import React, { Fragment, ReactNode } from 'react';
13
13
  import { keyframes } from '@emotion/core';
14
14
  import Button from '@ndla/button';
@@ -174,7 +174,6 @@ type VisualElementProps = {
174
174
  export type NotionProps = {
175
175
  id: string | number;
176
176
  labels?: string[];
177
- renderMarkdown?: (text: string) => string;
178
177
  text: ReactNode;
179
178
  title: string;
180
179
  visualElement?: VisualElementProps;
@@ -182,16 +181,7 @@ export type NotionProps = {
182
181
  children?: ReactNode;
183
182
  };
184
183
 
185
- const Notion = ({
186
- id,
187
- labels = [],
188
- renderMarkdown,
189
- text,
190
- title,
191
- visualElement,
192
- imageElement,
193
- children,
194
- }: NotionProps) => {
184
+ const Notion = ({ id, labels = [], text, title, visualElement, imageElement, children }: NotionProps) => {
195
185
  const { t } = useTranslation();
196
186
 
197
187
  return (
@@ -224,9 +214,7 @@ const Notion = ({
224
214
  </ImageWrapper>
225
215
  )}
226
216
  <TextWrapper hasVisualElement={!!(imageElement || visualElement?.metaImage)}>
227
- {HTMLReactParser(
228
- renderMarkdown ? renderMarkdown(`**${title}** \u2013 ${text}`) : `<b>${title}</b> \u2013 ${text}`,
229
- )}
217
+ {parseMarkdown(`**${title}** \u2013 ${text}`)}
230
218
  {!!labels.length && (
231
219
  <LabelsContainer>
232
220
  {t('searchPage.resultType.notionLabels')}
@@ -24,7 +24,7 @@ interface Props {
24
24
  visualElement: NotionVisualElementType;
25
25
  }
26
26
 
27
- const supportedEmbedTypes = ['brightcove', 'h5p'];
27
+ const supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external'];
28
28
  const NotionVisualElement = ({ visualElement }: Props) => {
29
29
  const id = '1';
30
30
  const figureId = 'figure-1';