@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,171 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
4
|
-
import { css } from '@emotion/react';
|
|
5
|
-
import { ButtonV2 } from '@ndla/button';
|
|
6
|
-
import { ChevronDown, ChevronUp } from '@ndla/icons/common';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
|
|
9
|
-
type InvertItProps = {
|
|
10
|
-
invertedStyle?: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const StyledWrapper = styled.section``;
|
|
14
|
-
|
|
15
|
-
const StyledIngress = styled.div<InvertItProps>`
|
|
16
|
-
max-width: 612px;
|
|
17
|
-
${(props) =>
|
|
18
|
-
props.invertedStyle &&
|
|
19
|
-
css`
|
|
20
|
-
color: #fff;
|
|
21
|
-
`}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
const StyledH1 = styled.h1<InvertItProps>`
|
|
25
|
-
${fonts.sizes('24px', '28px')}
|
|
26
|
-
margin: ${spacing.medium} ${spacing.normal} ${spacing.normal} 0;
|
|
27
|
-
font-weight: ${fonts.weight.bold};
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-wrap: wrap;
|
|
30
|
-
align-items: center;
|
|
31
|
-
|
|
32
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
33
|
-
margin: 40px ${spacing.normal} 18px 0;
|
|
34
|
-
${fonts.sizes('32px', '28px')};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
38
|
-
margin: 50px ${spacing.normal} 24px 0;
|
|
39
|
-
${fonts.sizes('38px', '32px')};
|
|
40
|
-
}
|
|
41
|
-
${(props) =>
|
|
42
|
-
props.invertedStyle &&
|
|
43
|
-
css`
|
|
44
|
-
color: #fff;
|
|
45
|
-
`}
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
const LoaderText = styled.p<InvertItProps>`
|
|
49
|
-
${(props) =>
|
|
50
|
-
props.invertedStyle &&
|
|
51
|
-
css`
|
|
52
|
-
color: #fff;
|
|
53
|
-
`}
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
const StyledHeadingText = styled.span`
|
|
57
|
-
margin-right: 28px;
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
const StyledAdditionalResourceMark = styled.span`
|
|
61
|
-
text-align: center;
|
|
62
|
-
display: inline-block;
|
|
63
|
-
line-height: 18px;
|
|
64
|
-
width: 20px;
|
|
65
|
-
height: 20px;
|
|
66
|
-
border: 1px solid ${colors.brand.dark};
|
|
67
|
-
border-radius: 100px;
|
|
68
|
-
margin-right: 7px;
|
|
69
|
-
`;
|
|
70
|
-
const StyledAdditionalResource = styled.span`
|
|
71
|
-
font-weight: ${fonts.weight.semibold};
|
|
72
|
-
${fonts.sizes('12px', '15px')};
|
|
73
|
-
color: ${colors.brand.dark};
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
const StyledButtonWrapper = styled.div<InvertItProps>`
|
|
77
|
-
margin-top: ${spacing.small};
|
|
78
|
-
padding: ${spacing.xsmall} 0 ${spacing.xsmall} ${spacing.medium};
|
|
79
|
-
border-left: 6px solid ${colors.brand.light};
|
|
80
|
-
${(props) =>
|
|
81
|
-
props.invertedStyle &&
|
|
82
|
-
css`
|
|
83
|
-
button {
|
|
84
|
-
color: #fff;
|
|
85
|
-
&:hover,
|
|
86
|
-
&:focus {
|
|
87
|
-
color: #fff;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`}
|
|
91
|
-
`;
|
|
92
|
-
|
|
93
|
-
const StyledContentWrapper = styled.div<InvertItProps>`
|
|
94
|
-
padding-top: ${spacing.normal};
|
|
95
|
-
margin-top: 0;
|
|
96
|
-
border-left: 6px solid ${colors.brand.light};
|
|
97
|
-
|
|
98
|
-
${(props) =>
|
|
99
|
-
props.invertedStyle &&
|
|
100
|
-
css`
|
|
101
|
-
background: #fff;
|
|
102
|
-
`}
|
|
103
|
-
`;
|
|
104
|
-
|
|
105
|
-
type Props = {
|
|
106
|
-
heading: string;
|
|
107
|
-
introduction: ReactNode;
|
|
108
|
-
onToggleShowContent: () => void;
|
|
109
|
-
showContent: boolean;
|
|
110
|
-
isLoading: boolean;
|
|
111
|
-
isAdditionalTopic?: boolean;
|
|
112
|
-
invertedStyle?: boolean;
|
|
113
|
-
children: ReactNode;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export const NavigationTopicAbout = ({
|
|
117
|
-
heading,
|
|
118
|
-
introduction,
|
|
119
|
-
onToggleShowContent,
|
|
120
|
-
showContent,
|
|
121
|
-
isLoading,
|
|
122
|
-
isAdditionalTopic,
|
|
123
|
-
invertedStyle,
|
|
124
|
-
children,
|
|
125
|
-
}: Props) => {
|
|
126
|
-
const { t } = useTranslation();
|
|
127
|
-
return (
|
|
128
|
-
<StyledWrapper data-testid="nav-topic-about">
|
|
129
|
-
<StyledH1 invertedStyle={invertedStyle}>
|
|
130
|
-
<StyledHeadingText>{heading}</StyledHeadingText>
|
|
131
|
-
{isAdditionalTopic && (
|
|
132
|
-
<StyledAdditionalResource>
|
|
133
|
-
<StyledAdditionalResourceMark>T</StyledAdditionalResourceMark>
|
|
134
|
-
{t('navigation.additionalTopic')}
|
|
135
|
-
</StyledAdditionalResource>
|
|
136
|
-
)}
|
|
137
|
-
</StyledH1>
|
|
138
|
-
{isLoading ? (
|
|
139
|
-
<LoaderText invertedStyle={invertedStyle}>{t('navigation.loadingText')}</LoaderText>
|
|
140
|
-
) : (
|
|
141
|
-
<>
|
|
142
|
-
<StyledIngress invertedStyle={invertedStyle}>
|
|
143
|
-
{introduction}
|
|
144
|
-
<StyledButtonWrapper invertedStyle={invertedStyle}>
|
|
145
|
-
<ButtonV2
|
|
146
|
-
aria-expanded={!!showContent}
|
|
147
|
-
variant="link"
|
|
148
|
-
onClick={() => {
|
|
149
|
-
onToggleShowContent();
|
|
150
|
-
}}
|
|
151
|
-
>
|
|
152
|
-
{showContent ? (
|
|
153
|
-
<>
|
|
154
|
-
{t('navigation.showShorterDescription')} <ChevronUp />
|
|
155
|
-
</>
|
|
156
|
-
) : (
|
|
157
|
-
<>
|
|
158
|
-
{t('navigation.showLongerDescription')} <ChevronDown />
|
|
159
|
-
</>
|
|
160
|
-
)}
|
|
161
|
-
</ButtonV2>
|
|
162
|
-
</StyledButtonWrapper>
|
|
163
|
-
</StyledIngress>
|
|
164
|
-
{showContent && <StyledContentWrapper invertedStyle={invertedStyle}>{children}</StyledContentWrapper>}
|
|
165
|
-
</>
|
|
166
|
-
)}
|
|
167
|
-
</StyledWrapper>
|
|
168
|
-
);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export default NavigationTopicAbout;
|
|
@@ -1,101 +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 { Children, HTMLProps, ReactNode, useMemo, useState } from 'react';
|
|
10
|
-
import BEMHelper from 'react-bem-helper';
|
|
11
|
-
import { useTranslation } from 'react-i18next';
|
|
12
|
-
import styled from '@emotion/styled';
|
|
13
|
-
import { ButtonV2 } from '@ndla/button';
|
|
14
|
-
import SafeLink from '@ndla/safelink';
|
|
15
|
-
import { HeadingLevel } from '@ndla/typography';
|
|
16
|
-
import SectionHeading from '../SectionHeading';
|
|
17
|
-
import ContentTypeBadge from '../ContentTypeBadge';
|
|
18
|
-
import { contentTypes } from '../model/ContentType';
|
|
19
|
-
|
|
20
|
-
const classes = new BEMHelper({
|
|
21
|
-
name: 'related-articles',
|
|
22
|
-
prefix: 'c-',
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
interface RelatedArticleProps {
|
|
26
|
-
title: string;
|
|
27
|
-
introduction: string;
|
|
28
|
-
to: string;
|
|
29
|
-
linkInfo?: string;
|
|
30
|
-
target?: string;
|
|
31
|
-
type?: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const RelatedArticleV2 = ({
|
|
35
|
-
title,
|
|
36
|
-
introduction,
|
|
37
|
-
to,
|
|
38
|
-
linkInfo = '',
|
|
39
|
-
target = '',
|
|
40
|
-
type = contentTypes.SUBJECT_MATERIAL,
|
|
41
|
-
}: RelatedArticleProps) => {
|
|
42
|
-
return (
|
|
43
|
-
<article {...classes('item', type)}>
|
|
44
|
-
<h3 {...classes('title')}>
|
|
45
|
-
<ContentTypeBadge type={type} background size="small" />
|
|
46
|
-
<span {...classes('link-wrapper')}>
|
|
47
|
-
<SafeLink to={to} {...classes('link')} target={target} rel={linkInfo ? 'noopener noreferrer' : undefined}>
|
|
48
|
-
{title}
|
|
49
|
-
</SafeLink>
|
|
50
|
-
</span>
|
|
51
|
-
</h3>
|
|
52
|
-
<p {...classes('description')} dangerouslySetInnerHTML={{ __html: introduction }} />
|
|
53
|
-
{linkInfo && <p {...classes('link-info')}>{linkInfo}</p>}
|
|
54
|
-
</article>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const HeadingWrapper = styled.div`
|
|
59
|
-
display: flex;
|
|
60
|
-
justify-content: space-between;
|
|
61
|
-
align-items: center;
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
interface Props extends HTMLProps<HTMLElement> {
|
|
65
|
-
children?: JSX.Element[];
|
|
66
|
-
articleCount?: number;
|
|
67
|
-
headingLevel?: HeadingLevel;
|
|
68
|
-
headingButtons?: ReactNode;
|
|
69
|
-
}
|
|
70
|
-
export const RelatedArticleListV2 = ({
|
|
71
|
-
children = [],
|
|
72
|
-
articleCount,
|
|
73
|
-
headingLevel = 'h3',
|
|
74
|
-
headingButtons,
|
|
75
|
-
...rest
|
|
76
|
-
}: Props) => {
|
|
77
|
-
const [expanded, setExpanded] = useState(false);
|
|
78
|
-
const { t } = useTranslation();
|
|
79
|
-
const childCount = useMemo(() => articleCount ?? Children.count(children), [children, articleCount]);
|
|
80
|
-
const childrenToShow = useMemo(
|
|
81
|
-
() => (childCount > 2 && !expanded ? children?.slice(0, 2) : children),
|
|
82
|
-
[childCount, children, expanded],
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<section {...classes('')} {...rest}>
|
|
87
|
-
<HeadingWrapper>
|
|
88
|
-
<SectionHeading headingLevel={headingLevel} className={classes('component-title').className}>
|
|
89
|
-
{t('related.title')}
|
|
90
|
-
</SectionHeading>
|
|
91
|
-
{headingButtons}
|
|
92
|
-
</HeadingWrapper>
|
|
93
|
-
<div {...classes('articles')}>{childrenToShow}</div>
|
|
94
|
-
{childCount > 2 ? (
|
|
95
|
-
<ButtonV2 onClick={() => setExpanded((p) => !p)} variant="outline">
|
|
96
|
-
{t(`related.show${expanded ? 'Less' : 'More'}`)}
|
|
97
|
-
</ButtonV2>
|
|
98
|
-
) : null}
|
|
99
|
-
</section>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2018-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 { forwardRef } from 'react';
|
|
10
|
-
import { spacing, breakpoints, mq, misc, fonts, colors } from '@ndla/core';
|
|
11
|
-
import { Search } from '@ndla/icons/common';
|
|
12
|
-
import { ButtonProps, ButtonV2 } from '@ndla/button';
|
|
13
|
-
import styled from '@emotion/styled';
|
|
14
|
-
|
|
15
|
-
interface Props extends ButtonProps {
|
|
16
|
-
ndlaFilm?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const StyledButton = styled(ButtonV2)`
|
|
20
|
-
border-radius: ${misc.borderRadius};
|
|
21
|
-
border: 0;
|
|
22
|
-
color: ${colors.brand.primary};
|
|
23
|
-
align-items: center;
|
|
24
|
-
background: transparent;
|
|
25
|
-
|
|
26
|
-
svg {
|
|
27
|
-
height: 24px;
|
|
28
|
-
width: 24px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
${fonts.sizes('16px', '32px')};
|
|
32
|
-
|
|
33
|
-
&[data-film='true'] {
|
|
34
|
-
background: ${colors.ndlaFilm.filmColorBright};
|
|
35
|
-
color: ${colors.white};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
39
|
-
padding: ${spacing.small} ${spacing.normal};
|
|
40
|
-
background: ${colors.brand.greyLighter};
|
|
41
|
-
}
|
|
42
|
-
&:hover,
|
|
43
|
-
&:focus,
|
|
44
|
-
&:active {
|
|
45
|
-
border: 0;
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
const StyledSpan = styled.span`
|
|
50
|
-
margin-right: ${spacing.normal};
|
|
51
|
-
font-weight: ${fonts.weight.normal};
|
|
52
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
53
|
-
display: none;
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
const ToggleSearchButton = forwardRef<HTMLButtonElement, Props>(({ children, ndlaFilm, ...rest }, ref) => (
|
|
58
|
-
<StyledButton data-film={ndlaFilm} type="button" ref={ref} {...rest}>
|
|
59
|
-
<StyledSpan>{children}</StyledSpan>
|
|
60
|
-
<Search />
|
|
61
|
-
</StyledButton>
|
|
62
|
-
));
|
|
63
|
-
|
|
64
|
-
export default ToggleSearchButton;
|
package/src/Subject/Subject.tsx
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { breakpoints, colors, mq, spacing, spacingUnit } from '@ndla/core';
|
|
5
|
-
import { HeadingLevel } from '@ndla/typography';
|
|
6
|
-
import SectionHeading from '../SectionHeading';
|
|
7
|
-
|
|
8
|
-
const SubjectContentWrapper = styled.div`
|
|
9
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
10
|
-
margin-bottom: 100px;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
const StyledBreadcrumb = styled.div`
|
|
15
|
-
display: none;
|
|
16
|
-
margin: ${spacing.medium} 0 0 0;
|
|
17
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
18
|
-
display: block;
|
|
19
|
-
margin-left: ${spacingUnit * 3}px;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
interface StyledSubjectContentProps {
|
|
24
|
-
twoColumns: boolean;
|
|
25
|
-
}
|
|
26
|
-
const StyledSubjectContent = styled.div<StyledSubjectContentProps>`
|
|
27
|
-
display: block;
|
|
28
|
-
flex-flow: column;
|
|
29
|
-
margin-top: ${spacing.small};
|
|
30
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-flow: row;
|
|
33
|
-
margin-top: ${spacing.large};
|
|
34
|
-
> *:not(:only-child):last-child {
|
|
35
|
-
padding-left: ${spacingUnit * 3}px;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
& > *:first-child {
|
|
40
|
-
margin-bottom: ${spacing.large};
|
|
41
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
42
|
-
margin-right: 80px;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
${(p) =>
|
|
47
|
-
!p.twoColumns &&
|
|
48
|
-
css`
|
|
49
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
50
|
-
> *:not(:only-child) {
|
|
51
|
-
max-width: 50%;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
}
|
|
57
|
-
${mq.range({ from: breakpoints.tablet, until: breakpoints.desktop })} {
|
|
58
|
-
> *:not(:only-child):last-child {
|
|
59
|
-
padding-left: $subject-margin;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
`};
|
|
63
|
-
|
|
64
|
-
${(p) =>
|
|
65
|
-
p.twoColumns &&
|
|
66
|
-
css`
|
|
67
|
-
flex-flow: column;
|
|
68
|
-
& > *:first-child {
|
|
69
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
70
|
-
margin-right: 0;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`};
|
|
74
|
-
`;
|
|
75
|
-
export const SubjectContent = ({
|
|
76
|
-
children,
|
|
77
|
-
breadcrumb,
|
|
78
|
-
twoColumns = false,
|
|
79
|
-
}: {
|
|
80
|
-
children: ReactNode;
|
|
81
|
-
breadcrumb: ReactNode;
|
|
82
|
-
twoColumns?: boolean;
|
|
83
|
-
}) => (
|
|
84
|
-
<SubjectContentWrapper>
|
|
85
|
-
<StyledBreadcrumb>{breadcrumb}</StyledBreadcrumb>
|
|
86
|
-
<StyledSubjectContent twoColumns={twoColumns}>{children}</StyledSubjectContent>
|
|
87
|
-
</SubjectContentWrapper>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const StyledSecondaryContent = styled.div`
|
|
91
|
-
background: ${colors.brand.greyLightest};
|
|
92
|
-
padding: ${spacing.large} 0;
|
|
93
|
-
margin-top: ${spacing.large};
|
|
94
|
-
|
|
95
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
96
|
-
padding: ${spacingUnit * 3}px 0 ${spacing.large};
|
|
97
|
-
margin-bottom: 100px;
|
|
98
|
-
margin-top: 0;
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
|
-
export const SubjectSecondaryContent = ({ children }: { children: ReactNode }) => (
|
|
103
|
-
<StyledSecondaryContent>{children}</StyledSecondaryContent>
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const StyledChildContent = styled.div`
|
|
107
|
-
padding: 0 ${spacing.normal};
|
|
108
|
-
`;
|
|
109
|
-
|
|
110
|
-
export const SubjectChildContent = ({ children }: { children: ReactNode }) => (
|
|
111
|
-
<StyledChildContent>{children}</StyledChildContent>
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
export const SubjectTopics = ({ messages, children }: { messages: { heading: string }; children: ReactNode }) => (
|
|
115
|
-
<section>
|
|
116
|
-
<header>
|
|
117
|
-
<h1>{messages.heading}</h1>
|
|
118
|
-
</header>
|
|
119
|
-
<div>{children}</div>
|
|
120
|
-
</section>
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
const SidebarWrapper = styled.div`
|
|
124
|
-
display: block;
|
|
125
|
-
margin: 0 ${spacing.normal};
|
|
126
|
-
|
|
127
|
-
& > *:last-child {
|
|
128
|
-
margin-bottom: 0;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
132
|
-
flex-basis: 390px;
|
|
133
|
-
flex-shrink: 0;
|
|
134
|
-
margin: 0px 0 0 0;
|
|
135
|
-
}
|
|
136
|
-
`;
|
|
137
|
-
|
|
138
|
-
export const SubjectSidebarWrapper = ({ children }: { children: ReactNode }) => (
|
|
139
|
-
<SidebarWrapper>{children}</SidebarWrapper>
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
interface StyledSubjectFlexWrapperProps {
|
|
143
|
-
noMargin: boolean;
|
|
144
|
-
}
|
|
145
|
-
const StyledSubjectFlexWrapper = styled.div<StyledSubjectFlexWrapperProps>`
|
|
146
|
-
display: flex;
|
|
147
|
-
flex-direction: column;
|
|
148
|
-
margin-bottom: ${(p) => !p.noMargin && spacing.large};
|
|
149
|
-
|
|
150
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
151
|
-
flex-direction: row;
|
|
152
|
-
}
|
|
153
|
-
`;
|
|
154
|
-
|
|
155
|
-
export const SubjectFlexWrapper = ({ children, noMargin = false }: { children: ReactNode; noMargin?: boolean }) => (
|
|
156
|
-
<StyledSubjectFlexWrapper noMargin={noMargin}>{children}</StyledSubjectFlexWrapper>
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
const StyledSubjectFlexChild = styled.div`
|
|
160
|
-
box-sizing: border-box;
|
|
161
|
-
padding: 0 ${spacing.small};
|
|
162
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
163
|
-
flex-basis: 50%;
|
|
164
|
-
flex-grow: 1;
|
|
165
|
-
flex-direction: row;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
&:last-child {
|
|
169
|
-
& > * {
|
|
170
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
171
|
-
margin-bottom: 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
& > * {
|
|
176
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
177
|
-
margin-bottom: o;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
`;
|
|
181
|
-
|
|
182
|
-
const StyledSectionHeading = styled(SectionHeading)`
|
|
183
|
-
margin: 0 0 ${spacing.small} 0;
|
|
184
|
-
|
|
185
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
186
|
-
margin: 0 0 ${spacing.normal} 0;
|
|
187
|
-
}
|
|
188
|
-
`;
|
|
189
|
-
|
|
190
|
-
interface SubjectSectionTitleProps {
|
|
191
|
-
headingLevel: HeadingLevel;
|
|
192
|
-
children: ReactNode;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export const SubjectSectionTitle = ({ children, headingLevel = 'h2' }: SubjectSectionTitleProps) => (
|
|
196
|
-
<StyledSectionHeading large headingLevel={headingLevel}>
|
|
197
|
-
{children}
|
|
198
|
-
</StyledSectionHeading>
|
|
199
|
-
);
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
import SafeLink from '@ndla/safelink';
|
|
3
|
-
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
4
|
-
import { HeadingLevel } from '@ndla/typography';
|
|
5
|
-
import ContentTypeBadge from '../ContentTypeBadge';
|
|
6
|
-
import { SubjectSectionTitle } from './Subject';
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
headingLevel: HeadingLevel;
|
|
10
|
-
heading: string;
|
|
11
|
-
content: {
|
|
12
|
-
name: string;
|
|
13
|
-
url: string;
|
|
14
|
-
formattedDate: string;
|
|
15
|
-
contentType: string;
|
|
16
|
-
}[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const StyledSection = styled.section`
|
|
20
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
21
|
-
margin-bottom: ${spacing.large};
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
const StyledSubjectSectionTitle = styled(SubjectSectionTitle)`
|
|
26
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
27
|
-
margin-left: ${spacing.large} !important;
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
const StyledUl = styled.ul`
|
|
32
|
-
margin: 0;
|
|
33
|
-
padding: 0;
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
const StyledListItem = styled.li`
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: space-between;
|
|
40
|
-
&:last-child {
|
|
41
|
-
margin-bottom: 0;
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
const LeftWrapper = styled.div`
|
|
46
|
-
display: flex;
|
|
47
|
-
justify-content: flex-start;
|
|
48
|
-
align-items: flex-start;
|
|
49
|
-
|
|
50
|
-
.c-icon {
|
|
51
|
-
width: 14px;
|
|
52
|
-
height: 14px;
|
|
53
|
-
margin-left: ${spacing.xsmall};
|
|
54
|
-
margin-right: ${spacing.xsmall};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.c-content-type-badge {
|
|
58
|
-
margin-top: 23px;
|
|
59
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
60
|
-
display: none;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
const ContentLinkWrapper = styled.div`
|
|
66
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
67
|
-
padding-left: ${spacing.normal};
|
|
68
|
-
}
|
|
69
|
-
padding-bottom: ${spacing.small};
|
|
70
|
-
`;
|
|
71
|
-
|
|
72
|
-
const DateWrapper = styled.div`
|
|
73
|
-
color: ${colors.text.light};
|
|
74
|
-
${fonts.sizes('14px', '18px')};
|
|
75
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
76
|
-
${fonts.sizes('16px', '20px')};
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
const StyledSafeLink = styled(SafeLink)`
|
|
81
|
-
color: ${colors.brand.dark};
|
|
82
|
-
font-weight: 600;
|
|
83
|
-
${fonts.sizes('16px', '20px')};
|
|
84
|
-
margin-bottom: ${spacing.xsmall};
|
|
85
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
86
|
-
${fonts.sizes('18px', '30px')};
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
const SubjectNewContent = ({ heading, content, headingLevel }: Props) => (
|
|
91
|
-
<StyledSection>
|
|
92
|
-
<StyledSubjectSectionTitle headingLevel={headingLevel}>{heading}</StyledSubjectSectionTitle>
|
|
93
|
-
<nav>
|
|
94
|
-
<StyledUl>
|
|
95
|
-
{content.map((item, index) => (
|
|
96
|
-
<StyledListItem key={index}>
|
|
97
|
-
<LeftWrapper>
|
|
98
|
-
<ContentTypeBadge type={item.contentType} size="x-small" background border />
|
|
99
|
-
<ContentLinkWrapper>
|
|
100
|
-
<DateWrapper>{item.formattedDate}</DateWrapper>
|
|
101
|
-
<StyledSafeLink to={item.url}>{item.name}</StyledSafeLink>
|
|
102
|
-
</ContentLinkWrapper>
|
|
103
|
-
</LeftWrapper>
|
|
104
|
-
</StyledListItem>
|
|
105
|
-
))}
|
|
106
|
-
</StyledUl>
|
|
107
|
-
</nav>
|
|
108
|
-
</StyledSection>
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
export default SubjectNewContent;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
import { breakpoints, mq, spacing } from '@ndla/core';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import { HeadingLevel } from '@ndla/typography';
|
|
5
|
-
import { SubjectSectionTitle } from './Subject';
|
|
6
|
-
|
|
7
|
-
const StyledSubjectSocialContent = styled.div`
|
|
8
|
-
display: none;
|
|
9
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
10
|
-
display: flex;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export const SubjectSocialContent = ({ children }: { children: ReactNode }) => (
|
|
15
|
-
<StyledSubjectSocialContent>{children}</StyledSubjectSocialContent>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const StyledSection = styled.section`
|
|
19
|
-
flex-basis: 50%;
|
|
20
|
-
&:nth-child(odd) {
|
|
21
|
-
margin-right: ${spacing.normal};
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
interface SubjectSocialSectionProps {
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
title?: string;
|
|
28
|
-
headingLevel: HeadingLevel;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const SubjectSocialSection = ({ children, title = '', headingLevel }: SubjectSocialSectionProps) => (
|
|
32
|
-
<StyledSection>
|
|
33
|
-
<SubjectSectionTitle headingLevel={headingLevel}>{title}</SubjectSectionTitle>
|
|
34
|
-
{children}
|
|
35
|
-
</StyledSection>
|
|
36
|
-
);
|
|
@@ -1,29 +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 } from 'react';
|
|
10
|
-
import BEMHelper from 'react-bem-helper';
|
|
11
|
-
|
|
12
|
-
const classes = new BEMHelper({
|
|
13
|
-
name: 'translation',
|
|
14
|
-
prefix: 'c-',
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
interface Props {
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
index: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const Translation = ({ children, index }: Props) => (
|
|
23
|
-
<div {...classes('')}>
|
|
24
|
-
<div {...classes('index')}>{index}</div>
|
|
25
|
-
<dl {...classes('wrapper')}>{children}</dl>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export default Translation;
|