@ndla/ui 33.0.0 → 33.0.2
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/Animation/DisplayOnPageYOffset.js +3 -2
- package/es/Animation/Fade.js +53 -42
- package/es/Footer/Footer.js +12 -13
- package/es/Footer/FooterLinks.js +7 -7
- package/es/Footer/FooterPrivacy.js +14 -42
- package/es/Frontpage/FrontpageFilm.js +5 -4
- package/es/Frontpage/FrontpageMultidisciplinarySubject.js +10 -8
- package/es/Frontpage/FrontpageToolbox.js +7 -5
- package/es/InfoWidget/InfoWidget.js +10 -8
- package/es/RelatedArticleList/RelatedArticleList.js +3 -1
- package/es/SectionHeading/SectionHeading.js +12 -18
- package/es/Subject/Subject.js +15 -12
- package/es/Subject/SubjectAbout.js +11 -9
- package/es/Subject/SubjectArchive.js +13 -11
- package/es/Subject/SubjectCarousel.js +7 -5
- package/es/Subject/SubjectLinks.js +6 -4
- package/es/Subject/SubjectNewContent.js +11 -9
- package/es/Subject/SubjectShortcuts.js +19 -10
- package/es/Subject/SubjectSocial.js +5 -3
- package/es/locale/messages-en.js +6 -5
- package/es/locale/messages-nb.js +6 -5
- package/es/locale/messages-nn.js +6 -5
- package/es/locale/messages-se.js +6 -5
- package/es/locale/messages-sma.js +6 -5
- package/lib/Animation/DisplayOnPageYOffset.js +3 -2
- package/lib/Animation/Fade.d.ts +11 -18
- package/lib/Animation/Fade.js +53 -42
- package/lib/Footer/Footer.d.ts +7 -1
- package/lib/Footer/Footer.js +12 -13
- package/lib/Footer/FooterLinks.js +7 -7
- package/lib/Footer/FooterPrivacy.d.ts +7 -4
- package/lib/Footer/FooterPrivacy.js +14 -44
- package/lib/Frontpage/FrontpageFilm.js +5 -4
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.d.ts +3 -1
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.js +10 -8
- package/lib/Frontpage/FrontpageToolbox.d.ts +3 -1
- package/lib/Frontpage/FrontpageToolbox.js +7 -5
- package/lib/InfoWidget/InfoWidget.d.ts +3 -1
- package/lib/InfoWidget/InfoWidget.js +10 -8
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +3 -1
- package/lib/RelatedArticleList/RelatedArticleList.js +3 -1
- package/lib/SectionHeading/SectionHeading.d.ts +3 -1
- package/lib/SectionHeading/SectionHeading.js +12 -18
- package/lib/Subject/Subject.d.ts +6 -2
- package/lib/Subject/Subject.js +15 -12
- package/lib/Subject/SubjectAbout.d.ts +3 -1
- package/lib/Subject/SubjectAbout.js +11 -9
- package/lib/Subject/SubjectArchive.d.ts +2 -0
- package/lib/Subject/SubjectArchive.js +13 -11
- package/lib/Subject/SubjectCarousel.d.ts +3 -1
- package/lib/Subject/SubjectCarousel.js +7 -5
- package/lib/Subject/SubjectLinks.d.ts +3 -1
- package/lib/Subject/SubjectLinks.js +6 -4
- package/lib/Subject/SubjectNewContent.d.ts +3 -1
- package/lib/Subject/SubjectNewContent.js +11 -9
- package/lib/Subject/SubjectShortcuts.d.ts +9 -0
- package/lib/Subject/SubjectShortcuts.js +11 -10
- package/lib/Subject/SubjectSocial.d.ts +7 -3
- package/lib/Subject/SubjectSocial.js +5 -3
- package/lib/locale/messages-en.d.ts +6 -5
- package/lib/locale/messages-en.js +6 -5
- package/lib/locale/messages-nb.d.ts +6 -5
- package/lib/locale/messages-nb.js +6 -5
- package/lib/locale/messages-nn.d.ts +6 -5
- package/lib/locale/messages-nn.js +6 -5
- package/lib/locale/messages-se.d.ts +6 -5
- package/lib/locale/messages-se.js +6 -5
- package/lib/locale/messages-sma.d.ts +6 -5
- package/lib/locale/messages-sma.js +6 -5
- package/lib/types.d.ts +1 -0
- package/package.json +8 -10
- package/src/Animation/DisplayOnPageYOffset.tsx +2 -1
- package/src/Animation/Fade.tsx +34 -48
- package/src/Footer/Footer.tsx +9 -2
- package/src/Footer/FooterLinks.tsx +1 -1
- package/src/Footer/FooterPrivacy.tsx +24 -38
- package/src/Frontpage/FrontpageFilm.tsx +3 -1
- package/src/Frontpage/FrontpageMultidisciplinarySubject.tsx +6 -2
- package/src/Frontpage/FrontpageToolbox.tsx +6 -2
- package/src/InfoWidget/InfoWidget.tsx +6 -2
- package/src/RelatedArticleList/RelatedArticleList.tsx +6 -2
- package/src/SectionHeading/SectionHeading.tsx +15 -20
- package/src/Subject/Subject.tsx +10 -2
- package/src/Subject/SubjectAbout.tsx +6 -2
- package/src/Subject/SubjectArchive.tsx +13 -2
- package/src/Subject/SubjectCarousel.tsx +10 -2
- package/src/Subject/SubjectLinks.tsx +4 -2
- package/src/Subject/SubjectNewContent.tsx +4 -2
- package/src/Subject/SubjectShortcuts.tsx +16 -11
- package/src/Subject/SubjectSocial.tsx +9 -2
- package/src/locale/messages-en.ts +6 -5
- package/src/locale/messages-nb.ts +6 -5
- package/src/locale/messages-nn.ts +6 -5
- package/src/locale/messages-se.ts +6 -5
- package/src/locale/messages-sma.ts +6 -5
- package/src/types.ts +2 -0
- package/es/Footer/privacy_en.js +0 -40
- package/es/Footer/privacy_nb.js +0 -40
- package/es/Footer/privacy_nn.js +0 -38
- package/lib/Footer/privacy_en.d.ts +0 -2
- package/lib/Footer/privacy_en.js +0 -46
- package/lib/Footer/privacy_nb.d.ts +0 -2
- package/lib/Footer/privacy_nb.js +0 -46
- package/lib/Footer/privacy_nn.d.ts +0 -2
- package/lib/Footer/privacy_nn.js +0 -44
- package/src/Footer/privacy_en.tsx +0 -52
- package/src/Footer/privacy_nb.tsx +0 -51
- package/src/Footer/privacy_nn.tsx +0 -51
|
@@ -8,31 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
|
-
import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
|
|
12
11
|
import { spacing, fonts, misc, mq, breakpoints } from '@ndla/core';
|
|
13
|
-
import {
|
|
14
|
-
import { Locale } from '../types';
|
|
15
|
-
|
|
16
|
-
import PrivacyNb from './privacy_nb';
|
|
17
|
-
import PrivacyNn from './privacy_nn';
|
|
18
|
-
import PrivacyEn from './privacy_en';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
19
13
|
|
|
20
14
|
type FooterPrivacyProps = {
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
privacyLinks: [
|
|
16
|
+
{
|
|
17
|
+
label: string;
|
|
18
|
+
url: string;
|
|
19
|
+
},
|
|
20
|
+
];
|
|
23
21
|
};
|
|
24
22
|
|
|
25
|
-
const
|
|
26
|
-
if (lang === 'nn') {
|
|
27
|
-
return <PrivacyNn />;
|
|
28
|
-
}
|
|
29
|
-
if (lang === 'en') {
|
|
30
|
-
return <PrivacyEn />;
|
|
31
|
-
}
|
|
32
|
-
return <PrivacyNb />;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const StyledPrivacyButton = styled.button`
|
|
23
|
+
const StyledPrivacyLink = styled.a`
|
|
36
24
|
background: none;
|
|
37
25
|
color: #fff;
|
|
38
26
|
border: 0;
|
|
@@ -40,6 +28,7 @@ const StyledPrivacyButton = styled.button`
|
|
|
40
28
|
box-shadow: ${misc.textLinkBoxShadow};
|
|
41
29
|
cursor: pointer;
|
|
42
30
|
margin-bottom: ${spacing.large};
|
|
31
|
+
margin-left: ${spacing.small};
|
|
43
32
|
&:hover,
|
|
44
33
|
&:focus {
|
|
45
34
|
box-shadow: none;
|
|
@@ -47,8 +36,9 @@ const StyledPrivacyButton = styled.button`
|
|
|
47
36
|
`;
|
|
48
37
|
const StyledFooterText = styled.div`
|
|
49
38
|
display: flex;
|
|
50
|
-
flex-direction:
|
|
39
|
+
flex-direction: row;
|
|
51
40
|
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
52
42
|
> span {
|
|
53
43
|
padding: ${spacing.xsmall} 0;
|
|
54
44
|
text-align: center;
|
|
@@ -67,22 +57,18 @@ const StyledFooterText = styled.div`
|
|
|
67
57
|
}
|
|
68
58
|
`;
|
|
69
59
|
|
|
70
|
-
const FooterPrivacy = ({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)}
|
|
84
|
-
</Modal>
|
|
85
|
-
</StyledFooterText>
|
|
86
|
-
);
|
|
60
|
+
const FooterPrivacy = ({ privacyLinks }: FooterPrivacyProps) => {
|
|
61
|
+
const { t } = useTranslation();
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<StyledFooterText>
|
|
65
|
+
{privacyLinks.map((link) => (
|
|
66
|
+
<StyledPrivacyLink href={link.url} key={link.label}>
|
|
67
|
+
{link.label}
|
|
68
|
+
</StyledPrivacyLink>
|
|
69
|
+
))}
|
|
70
|
+
</StyledFooterText>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
87
73
|
|
|
88
74
|
export default FooterPrivacy;
|
|
@@ -78,7 +78,9 @@ const FrontpageFilm = ({ url, imageUrl }: Props) => {
|
|
|
78
78
|
const { t } = useTranslation();
|
|
79
79
|
return (
|
|
80
80
|
<StyledSection>
|
|
81
|
-
<SectionHeading large>
|
|
81
|
+
<SectionHeading headingLevel="h2" large>
|
|
82
|
+
{t('welcomePage.film.header')}
|
|
83
|
+
</SectionHeading>
|
|
82
84
|
<StyledImage imageUrl={imageUrl}>
|
|
83
85
|
<StyledText>{t('welcomePage.film.text')}</StyledText>
|
|
84
86
|
<StyledText narrow>{t('welcomePage.film.textShort')}</StyledText>
|
|
@@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
import SectionHeading from '../SectionHeading';
|
|
7
7
|
import ComponentCursor from '../ComponentCursor';
|
|
8
8
|
import { MultidisciplinarySubjectIllustration as Illustration } from './illustrations/FrontpageIllustrations';
|
|
9
|
+
import { HeadingLevel } from '../types';
|
|
9
10
|
|
|
10
11
|
export const StyledSection = styled.section`
|
|
11
12
|
position: relative;
|
|
@@ -72,16 +73,19 @@ const Topic = styled.div`
|
|
|
72
73
|
type Props = {
|
|
73
74
|
url: string;
|
|
74
75
|
topics?: { url: string; title: string; id: string }[];
|
|
76
|
+
headingLevel: HeadingLevel;
|
|
75
77
|
};
|
|
76
78
|
|
|
77
|
-
const FrontpageMultidisciplinarySubject = ({ url, topics }: Props) => {
|
|
79
|
+
const FrontpageMultidisciplinarySubject = ({ url, topics, headingLevel }: Props) => {
|
|
78
80
|
const { t } = useTranslation();
|
|
79
81
|
return (
|
|
80
82
|
<StyledSection>
|
|
81
83
|
<ComponentCursor variant="left" text={t('frontpageMultidisciplinarySubject.cursorText')} />
|
|
82
84
|
<Wrapper>
|
|
83
85
|
<Content>
|
|
84
|
-
<SectionHeading
|
|
86
|
+
<SectionHeading headingLevel={headingLevel} large>
|
|
87
|
+
{t('frontpageMultidisciplinarySubject.heading')}
|
|
88
|
+
</SectionHeading>
|
|
85
89
|
{topics ? (
|
|
86
90
|
<Topics>
|
|
87
91
|
{topics.map((topic) => {
|
|
@@ -6,6 +6,7 @@ import { SafeLinkButton } from '@ndla/safelink';
|
|
|
6
6
|
import SectionHeading from '../SectionHeading';
|
|
7
7
|
import ComponentCursor from '../ComponentCursor';
|
|
8
8
|
import { ToolboxIllustration as Illustration } from './illustrations/FrontpageIllustrations';
|
|
9
|
+
import { HeadingLevel } from '../types';
|
|
9
10
|
|
|
10
11
|
const StyledSection = styled.section`
|
|
11
12
|
margin-top: ${spacing.large};
|
|
@@ -44,14 +45,17 @@ const StyledStudentsButton = styled(SafeLinkButton)`
|
|
|
44
45
|
type Props = {
|
|
45
46
|
urlStudents: string;
|
|
46
47
|
urlTeachers: string;
|
|
48
|
+
headingLevel: HeadingLevel;
|
|
47
49
|
};
|
|
48
50
|
|
|
49
|
-
const FrontpageToolbox = ({ urlStudents, urlTeachers }: Props) => {
|
|
51
|
+
const FrontpageToolbox = ({ urlStudents, urlTeachers, headingLevel }: Props) => {
|
|
50
52
|
const { t } = useTranslation();
|
|
51
53
|
return (
|
|
52
54
|
<StyledSection>
|
|
53
55
|
<ComponentCursor variant="left" text={t('frontPageToolbox.cursorText')} />
|
|
54
|
-
<SectionHeading
|
|
56
|
+
<SectionHeading headingLevel={headingLevel} large>
|
|
57
|
+
{t('frontPageToolbox.heading')}
|
|
58
|
+
</SectionHeading>
|
|
55
59
|
<ToolboxWrapper>
|
|
56
60
|
<StyledText>{t('frontPageToolbox.text')}</StyledText>
|
|
57
61
|
</ToolboxWrapper>
|
|
@@ -6,6 +6,7 @@ import SafeLink from '@ndla/safelink';
|
|
|
6
6
|
import { colors, fonts, spacing } from '@ndla/core';
|
|
7
7
|
|
|
8
8
|
import SectionHeading from '../SectionHeading';
|
|
9
|
+
import { HeadingLevel } from '../types';
|
|
9
10
|
|
|
10
11
|
interface InfoWidgetSectionProps {
|
|
11
12
|
center?: boolean;
|
|
@@ -64,6 +65,7 @@ const StyledMainLink = styled.a`
|
|
|
64
65
|
`;
|
|
65
66
|
interface Props {
|
|
66
67
|
heading: string;
|
|
68
|
+
headingLevel: HeadingLevel;
|
|
67
69
|
description: string;
|
|
68
70
|
mainLink: {
|
|
69
71
|
name: string;
|
|
@@ -79,9 +81,11 @@ interface Props {
|
|
|
79
81
|
center?: boolean;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
const InfoWidget = ({ heading, description, mainLink, iconLinks, center = false }: Props) => (
|
|
84
|
+
const InfoWidget = ({ heading, description, mainLink, iconLinks, headingLevel, center = false }: Props) => (
|
|
83
85
|
<InfoWidgetSection center={center}>
|
|
84
|
-
<SectionHeading
|
|
86
|
+
<SectionHeading headingLevel={headingLevel} large>
|
|
87
|
+
{heading}
|
|
88
|
+
</SectionHeading>
|
|
85
89
|
<InfoWidgetDescription>
|
|
86
90
|
<p>{description}</p>
|
|
87
91
|
</InfoWidgetDescription>
|
|
@@ -3,6 +3,7 @@ import BEMHelper from 'react-bem-helper';
|
|
|
3
3
|
import Button from '@ndla/button';
|
|
4
4
|
import SafeLink from '@ndla/safelink';
|
|
5
5
|
import SectionHeading from '../SectionHeading';
|
|
6
|
+
import { HeadingLevel } from '../types';
|
|
6
7
|
|
|
7
8
|
const classes = new BEMHelper({
|
|
8
9
|
name: 'related-articles',
|
|
@@ -51,13 +52,14 @@ interface Props {
|
|
|
51
52
|
showMore: string;
|
|
52
53
|
showLess: string;
|
|
53
54
|
};
|
|
55
|
+
headingLevel: HeadingLevel;
|
|
54
56
|
children?: ReactElement;
|
|
55
57
|
dangerouslySetInnerHTML?: {
|
|
56
58
|
__html: string;
|
|
57
59
|
};
|
|
58
60
|
articleCount?: number;
|
|
59
61
|
}
|
|
60
|
-
const RelatedArticleList = ({ messages, children, articleCount, dangerouslySetInnerHTML }: Props) => {
|
|
62
|
+
const RelatedArticleList = ({ messages, children, articleCount, dangerouslySetInnerHTML, headingLevel }: Props) => {
|
|
61
63
|
const clonedChildren =
|
|
62
64
|
!dangerouslySetInnerHTML && children
|
|
63
65
|
? Children.map(children, (article, i) =>
|
|
@@ -70,7 +72,9 @@ const RelatedArticleList = ({ messages, children, articleCount, dangerouslySetIn
|
|
|
70
72
|
|
|
71
73
|
return (
|
|
72
74
|
<section {...classes('')}>
|
|
73
|
-
<SectionHeading className={classes('component-title').className}>
|
|
75
|
+
<SectionHeading headingLevel={headingLevel} className={classes('component-title').className}>
|
|
76
|
+
{messages.title}
|
|
77
|
+
</SectionHeading>
|
|
74
78
|
<div {...classes('articles')} dangerouslySetInnerHTML={dangerouslySetInnerHTML}>
|
|
75
79
|
{clonedChildren}
|
|
76
80
|
</div>
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import React, { ElementType, ReactNode } from 'react';
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
4
|
-
import
|
|
4
|
+
import { HeadingLevel } from '../types';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
large?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const StyledWrapper = styled.h2<StyledWrapperProps>`
|
|
6
|
+
const headingStyle = css`
|
|
11
7
|
font-weight: ${fonts.weight.bold};
|
|
12
8
|
text-transform: uppercase;
|
|
13
9
|
letter-spacing: 0.05em;
|
|
@@ -15,31 +11,30 @@ const StyledWrapper = styled.h2<StyledWrapperProps>`
|
|
|
15
11
|
${mq.range({ from: breakpoints.tablet })} {
|
|
16
12
|
${fonts.sizes('20px', '26px')};
|
|
17
13
|
}
|
|
18
|
-
${(p) =>
|
|
19
|
-
p.large &&
|
|
20
|
-
css`
|
|
21
|
-
margin: 0 0 ${spacing.small} 0;
|
|
22
|
-
${fonts.sizes('16px', '32px')};
|
|
23
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
24
|
-
${fonts.sizes('22px')};
|
|
25
|
-
}
|
|
26
|
-
`};
|
|
27
14
|
`;
|
|
28
15
|
|
|
29
|
-
const
|
|
16
|
+
const largeHeadingStyle = css`
|
|
17
|
+
margin: 0 0 ${spacing.small} 0;
|
|
18
|
+
${fonts.sizes('16px', '32px')};
|
|
19
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
20
|
+
${fonts.sizes('22px')};
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
30
23
|
|
|
31
24
|
interface Props {
|
|
32
25
|
children: ReactNode;
|
|
33
26
|
large?: boolean;
|
|
34
27
|
className?: string;
|
|
28
|
+
headingLevel: HeadingLevel;
|
|
35
29
|
}
|
|
36
30
|
|
|
37
|
-
const SectionHeading = ({ children, large = false, className }: Props) => {
|
|
38
|
-
const
|
|
31
|
+
const SectionHeading = ({ children, large = false, className, headingLevel = 'h2' }: Props) => {
|
|
32
|
+
const Element: ElementType = headingLevel;
|
|
33
|
+
const styles = large ? [headingStyle, largeHeadingStyle] : [headingStyle];
|
|
39
34
|
return (
|
|
40
|
-
<
|
|
35
|
+
<Element css={styles} className={className}>
|
|
41
36
|
{children}
|
|
42
|
-
</
|
|
37
|
+
</Element>
|
|
43
38
|
);
|
|
44
39
|
};
|
|
45
40
|
|
package/src/Subject/Subject.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { breakpoints, colors, mq, spacing, spacingUnit } from '@ndla/core';
|
|
5
5
|
import SectionHeading from '../SectionHeading';
|
|
6
|
+
import { HeadingLevel } from '../types';
|
|
6
7
|
|
|
7
8
|
const SubjectContentWrapper = styled.div`
|
|
8
9
|
${mq.range({ from: breakpoints.tablet })} {
|
|
@@ -190,6 +191,13 @@ const StyledSectionHeading = styled(SectionHeading)`
|
|
|
190
191
|
}
|
|
191
192
|
`;
|
|
192
193
|
|
|
193
|
-
|
|
194
|
-
|
|
194
|
+
interface SubjectSectionTitleProps {
|
|
195
|
+
headingLevel: HeadingLevel;
|
|
196
|
+
children: ReactNode;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export const SubjectSectionTitle = ({ children, headingLevel = 'h2' }: SubjectSectionTitleProps) => (
|
|
200
|
+
<StyledSectionHeading large headingLevel={headingLevel}>
|
|
201
|
+
{children}
|
|
202
|
+
</StyledSectionHeading>
|
|
195
203
|
);
|
|
@@ -3,6 +3,7 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
5
5
|
import SectionHeading from '../SectionHeading';
|
|
6
|
+
import { HeadingLevel } from '../types';
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
fixedWidth?: boolean;
|
|
@@ -10,6 +11,7 @@ interface Props {
|
|
|
10
11
|
media: ReactNode;
|
|
11
12
|
heading: string;
|
|
12
13
|
description: string;
|
|
14
|
+
headingLevel: HeadingLevel;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
interface SubjectAboutSectionProps {
|
|
@@ -98,9 +100,11 @@ const StyledDescription = styled.p`
|
|
|
98
100
|
${fonts.sizes('16px', '26px')};
|
|
99
101
|
`;
|
|
100
102
|
|
|
101
|
-
const SubjectAbout = ({ fixedWidth = false, media, heading, description, wide = false }: Props) => (
|
|
103
|
+
const SubjectAbout = ({ fixedWidth = false, media, heading, description, wide = false, headingLevel }: Props) => (
|
|
102
104
|
<SubjectAboutSection wide={wide} fixedWidth={fixedWidth}>
|
|
103
|
-
<StyledSectionHeading
|
|
105
|
+
<StyledSectionHeading headingLevel={headingLevel} large>
|
|
106
|
+
{heading}
|
|
107
|
+
</StyledSectionHeading>
|
|
104
108
|
<MediaWrapper>{media}</MediaWrapper>
|
|
105
109
|
<StyledContent>
|
|
106
110
|
<StyledMainHeading>{heading}</StyledMainHeading>
|
|
@@ -5,6 +5,7 @@ import { Cross } from '@ndla/icons/action';
|
|
|
5
5
|
import { breakpoints, colors, fonts, mq, spacing, utils } from '@ndla/core';
|
|
6
6
|
import SafeLink from '@ndla/safelink';
|
|
7
7
|
import SectionHeading from '../SectionHeading';
|
|
8
|
+
import { HeadingLevel } from '../types';
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
featuringArticle: {
|
|
@@ -13,6 +14,7 @@ interface Props {
|
|
|
13
14
|
description: string;
|
|
14
15
|
url: string;
|
|
15
16
|
};
|
|
17
|
+
headingLevel: HeadingLevel;
|
|
16
18
|
archiveArticles: { url: string; heading: string }[];
|
|
17
19
|
sectionHeading: string;
|
|
18
20
|
fixedWidth?: boolean;
|
|
@@ -155,7 +157,14 @@ class SubjectArchive extends Component<Props, State> {
|
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
render() {
|
|
158
|
-
const {
|
|
160
|
+
const {
|
|
161
|
+
fixedWidth = false,
|
|
162
|
+
headingLevel,
|
|
163
|
+
featuringArticle,
|
|
164
|
+
messages,
|
|
165
|
+
sectionHeading,
|
|
166
|
+
archiveArticles,
|
|
167
|
+
} = this.props;
|
|
159
168
|
|
|
160
169
|
const archiveId = 'subject-archive';
|
|
161
170
|
|
|
@@ -183,7 +192,9 @@ class SubjectArchive extends Component<Props, State> {
|
|
|
183
192
|
|
|
184
193
|
return (
|
|
185
194
|
<SubjectArchiveSection animate={!!this.state.minHeight} fixedWidth={fixedWidth} ref={this.wrapperRef}>
|
|
186
|
-
<StyledSectionHeading
|
|
195
|
+
<StyledSectionHeading headingLevel={headingLevel} large>
|
|
196
|
+
{sectionHeading}
|
|
197
|
+
</StyledSectionHeading>
|
|
187
198
|
<ArchiveWrapper>
|
|
188
199
|
{section}
|
|
189
200
|
<ArchiveButon
|
|
@@ -7,6 +7,7 @@ import { breakpoints, mq, spacing, spacingUnit } from '@ndla/core';
|
|
|
7
7
|
import { SafeLinkProps } from '@ndla/safelink';
|
|
8
8
|
import { ContentCard } from '../index';
|
|
9
9
|
import { SubjectSectionTitle } from './Subject';
|
|
10
|
+
import { HeadingLevel } from '../types';
|
|
10
11
|
|
|
11
12
|
interface Props {
|
|
12
13
|
subjects?: {
|
|
@@ -17,6 +18,7 @@ interface Props {
|
|
|
17
18
|
image?: string | undefined | null;
|
|
18
19
|
toLinkProps: () => SafeLinkProps;
|
|
19
20
|
}[];
|
|
21
|
+
headingLevel: HeadingLevel;
|
|
20
22
|
title?: string;
|
|
21
23
|
narrowScreen?: boolean;
|
|
22
24
|
wideScreen?: boolean;
|
|
@@ -59,7 +61,13 @@ const StyledSubjectSectionTitle = styled(SubjectSectionTitle)`
|
|
|
59
61
|
}
|
|
60
62
|
`;
|
|
61
63
|
|
|
62
|
-
const SubjectCarousel = ({
|
|
64
|
+
const SubjectCarousel = ({
|
|
65
|
+
subjects = [],
|
|
66
|
+
title = '',
|
|
67
|
+
narrowScreen = false,
|
|
68
|
+
wideScreen = false,
|
|
69
|
+
headingLevel,
|
|
70
|
+
}: Props) => {
|
|
63
71
|
const { t } = useTranslation();
|
|
64
72
|
return (
|
|
65
73
|
<StyledSection narrowScreen={narrowScreen} wideScreen={wideScreen}>
|
|
@@ -124,7 +132,7 @@ const SubjectCarousel = ({ subjects = [], title = '', narrowScreen = false, wide
|
|
|
124
132
|
itemsLength={subjects?.length ?? 0}>
|
|
125
133
|
{(autoSizedProps) => (
|
|
126
134
|
<>
|
|
127
|
-
<StyledSubjectSectionTitle>{title}</StyledSubjectSectionTitle>
|
|
135
|
+
<StyledSubjectSectionTitle headingLevel={headingLevel}>{title}</StyledSubjectSectionTitle>
|
|
128
136
|
<Carousel
|
|
129
137
|
{...autoSizedProps}
|
|
130
138
|
disableScroll={(autoSizedProps?.columnsPrSlide ?? 0) >= subjects.length}
|
|
@@ -4,6 +4,7 @@ import { spacing } from '@ndla/core';
|
|
|
4
4
|
import SafeLink, { SafeLinkProps } from '@ndla/safelink';
|
|
5
5
|
|
|
6
6
|
import { SubjectSectionTitle } from './Subject';
|
|
7
|
+
import { HeadingLevel } from '../types';
|
|
7
8
|
|
|
8
9
|
const SubjectLinksSection = styled.section`
|
|
9
10
|
margin-bottom: ${spacing.large};
|
|
@@ -20,6 +21,7 @@ const SubjectLinksList = styled.ul`
|
|
|
20
21
|
`;
|
|
21
22
|
|
|
22
23
|
interface Props {
|
|
24
|
+
headingLevel: HeadingLevel;
|
|
23
25
|
links: {
|
|
24
26
|
toLinkProps: () => SafeLinkProps;
|
|
25
27
|
text: string;
|
|
@@ -27,9 +29,9 @@ interface Props {
|
|
|
27
29
|
heading: string;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
const SubjectLinks = ({ links, heading }: Props) => (
|
|
32
|
+
const SubjectLinks = ({ links, heading, headingLevel }: Props) => (
|
|
31
33
|
<SubjectLinksSection>
|
|
32
|
-
<StyledSubjectSectionTitle>{heading}</StyledSubjectSectionTitle>
|
|
34
|
+
<StyledSubjectSectionTitle headingLevel={headingLevel}>{heading}</StyledSubjectSectionTitle>
|
|
33
35
|
<nav>
|
|
34
36
|
<SubjectLinksList>
|
|
35
37
|
{links.map((link) => (
|
|
@@ -4,8 +4,10 @@ import SafeLink from '@ndla/safelink';
|
|
|
4
4
|
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
5
5
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
6
6
|
import { SubjectSectionTitle } from './Subject';
|
|
7
|
+
import { HeadingLevel } from '../types';
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
10
|
+
headingLevel: HeadingLevel;
|
|
9
11
|
heading: string;
|
|
10
12
|
content: {
|
|
11
13
|
name: string;
|
|
@@ -86,9 +88,9 @@ const StyledSafeLink = styled(SafeLink)`
|
|
|
86
88
|
}
|
|
87
89
|
`;
|
|
88
90
|
|
|
89
|
-
const SubjectNewContent = ({ heading, content }: Props) => (
|
|
91
|
+
const SubjectNewContent = ({ heading, content, headingLevel }: Props) => (
|
|
90
92
|
<StyledSection>
|
|
91
|
-
<StyledSubjectSectionTitle>{heading}</StyledSubjectSectionTitle>
|
|
93
|
+
<StyledSubjectSectionTitle headingLevel={headingLevel}>{heading}</StyledSubjectSectionTitle>
|
|
92
94
|
<nav>
|
|
93
95
|
<StyledUl>
|
|
94
96
|
{content.map((item, index) => (
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022-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
|
+
|
|
1
9
|
import React, { Component } from 'react';
|
|
2
|
-
import { TransitionGroup } from 'react-transition-group';
|
|
3
10
|
import styled from '@emotion/styled';
|
|
4
11
|
import { colors, fonts, spacing } from '@ndla/core';
|
|
5
12
|
import { Forward } from '@ndla/icons/common';
|
|
6
13
|
import SafeLink from '@ndla/safelink';
|
|
7
14
|
import { SubjectSectionTitle } from './Subject';
|
|
8
15
|
import Fade from '../Animation/Fade';
|
|
16
|
+
import { HeadingLevel } from '../types';
|
|
9
17
|
|
|
10
18
|
const SubjectShortcutsSection = styled.section`
|
|
11
19
|
margin-bottom: ${spacing.large};
|
|
12
20
|
`;
|
|
13
21
|
|
|
14
|
-
const
|
|
22
|
+
const StyledList = styled.ul`
|
|
15
23
|
display: flex;
|
|
16
24
|
flex-wrap: wrap;
|
|
17
25
|
list-style: none;
|
|
@@ -23,7 +31,6 @@ const StyledListItem = styled.li`
|
|
|
23
31
|
display: block;
|
|
24
32
|
margin-right: 9px;
|
|
25
33
|
margin-bottom: 9px;
|
|
26
|
-
|
|
27
34
|
a {
|
|
28
35
|
display: block;
|
|
29
36
|
background: ${colors.brand.light};
|
|
@@ -33,7 +40,6 @@ const StyledListItem = styled.li`
|
|
|
33
40
|
font-weight: ${fonts.weight.semibold};
|
|
34
41
|
color: ${colors.brand.dark};
|
|
35
42
|
padding: 9px 20px;
|
|
36
|
-
|
|
37
43
|
&:hover,
|
|
38
44
|
&:active,
|
|
39
45
|
&:focus {
|
|
@@ -52,13 +58,11 @@ const StyledButton = styled.button`
|
|
|
52
58
|
color: ${colors.brand};
|
|
53
59
|
margin-top: ${spacing.normal};
|
|
54
60
|
cursor: pointer;
|
|
55
|
-
|
|
56
61
|
.c-icon {
|
|
57
62
|
width: 18px;
|
|
58
63
|
height: 18px;
|
|
59
64
|
margin-right: ${spacing.xsmall};
|
|
60
65
|
}
|
|
61
|
-
|
|
62
66
|
span {
|
|
63
67
|
${fonts.sizes('14px', '18px')};
|
|
64
68
|
}
|
|
@@ -69,6 +73,7 @@ interface Props {
|
|
|
69
73
|
url: string;
|
|
70
74
|
text: string;
|
|
71
75
|
}[];
|
|
76
|
+
headingLevel: HeadingLevel;
|
|
72
77
|
messages: {
|
|
73
78
|
heading: string;
|
|
74
79
|
showMore: string;
|
|
@@ -102,7 +107,7 @@ class SubjectShortcuts extends Component<Props, State> {
|
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
render() {
|
|
105
|
-
const { links, messages, defaultVisableCount } = this.props;
|
|
110
|
+
const { links, messages, defaultVisableCount, headingLevel } = this.props;
|
|
106
111
|
const id = 'subject-shortcut';
|
|
107
112
|
|
|
108
113
|
const showExpand = defaultVisableCount < links.length;
|
|
@@ -128,17 +133,17 @@ class SubjectShortcuts extends Component<Props, State> {
|
|
|
128
133
|
}
|
|
129
134
|
return (
|
|
130
135
|
<SubjectShortcutsSection>
|
|
131
|
-
<SubjectSectionTitle>{messages.heading}</SubjectSectionTitle>
|
|
136
|
+
<SubjectSectionTitle headingLevel={headingLevel}>{messages.heading}</SubjectSectionTitle>
|
|
132
137
|
<nav id={id}>
|
|
133
|
-
<
|
|
138
|
+
<StyledList>
|
|
134
139
|
{filteredLinks.map((link) => (
|
|
135
|
-
<Fade key={link.url}>
|
|
140
|
+
<Fade key={link.url} show={true}>
|
|
136
141
|
<StyledListItem>
|
|
137
142
|
<SafeLink to={link.url}>{link.text}</SafeLink>
|
|
138
143
|
</StyledListItem>
|
|
139
144
|
</Fade>
|
|
140
145
|
))}
|
|
141
|
-
</
|
|
146
|
+
</StyledList>
|
|
142
147
|
</nav>
|
|
143
148
|
{button}
|
|
144
149
|
</SubjectShortcutsSection>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { breakpoints, mq, spacing } from '@ndla/core';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
|
+
import { HeadingLevel } from '../types';
|
|
4
5
|
import { SubjectSectionTitle } from './Subject';
|
|
5
6
|
|
|
6
7
|
const StyledSubjectSocialContent = styled.div`
|
|
@@ -21,9 +22,15 @@ const StyledSection = styled.section`
|
|
|
21
22
|
}
|
|
22
23
|
`;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
interface SubjectSocialSectionProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
title?: string;
|
|
28
|
+
headingLevel: HeadingLevel;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const SubjectSocialSection = ({ children, title = '', headingLevel }: SubjectSocialSectionProps) => (
|
|
25
32
|
<StyledSection>
|
|
26
|
-
<SubjectSectionTitle>{title}</SubjectSectionTitle>
|
|
33
|
+
<SubjectSectionTitle headingLevel={headingLevel}>{title}</SubjectSectionTitle>
|
|
27
34
|
{children}
|
|
28
35
|
</StyledSection>
|
|
29
36
|
);
|
|
@@ -618,12 +618,13 @@ const messages = {
|
|
|
618
618
|
footer: {
|
|
619
619
|
aboutNDLA: 'About NDLA',
|
|
620
620
|
selectLanguage: 'Choose language (språk): ',
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
621
|
+
info: 'This webapplication is developed by NDLA as Open Source code.',
|
|
622
|
+
editorInChief: 'Editor in chief: ',
|
|
623
|
+
managingEditor: 'Managing editor: ',
|
|
624
|
+
linksHeader: 'Other NDLA sites',
|
|
625
|
+
privacyLink: 'Privacy statement',
|
|
626
|
+
cookiesLink: 'Statement about cookies',
|
|
625
627
|
vision: 'We create the learning of the future together',
|
|
626
|
-
footerLinksHeader: 'Other NDLA sites',
|
|
627
628
|
socialMediaLinks: {
|
|
628
629
|
facebook: 'NDLA on Facebook',
|
|
629
630
|
facebookAria: 'Visit NDLA on Facebook',
|
|
@@ -618,11 +618,12 @@ const messages = {
|
|
|
618
618
|
aboutNDLA: 'Om NDLA',
|
|
619
619
|
selectLanguage: 'Velg språk (language): ',
|
|
620
620
|
vision: 'Sammen skaper vi framtidas læring',
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
621
|
+
linksHeader: 'Andre NDLA-nettsteder',
|
|
622
|
+
info: 'Nettstedet er utarbeidet av NDLA med åpen kildekode.',
|
|
623
|
+
editorInChief: 'Ansvarlig redaktør: ',
|
|
624
|
+
managingEditor: 'Utgaveansvarlig: ',
|
|
625
|
+
privacyLink: 'Personvernerklæring',
|
|
626
|
+
cookiesLink: 'Erklæring om informasjonskapslar',
|
|
626
627
|
socialMediaLinks: {
|
|
627
628
|
facebook: 'NDLA på Facebook',
|
|
628
629
|
facebookAria: 'Besøk NDLA på Facebook',
|
|
@@ -619,11 +619,12 @@ const messages = {
|
|
|
619
619
|
aboutNDLA: 'Om NDLA',
|
|
620
620
|
selectLanguage: 'Vel språk (language): ',
|
|
621
621
|
vision: 'Saman skapar vi framtidas læring',
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
622
|
+
linksHeader: 'Andre NDLA-nettstader',
|
|
623
|
+
info: 'Nettstaden er utarbeida av NDLA med open kjeldekode.',
|
|
624
|
+
editorInChief: 'Ansvarleg redaktør: ',
|
|
625
|
+
managingEditor: 'Utgåveansvarleg: ',
|
|
626
|
+
privacyLink: 'Personvernerklæring og cookies',
|
|
627
|
+
cookiesLink: 'Erklæring om informasjonskapslar',
|
|
627
628
|
socialMediaLinks: {
|
|
628
629
|
facebook: 'NDLA på Facebook',
|
|
629
630
|
facebookAria: 'Besøk NDLA på Facebook',
|