@ndla/ui 49.0.6 → 49.0.8
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.
- package/es/ContactBlock/ContactBlock.js +47 -31
- package/es/Embed/ImageEmbed.js +3 -2
- package/es/Gloss/Gloss.js +8 -7
- package/lib/ContactBlock/ContactBlock.d.ts +3 -1
- package/lib/ContactBlock/ContactBlock.js +49 -30
- package/lib/Embed/ImageEmbed.d.ts +3 -2
- package/lib/Embed/ImageEmbed.js +3 -2
- package/lib/Embed/index.d.ts +1 -1
- package/lib/Embed/types.d.ts +8 -0
- package/lib/Gloss/Gloss.js +8 -7
- package/lib/index.d.ts +1 -1
- package/package.json +17 -17
- package/src/ContactBlock/ContactBlock.tsx +27 -7
- package/src/Embed/ImageEmbed.tsx +4 -2
- package/src/Embed/index.ts +1 -1
- package/src/Embed/types.ts +9 -0
- package/src/Gloss/Gloss.tsx +1 -1
- package/src/index.ts +1 -1
package/src/Embed/ImageEmbed.tsx
CHANGED
|
@@ -19,13 +19,14 @@ import { Figure, FigureType } from '../Figure';
|
|
|
19
19
|
import Image, { ImageLink } from '../Image';
|
|
20
20
|
import { EmbedByline } from '../LicenseByline';
|
|
21
21
|
import EmbedErrorPlaceholder from './EmbedErrorPlaceholder';
|
|
22
|
-
import { HeartButtonType, RenderContext } from './types';
|
|
22
|
+
import { CanonicalUrlFuncs, HeartButtonType, RenderContext } from './types';
|
|
23
23
|
|
|
24
24
|
interface Props {
|
|
25
25
|
embed: ImageMetaData;
|
|
26
26
|
previewAlt?: boolean;
|
|
27
27
|
path?: string;
|
|
28
28
|
heartButton?: HeartButtonType;
|
|
29
|
+
canonicalUrl?: CanonicalUrlFuncs['image'];
|
|
29
30
|
inGrid?: boolean;
|
|
30
31
|
lang?: string;
|
|
31
32
|
renderContext?: RenderContext;
|
|
@@ -113,6 +114,7 @@ const ImageEmbed = ({
|
|
|
113
114
|
inGrid,
|
|
114
115
|
path,
|
|
115
116
|
lang,
|
|
117
|
+
canonicalUrl,
|
|
116
118
|
renderContext = 'article',
|
|
117
119
|
}: Props) => {
|
|
118
120
|
const [isBylineHidden, setIsBylineHidden] = useState(hideByline(embed.embedData.size));
|
|
@@ -150,7 +152,7 @@ const ImageEmbed = ({
|
|
|
150
152
|
className={imageSizes ? `c-figure--${embedData.align} expanded` : ''}
|
|
151
153
|
>
|
|
152
154
|
<ImageWrapper
|
|
153
|
-
src={!isCopyrighted ?
|
|
155
|
+
src={!isCopyrighted ? canonicalUrl?.(data) : undefined}
|
|
154
156
|
crop={crop}
|
|
155
157
|
size={embedData.size}
|
|
156
158
|
pagePath={path}
|
package/src/Embed/index.ts
CHANGED
|
@@ -20,4 +20,4 @@ export { ConceptNotionV2 } from './conceptComponents';
|
|
|
20
20
|
export { default as ConceptListEmbed } from './ConceptListEmbed';
|
|
21
21
|
export { default as UnknownEmbed } from './UnknownEmbed';
|
|
22
22
|
export { InlineConcept, BlockConcept } from './ConceptEmbed';
|
|
23
|
-
export type { HeartButtonType, RenderContext } from './types';
|
|
23
|
+
export type { HeartButtonType, CanonicalUrlFuncs, RenderContext } from './types';
|
package/src/Embed/types.ts
CHANGED
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
import { ElementType } from 'react';
|
|
10
10
|
import { EmbedMetaData } from '@ndla/types-embed';
|
|
11
|
+
import { IImageMetaInformationV3 } from '@ndla/types-backend/image-api';
|
|
11
12
|
|
|
12
13
|
export type HeartButtonType = ElementType<{ embed: Extract<EmbedMetaData, { status: 'success' }> }>;
|
|
13
14
|
|
|
15
|
+
export type EmbedParameter<T extends EmbedMetaData['resource']> = Partial<
|
|
16
|
+
Extract<EmbedMetaData, { status: 'success'; resource: T }>
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export type CanonicalUrlFuncs = {
|
|
20
|
+
image?: (image: IImageMetaInformationV3) => string;
|
|
21
|
+
};
|
|
22
|
+
|
|
14
23
|
export type RenderContext = 'article' | 'embed';
|
package/src/Gloss/Gloss.tsx
CHANGED
|
@@ -141,7 +141,7 @@ const Gloss = ({ title, glossData, audio }: Props) => {
|
|
|
141
141
|
{glossData.examples && glossData.examples.length > 0 && (
|
|
142
142
|
<AccordionRoot type="single" collapsible>
|
|
143
143
|
<AccordionItem value="1">
|
|
144
|
-
<StyledAccordionHeader>{t('gloss.examples')}</StyledAccordionHeader>
|
|
144
|
+
<StyledAccordionHeader headingLevel="span">{t('gloss.examples')}</StyledAccordionHeader>
|
|
145
145
|
<StyledAccordionContent>
|
|
146
146
|
{glossData.examples.map((example, index) => (
|
|
147
147
|
<div key={index}>
|
package/src/index.ts
CHANGED
|
@@ -213,7 +213,7 @@ export { BlogPostV2 } from './BlogPost';
|
|
|
213
213
|
export { ProgrammeCard } from './ProgrammeCard';
|
|
214
214
|
export { KeyFigure } from './KeyFigure';
|
|
215
215
|
export { default as ContactBlock } from './ContactBlock';
|
|
216
|
-
export type { HeartButtonType, RenderContext } from './Embed';
|
|
216
|
+
export type { HeartButtonType, CanonicalUrlFuncs, RenderContext } from './Embed';
|
|
217
217
|
export { CampaignBlock } from './CampaignBlock';
|
|
218
218
|
export { Grid, GridParallaxItem } from './Grid';
|
|
219
219
|
export type { GridType } from './Grid';
|