@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.
@@ -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, seq } = embed;
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
  >
@@ -31,11 +31,9 @@ const FileLink = styled(SafeLink)`
31
31
  }
32
32
  `;
33
33
 
34
- const renderFormat = (format: FileFormat, title: string, isPrimary: boolean, id: string, isDeadLink: 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} aria-describedby={formatId}>
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, id }: Props) => {
77
+ const File = ({ file }: Props) => {
81
78
  const formatLinks = file.formats.map((format, index) =>
82
- renderFormat(format, file.title, index === 0, id, !file.fileExists),
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} id={id} />
58
+ <File key={`file-${id}-${file.title}`} file={file} />
59
59
  ))}
60
60
  </FilesList>
61
61
  </FileListSection>
@@ -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, id, fileExists, fileType }: Props) => {
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,
@@ -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
- <div>
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
- </div>
254
+ </OverflowWrapper>
252
255
  </TableWrapper>
253
256
  );
254
257
  };