@ndla/ui 47.4.1 → 49.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.
- package/es/BlogPost/BlogPost.js +6 -6
- package/es/CampaignBlock/CampaignBlock.js +8 -8
- package/es/CopyParagraphButton/CopyParagraphButton.js +30 -58
- package/es/CopyParagraphButton/index.js +1 -3
- package/es/Embed/RelatedContentEmbed.js +3 -3
- package/es/FactBox/FactBox.js +64 -19
- package/es/FactBox/index.js +0 -1
- package/es/Figure/index.js +0 -2
- package/es/FileList/File.js +46 -24
- package/es/FileList/FileList.js +18 -14
- package/es/FileList/index.js +0 -2
- package/es/LinkBlock/LinkBlock.js +7 -7
- package/es/Messages/index.js +1 -2
- package/es/Navigation/index.js +1 -2
- package/es/RelatedArticleList/RelatedArticleList.js +80 -35
- package/es/RelatedArticleList/index.js +2 -3
- package/es/Search/SearchField.js +4 -9
- package/es/Search/index.js +0 -1
- package/es/Subject/index.js +1 -4
- package/es/all.css +1 -1
- package/es/i18n/i18n.js +2 -1
- package/es/index.js +10 -17
- package/es/utils/relativeUrl.js +17 -2
- package/lib/BlogPost/BlogPost.js +5 -5
- package/lib/CampaignBlock/CampaignBlock.js +7 -7
- package/lib/CopyParagraphButton/CopyParagraphButton.d.ts +5 -4
- package/lib/CopyParagraphButton/CopyParagraphButton.js +29 -57
- package/lib/CopyParagraphButton/index.d.ts +1 -3
- package/lib/CopyParagraphButton/index.js +0 -14
- package/lib/Embed/RelatedContentEmbed.js +3 -3
- package/lib/FactBox/FactBox.d.ts +1 -4
- package/lib/FactBox/FactBox.js +72 -27
- package/lib/FactBox/index.d.ts +0 -1
- package/lib/FactBox/index.js +0 -7
- package/lib/Figure/index.d.ts +0 -2
- package/lib/Figure/index.js +0 -14
- package/lib/FileList/File.d.ts +22 -3
- package/lib/FileList/File.js +45 -25
- package/lib/FileList/FileList.d.ts +10 -14
- package/lib/FileList/FileList.js +17 -15
- package/lib/FileList/index.d.ts +0 -2
- package/lib/FileList/index.js +0 -14
- package/lib/LinkBlock/LinkBlock.js +6 -6
- package/lib/Messages/index.d.ts +1 -2
- package/lib/Messages/index.js +0 -7
- package/lib/Navigation/index.d.ts +1 -2
- package/lib/Navigation/index.js +0 -7
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +16 -17
- package/lib/RelatedArticleList/RelatedArticleList.js +78 -35
- package/lib/RelatedArticleList/index.d.ts +2 -3
- package/lib/RelatedArticleList/index.js +2 -12
- package/lib/Search/SearchField.d.ts +1 -2
- package/lib/Search/SearchField.js +4 -9
- package/lib/Search/index.d.ts +0 -1
- package/lib/Search/index.js +0 -7
- package/lib/Subject/index.d.ts +0 -3
- package/lib/Subject/index.js +0 -63
- package/lib/all.css +1 -1
- package/lib/i18n/i18n.d.ts +1 -0
- package/lib/i18n/i18n.js +4 -2
- package/lib/index.d.ts +10 -17
- package/lib/index.js +9 -232
- package/lib/utils/relativeUrl.d.ts +1 -1
- package/lib/utils/relativeUrl.js +19 -4
- package/package.json +8 -8
- package/src/BlogPost/BlogPost.tsx +2 -2
- package/src/CampaignBlock/CampaignBlock.tsx +2 -2
- package/src/CopyParagraphButton/CopyParagraphButton.tsx +24 -46
- package/src/CopyParagraphButton/index.tsx +1 -3
- package/src/Embed/RelatedContentEmbed.stories.tsx +9 -9
- package/src/Embed/RelatedContentEmbed.tsx +3 -3
- package/src/FactBox/FactBox.tsx +29 -16
- package/src/FactBox/Factbox.stories.tsx +4 -4
- package/src/FactBox/index.ts +0 -2
- package/src/Figure/index.ts +0 -2
- package/src/FileList/File.tsx +62 -32
- package/src/FileList/FileList.stories.tsx +15 -15
- package/src/FileList/FileList.tsx +21 -27
- package/src/FileList/index.ts +0 -2
- package/src/LinkBlock/LinkBlock.tsx +2 -2
- package/src/Messages/index.ts +1 -2
- package/src/Navigation/index.ts +1 -2
- package/src/RelatedArticleList/RelatedArticleList.tsx +53 -47
- package/src/RelatedArticleList/index.ts +2 -3
- package/src/Search/SearchField.tsx +1 -5
- package/src/Search/index.ts +0 -1
- package/src/Subject/index.ts +0 -13
- package/src/i18n/i18n.ts +2 -1
- package/src/index.ts +12 -46
- package/src/main.scss +0 -1
- package/src/utils/__tests__/relativeUrl-test.tsx +72 -0
- package/src/utils/relativeUrl.ts +19 -2
- package/es/BlogPosts/BlogPost.js +0 -96
- package/es/BlogPosts/BlogPostWrapper.js +0 -28
- package/es/BlogPosts/index.js +0 -11
- package/es/CopyParagraphButton/CopyParagraphButtonV2.js +0 -87
- package/es/CopyParagraphButton/initCopyParagraphButtons.js +0 -29
- package/es/FactBox/FactBoxV2.js +0 -93
- package/es/Figure/FigureBylineExpandButton.js +0 -29
- package/es/Figure/FigureExpandButton.js +0 -30
- package/es/FileList/FileListV2.js +0 -47
- package/es/FileList/FileV2.js +0 -32
- package/es/Frontpage/FrontpageFilm.js +0 -66
- package/es/Frontpage/FrontpageHeader.js +0 -50
- package/es/Frontpage/FrontpageInfo.js +0 -23
- package/es/Frontpage/FrontpageMultidisciplinarySubject.js +0 -99
- package/es/Frontpage/FrontpageProgramMenu.js +0 -86
- package/es/Frontpage/FrontpageSearch.js +0 -157
- package/es/Frontpage/FrontpageToolbox.js +0 -57
- package/es/Frontpage/illustrations/Fellesfag.js +0 -99
- package/es/Frontpage/illustrations/FrontpageHeaderIllustration.js +0 -113
- package/es/Frontpage/illustrations/FrontpageIllustrations.js +0 -21
- package/es/Frontpage/illustrations/FrontpageSubjectIllustration.js +0 -184
- package/es/Frontpage/illustrations/MenuFellesfag.js +0 -80
- package/es/Frontpage/illustrations/MenuStudiespesialiserende.js +0 -77
- package/es/Frontpage/illustrations/MenuYrkesfag.js +0 -107
- package/es/Frontpage/illustrations/Studiespesialiserende.js +0 -87
- package/es/Frontpage/illustrations/Yrkesfag.js +0 -118
- package/es/Frontpage/illustrations/index.js +0 -18
- package/es/Frontpage/index.js +0 -9
- package/es/Frontpage/sortCategories.js +0 -25
- package/es/InfoBlock/InfoBlock.js +0 -58
- package/es/InfoBlock/index.js +0 -1
- package/es/InfoBox/InfoBox.js +0 -16
- package/es/InfoBox/index.js +0 -1
- package/es/InfoWidget/InfoWidget.js +0 -103
- package/es/InfoWidget/index.js +0 -2
- package/es/Masthead/MastheadSearchModal.js +0 -82
- package/es/Messages/MessageBoxTag.js +0 -33
- package/es/MultidisciplinarySubject/List.js +0 -52
- package/es/MultidisciplinarySubject/ListItem.js +0 -90
- package/es/MultidisciplinarySubject/MultidisciplinarySubject.js +0 -125
- package/es/MultidisciplinarySubject/index.js +0 -10
- package/es/Navigation/NavigationTopicAbout.js +0 -164
- package/es/RelatedArticleList/RelatedArticleV2.js +0 -125
- package/es/Search/ToggleSearchButton.js +0 -51
- package/es/Subject/Subject.js +0 -143
- package/es/Subject/SubjectNewContent.js +0 -102
- package/es/Subject/SubjectSocial.js +0 -33
- package/es/Translation/Translation.js +0 -33
- package/es/Translation/TranslationLine.js +0 -47
- package/es/Translation/index.js +0 -2
- package/lib/BlogPosts/BlogPost.d.ts +0 -22
- package/lib/BlogPosts/BlogPost.js +0 -103
- package/lib/BlogPosts/BlogPostWrapper.d.ts +0 -14
- package/lib/BlogPosts/BlogPostWrapper.js +0 -37
- package/lib/BlogPosts/index.d.ts +0 -10
- package/lib/BlogPosts/index.js +0 -20
- package/lib/CopyParagraphButton/CopyParagraphButtonV2.d.ts +0 -15
- package/lib/CopyParagraphButton/CopyParagraphButtonV2.js +0 -92
- package/lib/CopyParagraphButton/initCopyParagraphButtons.d.ts +0 -2
- package/lib/CopyParagraphButton/initCopyParagraphButtons.js +0 -38
- package/lib/FactBox/FactBoxV2.d.ts +0 -13
- package/lib/FactBox/FactBoxV2.js +0 -98
- package/lib/Figure/FigureBylineExpandButton.d.ts +0 -16
- package/lib/Figure/FigureBylineExpandButton.js +0 -35
- package/lib/Figure/FigureExpandButton.d.ts +0 -16
- package/lib/Figure/FigureExpandButton.js +0 -35
- package/lib/FileList/FileListV2.d.ts +0 -13
- package/lib/FileList/FileListV2.js +0 -52
- package/lib/FileList/FileV2.d.ts +0 -15
- package/lib/FileList/FileV2.js +0 -40
- package/lib/Frontpage/FrontpageFilm.d.ts +0 -6
- package/lib/Frontpage/FrontpageFilm.js +0 -73
- package/lib/Frontpage/FrontpageHeader.d.ts +0 -8
- package/lib/Frontpage/FrontpageHeader.js +0 -57
- package/lib/Frontpage/FrontpageInfo.d.ts +0 -6
- package/lib/Frontpage/FrontpageInfo.js +0 -31
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.d.ts +0 -33
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.js +0 -114
- package/lib/Frontpage/FrontpageProgramMenu.d.ts +0 -9
- package/lib/Frontpage/FrontpageProgramMenu.js +0 -93
- package/lib/Frontpage/FrontpageSearch.d.ts +0 -21
- package/lib/Frontpage/FrontpageSearch.js +0 -164
- package/lib/Frontpage/FrontpageToolbox.d.ts +0 -8
- package/lib/Frontpage/FrontpageToolbox.js +0 -64
- package/lib/Frontpage/illustrations/Fellesfag.d.ts +0 -9
- package/lib/Frontpage/illustrations/Fellesfag.js +0 -105
- package/lib/Frontpage/illustrations/FrontpageHeaderIllustration.d.ts +0 -9
- package/lib/Frontpage/illustrations/FrontpageHeaderIllustration.js +0 -119
- package/lib/Frontpage/illustrations/FrontpageIllustrations.d.ts +0 -9
- package/lib/Frontpage/illustrations/FrontpageIllustrations.js +0 -30
- package/lib/Frontpage/illustrations/FrontpageSubjectIllustration.d.ts +0 -9
- package/lib/Frontpage/illustrations/FrontpageSubjectIllustration.js +0 -188
- package/lib/Frontpage/illustrations/MenuFellesfag.d.ts +0 -9
- package/lib/Frontpage/illustrations/MenuFellesfag.js +0 -86
- package/lib/Frontpage/illustrations/MenuStudiespesialiserende.d.ts +0 -9
- package/lib/Frontpage/illustrations/MenuStudiespesialiserende.js +0 -83
- package/lib/Frontpage/illustrations/MenuYrkesfag.d.ts +0 -9
- package/lib/Frontpage/illustrations/MenuYrkesfag.js +0 -113
- package/lib/Frontpage/illustrations/Studiespesialiserende.d.ts +0 -9
- package/lib/Frontpage/illustrations/Studiespesialiserende.js +0 -93
- package/lib/Frontpage/illustrations/Yrkesfag.d.ts +0 -9
- package/lib/Frontpage/illustrations/Yrkesfag.js +0 -124
- package/lib/Frontpage/illustrations/index.d.ts +0 -18
- package/lib/Frontpage/illustrations/index.js +0 -68
- package/lib/Frontpage/index.d.ts +0 -9
- package/lib/Frontpage/index.js +0 -99
- package/lib/Frontpage/sortCategories.d.ts +0 -9
- package/lib/Frontpage/sortCategories.js +0 -32
- package/lib/InfoBlock/InfoBlock.d.ts +0 -8
- package/lib/InfoBlock/InfoBlock.js +0 -64
- package/lib/InfoBlock/index.d.ts +0 -1
- package/lib/InfoBlock/index.js +0 -12
- package/lib/InfoBox/InfoBox.d.ts +0 -6
- package/lib/InfoBox/InfoBox.js +0 -24
- package/lib/InfoBox/index.d.ts +0 -1
- package/lib/InfoBox/index.js +0 -13
- package/lib/InfoWidget/InfoWidget.d.ts +0 -21
- package/lib/InfoWidget/InfoWidget.js +0 -110
- package/lib/InfoWidget/index.d.ts +0 -2
- package/lib/InfoWidget/index.js +0 -10
- package/lib/Masthead/MastheadSearchModal.d.ts +0 -8
- package/lib/Masthead/MastheadSearchModal.js +0 -89
- package/lib/Messages/MessageBoxTag.d.ts +0 -12
- package/lib/Messages/MessageBoxTag.js +0 -40
- package/lib/MultidisciplinarySubject/List.d.ts +0 -7
- package/lib/MultidisciplinarySubject/List.js +0 -59
- package/lib/MultidisciplinarySubject/ListItem.d.ts +0 -10
- package/lib/MultidisciplinarySubject/ListItem.js +0 -97
- package/lib/MultidisciplinarySubject/MultidisciplinarySubject.d.ts +0 -13
- package/lib/MultidisciplinarySubject/MultidisciplinarySubject.js +0 -135
- package/lib/MultidisciplinarySubject/index.d.ts +0 -9
- package/lib/MultidisciplinarySubject/index.js +0 -17
- package/lib/Navigation/NavigationTopicAbout.d.ts +0 -13
- package/lib/Navigation/NavigationTopicAbout.js +0 -171
- package/lib/RelatedArticleList/RelatedArticleV2.d.ts +0 -26
- package/lib/RelatedArticleList/RelatedArticleV2.js +0 -131
- package/lib/Search/ToggleSearchButton.d.ts +0 -14
- package/lib/Search/ToggleSearchButton.js +0 -57
- package/lib/Subject/Subject.d.ts +0 -32
- package/lib/Subject/Subject.js +0 -156
- package/lib/Subject/SubjectNewContent.d.ts +0 -13
- package/lib/Subject/SubjectNewContent.js +0 -109
- package/lib/Subject/SubjectSocial.d.ts +0 -12
- package/lib/Subject/SubjectSocial.js +0 -41
- package/lib/Translation/Translation.d.ts +0 -14
- package/lib/Translation/Translation.js +0 -38
- package/lib/Translation/TranslationLine.d.ts +0 -16
- package/lib/Translation/TranslationLine.js +0 -51
- package/lib/Translation/index.d.ts +0 -2
- package/lib/Translation/index.js +0 -20
- package/src/BlogPosts/BlogPost.tsx +0 -192
- package/src/BlogPosts/BlogPostWrapper.tsx +0 -49
- package/src/BlogPosts/index.ts +0 -12
- package/src/CopyParagraphButton/CopyParagraphButtonV2.tsx +0 -85
- package/src/CopyParagraphButton/initCopyParagraphButtons.tsx +0 -27
- package/src/FactBox/FactBoxV2.tsx +0 -56
- package/src/Figure/FigureBylineExpandButton.tsx +0 -34
- package/src/Figure/FigureExpandButton.tsx +0 -35
- package/src/FileList/FileListV2.tsx +0 -58
- package/src/FileList/FileV2.tsx +0 -33
- package/src/Frontpage/FrontpageFilm.tsx +0 -97
- package/src/Frontpage/FrontpageHeader.tsx +0 -72
- package/src/Frontpage/FrontpageInfo.tsx +0 -45
- package/src/Frontpage/FrontpageMultidisciplinarySubject.tsx +0 -110
- package/src/Frontpage/FrontpageProgramMenu.tsx +0 -86
- package/src/Frontpage/FrontpageSearch.tsx +0 -200
- package/src/Frontpage/FrontpageToolbox.tsx +0 -70
- package/src/Frontpage/__tests__/Frontpage-test.js +0 -158
- package/src/Frontpage/illustrations/Fellesfag.tsx +0 -99
- package/src/Frontpage/illustrations/FrontpageHeaderIllustration.tsx +0 -131
- package/src/Frontpage/illustrations/FrontpageIllustrations.tsx +0 -28
- package/src/Frontpage/illustrations/FrontpageSubjectIllustration.tsx +0 -151
- package/src/Frontpage/illustrations/MenuFellesfag.tsx +0 -73
- package/src/Frontpage/illustrations/MenuStudiespesialiserende.tsx +0 -70
- package/src/Frontpage/illustrations/MenuYrkesfag.tsx +0 -82
- package/src/Frontpage/illustrations/Studiespesialiserende.tsx +0 -79
- package/src/Frontpage/illustrations/Yrkesfag.tsx +0 -122
- package/src/Frontpage/illustrations/index.ts +0 -31
- package/src/Frontpage/index.ts +0 -17
- package/src/Frontpage/sortCategories.ts +0 -23
- package/src/InfoBlock/InfoBlock.tsx +0 -61
- package/src/InfoBlock/index.ts +0 -1
- package/src/InfoBox/InfoBox.tsx +0 -31
- package/src/InfoBox/index.ts +0 -1
- package/src/InfoWidget/InfoWidget.tsx +0 -127
- package/src/InfoWidget/index.ts +0 -3
- package/src/Masthead/MastheadSearchModal.tsx +0 -101
- package/src/Messages/MessageBoxTag.tsx +0 -34
- package/src/MultidisciplinarySubject/List.tsx +0 -49
- package/src/MultidisciplinarySubject/ListItem.tsx +0 -74
- package/src/MultidisciplinarySubject/MultidisciplinarySubject.tsx +0 -117
- package/src/MultidisciplinarySubject/index.ts +0 -11
- package/src/Navigation/NavigationTopicAbout.tsx +0 -171
- package/src/RelatedArticleList/RelatedArticleV2.tsx +0 -101
- package/src/Search/ToggleSearchButton.tsx +0 -64
- package/src/Subject/Subject.tsx +0 -199
- package/src/Subject/SubjectNewContent.tsx +0 -111
- package/src/Subject/SubjectSocial.tsx +0 -36
- package/src/Translation/Translation.tsx +0 -29
- package/src/Translation/TranslationLine.tsx +0 -42
- package/src/Translation/component.translation.scss +0 -53
- package/src/Translation/index.ts +0 -2
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { MouseEvent, ReactNode, useCallback, useEffect, useMemo, useState } from 'react';
|
|
10
|
-
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import styled from '@emotion/styled';
|
|
12
|
-
import { colors } from '@ndla/core';
|
|
13
|
-
import Tooltip from '@ndla/tooltip';
|
|
14
|
-
import { Link } from '@ndla/icons/common';
|
|
15
|
-
import { copyTextToClipboard } from '@ndla/util';
|
|
16
|
-
|
|
17
|
-
const ContainerDiv = styled.div`
|
|
18
|
-
position: relative;
|
|
19
|
-
`;
|
|
20
|
-
const IconButton = styled.button`
|
|
21
|
-
position: absolute;
|
|
22
|
-
left: -3em;
|
|
23
|
-
top: 0.1em;
|
|
24
|
-
background: none;
|
|
25
|
-
border: 0;
|
|
26
|
-
z-index: 1;
|
|
27
|
-
transition: 0.2s;
|
|
28
|
-
opacity: 0;
|
|
29
|
-
color: ${colors.brand.grey};
|
|
30
|
-
|
|
31
|
-
& svg {
|
|
32
|
-
width: 30px;
|
|
33
|
-
height: 30px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
${ContainerDiv}:hover &,
|
|
37
|
-
&:focus, &:focus-visible, &:active {
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
opacity: 1;
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
interface Props {
|
|
44
|
-
// What to render within the h2
|
|
45
|
-
children: ReactNode;
|
|
46
|
-
copyText: string;
|
|
47
|
-
lang?: string;
|
|
48
|
-
}
|
|
49
|
-
const CopyParagraphButtonV2 = ({ children, copyText, lang }: Props) => {
|
|
50
|
-
const [hasCopied, setHasCopied] = useState(false);
|
|
51
|
-
const { t } = useTranslation();
|
|
52
|
-
const sanitizedTitle = useMemo(() => encodeURIComponent(copyText.replace(/ /g, '-')), [copyText]);
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (hasCopied) {
|
|
56
|
-
setTimeout(() => setHasCopied(false), 3000);
|
|
57
|
-
}
|
|
58
|
-
}, [hasCopied]);
|
|
59
|
-
|
|
60
|
-
const onCopyClick = useCallback(() => {
|
|
61
|
-
setHasCopied(true);
|
|
62
|
-
const { location } = window;
|
|
63
|
-
const newHash = `#${sanitizedTitle}`;
|
|
64
|
-
const port = location.port ? `:${location.port}` : '';
|
|
65
|
-
const urlToCopy = `${location.protocol}//${location.hostname}${port}${location.pathname}${location.search}${newHash}`;
|
|
66
|
-
|
|
67
|
-
copyTextToClipboard(urlToCopy);
|
|
68
|
-
}, [sanitizedTitle]);
|
|
69
|
-
|
|
70
|
-
const tooltip = hasCopied ? t('article.copyPageLinkCopied') : t('article.copyHeaderLink');
|
|
71
|
-
return (
|
|
72
|
-
<ContainerDiv>
|
|
73
|
-
<Tooltip tooltip={tooltip}>
|
|
74
|
-
<IconButton onClick={onCopyClick} aria-label={`${tooltip}: ${copyText}`}>
|
|
75
|
-
<Link />
|
|
76
|
-
</IconButton>
|
|
77
|
-
</Tooltip>
|
|
78
|
-
<h2 id={sanitizedTitle} tabIndex={-1} lang={lang}>
|
|
79
|
-
{children}
|
|
80
|
-
</h2>
|
|
81
|
-
</ContainerDiv>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default CopyParagraphButtonV2;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import ReactDOM from 'react-dom';
|
|
9
|
-
import CopyParagraphButton from './CopyParagraphButton';
|
|
10
|
-
|
|
11
|
-
const forEachElement = (selector: string, callback: Function) => {
|
|
12
|
-
const nodeList = document.querySelectorAll(selector);
|
|
13
|
-
for (let i = 0; i < nodeList.length; i += 1) {
|
|
14
|
-
callback(nodeList[i], i);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const initCopyParagraphButtons = () => {
|
|
19
|
-
forEachElement('[data-header-copy-container]', (el: HTMLElement) => {
|
|
20
|
-
const title = el.getAttribute('data-title');
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line react/no-deprecated
|
|
23
|
-
ReactDOM.hydrate(<CopyParagraphButton title={title} content={title} hydrate />, el);
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default initCopyParagraphButtons;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ReactNode, useState } from 'react';
|
|
10
|
-
import BEMHelper from 'react-bem-helper';
|
|
11
|
-
import { useTranslation } from 'react-i18next';
|
|
12
|
-
import styled from '@emotion/styled';
|
|
13
|
-
import { IconButtonV2 } from '@ndla/button';
|
|
14
|
-
import { ChevronDown, ChevronUp } from '@ndla/icons/common';
|
|
15
|
-
|
|
16
|
-
const classes = new BEMHelper({
|
|
17
|
-
name: 'factbox',
|
|
18
|
-
prefix: 'c-',
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
interface Props {
|
|
22
|
-
children?: ReactNode;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const StyledAside = styled.aside`
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
align-items: center;
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
const StyledDiv = styled.div`
|
|
32
|
-
width: 100%;
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
const StyledIconButton = styled(IconButtonV2)`
|
|
36
|
-
margin-top: -20px;
|
|
37
|
-
z-index: 1;
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
const FactBox = ({ children }: Props) => {
|
|
41
|
-
const { t } = useTranslation();
|
|
42
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
43
|
-
|
|
44
|
-
const additional = isOpen ? 'expanded' : '';
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<StyledAside {...classes(undefined, undefined, additional)}>
|
|
48
|
-
<StyledDiv {...classes('content')}>{children}</StyledDiv>
|
|
49
|
-
<StyledIconButton onClick={() => setIsOpen((p) => !p)} aria-label={t(`factbox.${isOpen ? 'close' : 'open'}`)}>
|
|
50
|
-
{isOpen ? <ChevronUp /> : <ChevronDown />}
|
|
51
|
-
</StyledIconButton>
|
|
52
|
-
</StyledAside>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default FactBox;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ChevronUp, ChevronDown } from '@ndla/icons/common';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
messages: {
|
|
13
|
-
expandBylineButtonLabel: string;
|
|
14
|
-
minimizeBylineButtonLabel: string;
|
|
15
|
-
};
|
|
16
|
-
typeClass: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const FigureBylineExpandButton = ({ messages, typeClass }: Props) => {
|
|
20
|
-
return (
|
|
21
|
-
<button
|
|
22
|
-
className="c-figure__show-byline-btn"
|
|
23
|
-
type="button"
|
|
24
|
-
data-figure-button
|
|
25
|
-
data-classtype={typeClass}
|
|
26
|
-
data-aria={messages.expandBylineButtonLabel}
|
|
27
|
-
data-ariaexpanded={messages.minimizeBylineButtonLabel}
|
|
28
|
-
aria-label={messages.expandBylineButtonLabel}
|
|
29
|
-
>
|
|
30
|
-
<ChevronUp className="expanded-icon" />
|
|
31
|
-
<ChevronDown className="contracted-icon" />
|
|
32
|
-
</button>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ArrowCollapse } from '@ndla/icons/common';
|
|
10
|
-
import { ExpandTwoArrows } from '@ndla/icons/action';
|
|
11
|
-
|
|
12
|
-
export function FigureExpandButton({ messages, typeClass }: Props) {
|
|
13
|
-
return (
|
|
14
|
-
<button
|
|
15
|
-
className="c-figure__fullscreen-btn"
|
|
16
|
-
type="button"
|
|
17
|
-
data-aria={messages.zoomImageButtonLabel}
|
|
18
|
-
data-ariaexpanded={messages.zoomOutImageButtonLabel}
|
|
19
|
-
aria-label={messages.zoomImageButtonLabel}
|
|
20
|
-
data-figure-button
|
|
21
|
-
data-classtype={typeClass}
|
|
22
|
-
>
|
|
23
|
-
<ExpandTwoArrows className="contracted-icon" />
|
|
24
|
-
<ArrowCollapse className="expanded-icon" />
|
|
25
|
-
</button>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface Props {
|
|
30
|
-
messages: {
|
|
31
|
-
zoomImageButtonLabel: string;
|
|
32
|
-
zoomOutImageButtonLabel: string;
|
|
33
|
-
};
|
|
34
|
-
typeClass: string;
|
|
35
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import styled from '@emotion/styled';
|
|
10
|
-
import { colors, fonts, spacing } from '@ndla/core';
|
|
11
|
-
import { ReactNode } from 'react';
|
|
12
|
-
import { useTranslation } from 'react-i18next';
|
|
13
|
-
|
|
14
|
-
interface Props {
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const FileListSection = styled.section`
|
|
19
|
-
margin: ${spacing.large} 0;
|
|
20
|
-
padding: ${spacing.small} 0 ${spacing.normal} ${spacing.normal};
|
|
21
|
-
border-left: 2px solid ${colors.brand.greyLightest};
|
|
22
|
-
font-family: ${fonts.sans};
|
|
23
|
-
|
|
24
|
-
.c-icon {
|
|
25
|
-
margin-top: 3px;
|
|
26
|
-
flex-shrink: 0;
|
|
27
|
-
margin-right: ${spacing.small};
|
|
28
|
-
height: 18px;
|
|
29
|
-
width: 18px;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
const FileListHeading = styled.h3`
|
|
34
|
-
${fonts.sizes('16px', '18px')};
|
|
35
|
-
letter-spacing: 0.05em;
|
|
36
|
-
margin: 0 0 ${spacing.xsmall} 0;
|
|
37
|
-
padding-bottom: ${spacing.xsmall};
|
|
38
|
-
border-bottom: 2px solid ${colors.brand.greyLight};
|
|
39
|
-
font-weight: ${fonts.weight.bold};
|
|
40
|
-
text-transform: uppercase;
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
const FilesList = styled.ul`
|
|
44
|
-
margin: 0;
|
|
45
|
-
padding: 0;
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
const FileListV2 = ({ children }: Props) => {
|
|
49
|
-
const { t } = useTranslation();
|
|
50
|
-
return (
|
|
51
|
-
<FileListSection>
|
|
52
|
-
<FileListHeading>{t('files')}</FileListHeading>
|
|
53
|
-
<FilesList>{children}</FilesList>
|
|
54
|
-
</FileListSection>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default FileListV2;
|
package/src/FileList/FileV2.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { useTranslation } from 'react-i18next';
|
|
10
|
-
import File from './File';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
title: string;
|
|
14
|
-
url: string;
|
|
15
|
-
fileExists: boolean;
|
|
16
|
-
fileType: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const FileV2 = ({ title, url, fileExists, fileType }: Props) => {
|
|
20
|
-
const { t } = useTranslation();
|
|
21
|
-
const tooltip = `${t('download')} ${url.split('/').pop()}`;
|
|
22
|
-
return (
|
|
23
|
-
<File
|
|
24
|
-
file={{
|
|
25
|
-
title,
|
|
26
|
-
fileExists,
|
|
27
|
-
formats: [{ url, fileType, tooltip }],
|
|
28
|
-
}}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default FileV2;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
-
import SafeLink from '@ndla/safelink';
|
|
4
|
-
import { Forward } from '@ndla/icons/common';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { spacing, spacingUnit, colors, breakpoints, fonts, mq } from '@ndla/core';
|
|
7
|
-
import SectionHeading from '../SectionHeading';
|
|
8
|
-
|
|
9
|
-
const StyledSection = styled.section`
|
|
10
|
-
margin-top: ${spacing.large};
|
|
11
|
-
margin-bottom: ${spacing.large};
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
type StyledImageProps = {
|
|
15
|
-
imageUrl: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const StyledImage = styled.div<StyledImageProps>`
|
|
19
|
-
background: ${colors.ndlaFilm.filmColorDark};
|
|
20
|
-
background-repeat: no-repeat;
|
|
21
|
-
background-position: ${spacing.small} center;
|
|
22
|
-
background-size: 110px;
|
|
23
|
-
|
|
24
|
-
display: flex;
|
|
25
|
-
justify-content: flex-end;
|
|
26
|
-
align-items: center;
|
|
27
|
-
min-height: 100px;
|
|
28
|
-
padding: ${spacingUnit}px ${spacing.medium} ${spacingUnit}px ${spacingUnit}px;
|
|
29
|
-
|
|
30
|
-
${(props: StyledImageProps) =>
|
|
31
|
-
props.imageUrl &&
|
|
32
|
-
css`
|
|
33
|
-
background-image: url(${props.imageUrl});
|
|
34
|
-
`}
|
|
35
|
-
|
|
36
|
-
${mq.range({ from: breakpoints.mobileWide })} {
|
|
37
|
-
background-size: contain;
|
|
38
|
-
min-height: 120px;
|
|
39
|
-
background-position: ${spacing.medium} center;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
43
|
-
min-height: 180px;
|
|
44
|
-
background-position: 72px center;
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
type StyledTextProps = {
|
|
49
|
-
narrow?: boolean;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const StyledText = styled.span<StyledTextProps>`
|
|
53
|
-
color: #fff;
|
|
54
|
-
${fonts.sizes('14px', '26px')};
|
|
55
|
-
width: 50%;
|
|
56
|
-
|
|
57
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
58
|
-
${fonts.sizes('18px', '26px')};
|
|
59
|
-
padding-right: ${spacingUnit}px;
|
|
60
|
-
padding-left: 0;
|
|
61
|
-
width: 66.6%;
|
|
62
|
-
}
|
|
63
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
64
|
-
display: ${(props: StyledTextProps) => (props.narrow ? 'none' : 'flex')};
|
|
65
|
-
}
|
|
66
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
67
|
-
display: ${(props: StyledTextProps) => (!props.narrow ? 'none' : 'flex')};
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
type Props = {
|
|
72
|
-
url: string;
|
|
73
|
-
imageUrl: string;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const FrontpageFilm = ({ url, imageUrl }: Props) => {
|
|
77
|
-
const { t } = useTranslation();
|
|
78
|
-
return (
|
|
79
|
-
<StyledSection>
|
|
80
|
-
<SectionHeading headingLevel="h2" large>
|
|
81
|
-
{t('welcomePage.film.header')}
|
|
82
|
-
</SectionHeading>
|
|
83
|
-
<StyledImage imageUrl={imageUrl}>
|
|
84
|
-
<StyledText>{t('welcomePage.film.text')}</StyledText>
|
|
85
|
-
<StyledText narrow>{t('welcomePage.film.textShort')}</StyledText>
|
|
86
|
-
</StyledImage>
|
|
87
|
-
<div className="o-text-link__wrapper o-text-link__wrapper--right">
|
|
88
|
-
<SafeLink className="o-text-link" to={url}>
|
|
89
|
-
{t('welcomePage.film.linkLabel')}
|
|
90
|
-
<Forward />
|
|
91
|
-
</SafeLink>
|
|
92
|
-
</div>
|
|
93
|
-
</StyledSection>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export default FrontpageFilm;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import { colors, spacing, spacingUnit, mq, breakpoints } from '@ndla/core';
|
|
4
|
-
import SafeLink from '@ndla/safelink';
|
|
5
|
-
import FrontpageHeaderIllustration from './illustrations/FrontpageHeaderIllustration';
|
|
6
|
-
import SvgLogo from '../Logo/SvgLogo';
|
|
7
|
-
|
|
8
|
-
const StyledHeader = styled.div`
|
|
9
|
-
margin: 0 auto;
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
align-items: center;
|
|
14
|
-
position: relative;
|
|
15
|
-
max-width: 1024px;
|
|
16
|
-
padding: ${spacing.normal} 0 0;
|
|
17
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
18
|
-
padding: ${spacing.large} 0 ${spacing.small};
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
const StyledHeaderWrapper = styled.header`
|
|
23
|
-
background: ${colors.brand.lighter};
|
|
24
|
-
margin-bottom: ${spacingUnit * 3}px;
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
const StyledLogo = styled(SafeLink)`
|
|
28
|
-
width: 135px;
|
|
29
|
-
box-shadow: none;
|
|
30
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
31
|
-
width: 200px;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
const HeaderIllustrationWrapper = styled.div`
|
|
36
|
-
margin: ${spacing.small};
|
|
37
|
-
width: 100%;
|
|
38
|
-
padding: 0 ${spacing.normal};
|
|
39
|
-
text-align: center;
|
|
40
|
-
svg {
|
|
41
|
-
max-width: 100%;
|
|
42
|
-
}
|
|
43
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
44
|
-
width: 480px;
|
|
45
|
-
margin: ${spacing.normal} 0 ${spacing.small};
|
|
46
|
-
padding: 0;
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
interface FrontPageHeaderProps {
|
|
51
|
-
locale: string;
|
|
52
|
-
showHeader: boolean;
|
|
53
|
-
children?: ReactNode;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const FrontpageHeader = ({ locale, showHeader = true, children }: FrontPageHeaderProps) => (
|
|
57
|
-
<StyledHeaderWrapper>
|
|
58
|
-
<StyledHeader>
|
|
59
|
-
<StyledLogo to="/" aria-hidden="true">
|
|
60
|
-
<SvgLogo locale={locale} />
|
|
61
|
-
</StyledLogo>
|
|
62
|
-
{showHeader && (
|
|
63
|
-
<HeaderIllustrationWrapper aria-hidden="true">
|
|
64
|
-
<FrontpageHeaderIllustration />
|
|
65
|
-
</HeaderIllustrationWrapper>
|
|
66
|
-
)}
|
|
67
|
-
{children}
|
|
68
|
-
</StyledHeader>
|
|
69
|
-
</StyledHeaderWrapper>
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
export default FrontpageHeader;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import { spacing, spacingUnit, mq, breakpoints } from '@ndla/core';
|
|
4
|
-
|
|
5
|
-
const StyledWrapper = styled.div`
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-flow: column;
|
|
8
|
-
margin-top: ${spacing.large};
|
|
9
|
-
|
|
10
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
11
|
-
flex-flow: row;
|
|
12
|
-
margin-top: ${spacingUnit * 3}px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
& > * {
|
|
16
|
-
margin-top: ${spacing.large};
|
|
17
|
-
|
|
18
|
-
${mq.range({ from: breakpoints.tablet, until: breakpoints.desktop })} {
|
|
19
|
-
margin-right: ${spacing.normal};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
23
|
-
margin-right: ${spacing.large};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
27
|
-
flex-basis: 50%;
|
|
28
|
-
flex-grow: 0;
|
|
29
|
-
margin-top: 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&:last-child {
|
|
33
|
-
margin-right: 0;
|
|
34
|
-
margin-top: 0;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
type Props = {
|
|
40
|
-
children: ReactNode;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const FrontpageInfo = ({ children }: Props) => <StyledWrapper>{children}</StyledWrapper>;
|
|
44
|
-
|
|
45
|
-
export default FrontpageInfo;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import SafeLink, { SafeLinkButton } from '@ndla/safelink';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import { spacing, breakpoints, mq } from '@ndla/core';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { HeadingLevel } from '@ndla/typography';
|
|
6
|
-
import SectionHeading from '../SectionHeading';
|
|
7
|
-
import { MultidisciplinarySubjectIllustration as Illustration } from './illustrations/FrontpageIllustrations';
|
|
8
|
-
|
|
9
|
-
export const StyledSection = styled.section`
|
|
10
|
-
position: relative;
|
|
11
|
-
margin-top: ${spacing.large};
|
|
12
|
-
margin-bottom: ${spacing.large};
|
|
13
|
-
background-color: rgb(250, 246, 240);
|
|
14
|
-
background: linear-gradient(304.38deg, rgba(239, 238, 220, 0.35), rgba(250, 246, 240, 0.75));
|
|
15
|
-
border-radius: 8px;
|
|
16
|
-
padding: ${spacing.medium};
|
|
17
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
18
|
-
padding: ${spacing.large};
|
|
19
|
-
margin: 124px 0;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
export const Wrapper = styled.div`
|
|
24
|
-
display: flex;
|
|
25
|
-
justify-content: flex-start;
|
|
26
|
-
align-items: flex-start;
|
|
27
|
-
`;
|
|
28
|
-
export const Content = styled.div`
|
|
29
|
-
max-width: 720px;
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
export const TargetItem = styled.div`
|
|
33
|
-
padding: ${spacing.small} 0 0;
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
export const StyledText = styled.span`
|
|
37
|
-
width: 100%;
|
|
38
|
-
font-size: 16px;
|
|
39
|
-
line-height: 24px;
|
|
40
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
41
|
-
font-size: 20px;
|
|
42
|
-
line-height: 32px;
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
const Topics = styled.div`
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
flex: 1;
|
|
50
|
-
padding: ${spacing.xxsmall} 0;
|
|
51
|
-
margin: ${spacing.small} 0;
|
|
52
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
53
|
-
flex-direction: row;
|
|
54
|
-
margin: 0;
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
const Topic = styled.div`
|
|
59
|
-
margin: ${spacing.small} 0;
|
|
60
|
-
&:first-of-type {
|
|
61
|
-
margin-left: 0;
|
|
62
|
-
}
|
|
63
|
-
&:last-of-type {
|
|
64
|
-
margin-right: 0;
|
|
65
|
-
}
|
|
66
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
67
|
-
margin: ${spacing.small};
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
type Props = {
|
|
72
|
-
url: string;
|
|
73
|
-
topics?: { url: string; title: string; id: string }[];
|
|
74
|
-
headingLevel: HeadingLevel;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const FrontpageMultidisciplinarySubject = ({ url, topics, headingLevel }: Props) => {
|
|
78
|
-
const { t } = useTranslation();
|
|
79
|
-
return (
|
|
80
|
-
<StyledSection>
|
|
81
|
-
<Wrapper>
|
|
82
|
-
<Content>
|
|
83
|
-
<SectionHeading headingLevel={headingLevel} large>
|
|
84
|
-
{t('frontpageMultidisciplinarySubject.heading')}
|
|
85
|
-
</SectionHeading>
|
|
86
|
-
{topics ? (
|
|
87
|
-
<Topics>
|
|
88
|
-
{topics.map((topic) => {
|
|
89
|
-
return (
|
|
90
|
-
<Topic key={topic.id}>
|
|
91
|
-
<SafeLink to={topic.url}>{topic.title}</SafeLink>
|
|
92
|
-
</Topic>
|
|
93
|
-
);
|
|
94
|
-
})}
|
|
95
|
-
</Topics>
|
|
96
|
-
) : null}
|
|
97
|
-
<StyledText>{t('frontpageMultidisciplinarySubject.text')}</StyledText>
|
|
98
|
-
</Content>
|
|
99
|
-
</Wrapper>
|
|
100
|
-
<TargetItem className="o-text-link__wrapper o-text-link__wrapper">
|
|
101
|
-
<SafeLinkButton to={url} size="medium" shape="pill">
|
|
102
|
-
{t('frontpageMultidisciplinarySubject.linkText')}
|
|
103
|
-
</SafeLinkButton>
|
|
104
|
-
</TargetItem>
|
|
105
|
-
<Illustration />
|
|
106
|
-
</StyledSection>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export default FrontpageMultidisciplinarySubject;
|