@ndla/ui 44.0.18 → 44.0.19
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/Embed/AudioEmbed.js +1 -6
- package/es/Embed/BrightcoveEmbed.js +3 -6
- package/es/Embed/ImageEmbed.js +2 -5
- package/es/FileList/File.js +6 -9
- package/es/FileList/FileList.js +4 -5
- package/es/FileList/FileV2.js +0 -2
- package/es/Table/Table.js +26 -14
- package/lib/Embed/AudioEmbed.js +1 -6
- package/lib/Embed/BrightcoveEmbed.js +3 -6
- package/lib/Embed/ImageEmbed.js +2 -5
- package/lib/FileList/File.d.ts +1 -2
- package/lib/FileList/File.js +6 -9
- package/lib/FileList/FileList.js +4 -5
- package/lib/FileList/FileV2.d.ts +1 -2
- package/lib/FileList/FileV2.js +0 -2
- package/lib/Table/Table.js +26 -14
- package/package.json +3 -3
- package/src/Embed/AudioEmbed.stories.tsx +0 -4
- package/src/Embed/AudioEmbed.tsx +2 -6
- package/src/Embed/BrightcoveEmbed.stories.tsx +0 -3
- package/src/Embed/BrightcoveEmbed.tsx +2 -3
- package/src/Embed/ConceptEmbed.stories.tsx +0 -5
- package/src/Embed/ExternalEmbed.stories.tsx +0 -2
- package/src/Embed/H5pEmbed.stories.tsx +0 -2
- package/src/Embed/IframeEmbed.stories.tsx +0 -4
- package/src/Embed/ImageEmbed.stories.tsx +0 -2
- package/src/Embed/ImageEmbed.tsx +1 -4
- package/src/FileList/File.tsx +4 -7
- package/src/FileList/FileList.tsx +1 -1
- package/src/FileList/FileV2.tsx +1 -3
- package/src/Table/Table.tsx +5 -2
package/src/Embed/ImageEmbed.tsx
CHANGED
|
@@ -111,7 +111,7 @@ const ImageEmbed = ({ embed, previewAlt, heartButton: HeartButton, inGrid, path
|
|
|
111
111
|
return <EmbedErrorPlaceholder type={'image'} figureType={figureType} />;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const { data, embedData
|
|
114
|
+
const { data, embedData } = embed;
|
|
115
115
|
|
|
116
116
|
const altText = embedData.alt || '';
|
|
117
117
|
|
|
@@ -121,13 +121,10 @@ const ImageEmbed = ({ embed, previewAlt, heartButton: HeartButton, inGrid, path
|
|
|
121
121
|
const focalPoint = getFocalPoint(embedData);
|
|
122
122
|
const crop = getCrop(embedData);
|
|
123
123
|
|
|
124
|
-
const figureId = `figure-${seq}-${data.id}`;
|
|
125
|
-
|
|
126
124
|
const isCopyrighted = data.copyright.license.license.toLowerCase() === COPYRIGHTED;
|
|
127
125
|
|
|
128
126
|
return (
|
|
129
127
|
<Figure
|
|
130
|
-
id={figureId}
|
|
131
128
|
type={imageSizes ? undefined : figureType}
|
|
132
129
|
className={imageSizes ? `c-figure--${embedData.align} expanded` : ''}
|
|
133
130
|
>
|
package/src/FileList/File.tsx
CHANGED
|
@@ -31,11 +31,9 @@ const FileLink = styled(SafeLink)`
|
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
-
const renderFormat = (format: FileFormat, title: string, isPrimary: boolean,
|
|
34
|
+
const renderFormat = (format: FileFormat, title: string, isPrimary: boolean, isDeadLink: boolean) => {
|
|
35
35
|
const titleWithFormat = `${title} (${format.fileType.toUpperCase()})`;
|
|
36
36
|
|
|
37
|
-
const formatId = `${id}_${format.fileType}`;
|
|
38
|
-
|
|
39
37
|
if (isDeadLink) {
|
|
40
38
|
return (
|
|
41
39
|
<span key={format.url}>
|
|
@@ -46,7 +44,7 @@ const renderFormat = (format: FileFormat, title: string, isPrimary: boolean, id:
|
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
return (
|
|
49
|
-
<FileLink key={format.url} to={format.url} target="_blank" aria-label={titleWithFormat}
|
|
47
|
+
<FileLink key={format.url} to={format.url} target="_blank" aria-label={titleWithFormat}>
|
|
50
48
|
<Download />
|
|
51
49
|
<Tooltip tooltip={format.tooltip}>
|
|
52
50
|
<LinkTextWrapper>
|
|
@@ -58,7 +56,6 @@ const renderFormat = (format: FileFormat, title: string, isPrimary: boolean, id:
|
|
|
58
56
|
};
|
|
59
57
|
|
|
60
58
|
interface Props {
|
|
61
|
-
id: string;
|
|
62
59
|
file: FileType;
|
|
63
60
|
}
|
|
64
61
|
|
|
@@ -77,9 +74,9 @@ const FileListItem = styled.li`
|
|
|
77
74
|
}
|
|
78
75
|
`;
|
|
79
76
|
|
|
80
|
-
const File = ({ file
|
|
77
|
+
const File = ({ file }: Props) => {
|
|
81
78
|
const formatLinks = file.formats.map((format, index) =>
|
|
82
|
-
renderFormat(format, file.title, index === 0,
|
|
79
|
+
renderFormat(format, file.title, index === 0, !file.fileExists),
|
|
83
80
|
);
|
|
84
81
|
|
|
85
82
|
return <FileListItem key={file.title}>{formatLinks}</FileListItem>;
|
|
@@ -55,7 +55,7 @@ const FileList = ({ files, heading, id }: Props) => (
|
|
|
55
55
|
<FileListHeading>{heading}</FileListHeading>
|
|
56
56
|
<FilesList>
|
|
57
57
|
{files.map((file) => (
|
|
58
|
-
<File key={`file-${id}-${file.title}`} file={file}
|
|
58
|
+
<File key={`file-${id}-${file.title}`} file={file} />
|
|
59
59
|
))}
|
|
60
60
|
</FilesList>
|
|
61
61
|
</FileListSection>
|
package/src/FileList/FileV2.tsx
CHANGED
|
@@ -10,19 +10,17 @@ import { useTranslation } from 'react-i18next';
|
|
|
10
10
|
import File from './File';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
|
-
id: string;
|
|
14
13
|
title: string;
|
|
15
14
|
url: string;
|
|
16
15
|
fileExists: boolean;
|
|
17
16
|
fileType: string;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
const FileV2 = ({ title, url,
|
|
19
|
+
const FileV2 = ({ title, url, fileExists, fileType }: Props) => {
|
|
21
20
|
const { t } = useTranslation();
|
|
22
21
|
const tooltip = `${t('download')} ${url.split('/').pop()}`;
|
|
23
22
|
return (
|
|
24
23
|
<File
|
|
25
|
-
id={id}
|
|
26
24
|
file={{
|
|
27
25
|
title,
|
|
28
26
|
fileExists,
|
package/src/Table/Table.tsx
CHANGED
|
@@ -194,6 +194,9 @@ export const TableStyling = css`
|
|
|
194
194
|
const TableWrapper = styled.div`
|
|
195
195
|
display: flex;
|
|
196
196
|
justify-content: center;
|
|
197
|
+
`;
|
|
198
|
+
|
|
199
|
+
const OverflowWrapper = styled.div`
|
|
197
200
|
overflow-x: auto;
|
|
198
201
|
`;
|
|
199
202
|
|
|
@@ -242,13 +245,13 @@ const Table = ({ children, id, ...rest }: Props) => {
|
|
|
242
245
|
|
|
243
246
|
return (
|
|
244
247
|
<TableWrapper>
|
|
245
|
-
<
|
|
248
|
+
<OverflowWrapper>
|
|
246
249
|
<LeftScrollBorder data-block={scrollPosition === 'end' || scrollPosition === 'center'} />
|
|
247
250
|
<table ref={tableRef} id={id} onScroll={onScroll} css={TableStyling} {...rest}>
|
|
248
251
|
{children}
|
|
249
252
|
</table>
|
|
250
253
|
<RightScrollBorder data-block={scrollPosition === 'start' || scrollPosition === 'center'} />
|
|
251
|
-
</
|
|
254
|
+
</OverflowWrapper>
|
|
252
255
|
</TableWrapper>
|
|
253
256
|
);
|
|
254
257
|
};
|