@ndla/ui 3.3.9 → 3.3.14
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/Article/Article.js +23 -1
- package/es/Article/ArticleNotions.js +80 -32
- package/es/Breadcrumblist/Breadcrumblist.js +14 -10
- package/es/CloseButton/CloseButton.js +62 -0
- package/es/CloseButton/index.js +9 -0
- package/es/Figure/Figure.js +3 -1
- package/es/Frontpage/FrontpageAllSubjects.js +7 -7
- package/es/Frontpage/FrontpageProgramMenu.js +10 -10
- package/es/Frontpage/FrontpageSearch.js +2 -4
- package/es/MediaList/MediaList.js +22 -73
- package/es/MessageBox/MessageBox.js +146 -78
- package/es/MessageBox/MessageBoxTag.js +37 -0
- package/es/MessageBox/index.js +3 -1
- package/es/NDLAFilm/AboutNdlaFilm.js +6 -17
- package/es/NDLAFilm/AllMoviesAlphabetically.js +11 -11
- package/es/NDLAFilm/CategorySelect.js +17 -18
- package/es/NDLAFilm/FilmContentCard.js +8 -22
- package/es/NDLAFilm/FilmContentCardTags.js +4 -8
- package/es/NDLAFilm/FilmMovieList.js +6 -21
- package/es/NDLAFilm/FilmMovieSearch.js +18 -26
- package/es/NDLAFilm/FilmSlideshow.js +2 -1
- package/es/NDLAFilm/MovieGrid.js +10 -19
- package/es/NDLAFilm/VisualElement.js +22 -29
- package/es/Programme/Programme.js +15 -8
- package/es/Search/SearchResultSleeve.js +12 -15
- package/es/SearchTypeResult/SearchFieldHeader.js +5 -5
- package/es/SearchTypeResult/SearchHeader.js +9 -9
- package/es/SearchTypeResult/SearchItem.js +19 -19
- package/es/SearchTypeResult/SearchNotionItem.js +12 -12
- package/es/SearchTypeResult/SearchNotionsResult.js +9 -14
- package/es/TopicIntroductionList/TopicIntroduction.js +14 -33
- package/es/TopicIntroductionList/TopicIntroductionList.js +6 -23
- package/es/TopicIntroductionList/TopicIntroductionShortcuts.js +71 -110
- package/es/TopicIntroductionList/TopicShortcutItem.js +0 -9
- package/es/all.css +1 -4
- package/es/index-javascript.js +1 -5
- package/es/index.js +6 -1
- package/es/locale/messages-en.js +10 -0
- package/es/locale/messages-nb.js +10 -0
- package/es/locale/messages-nn.js +10 -0
- package/es/shapes.js +0 -6
- package/lib/Article/Article.d.ts +3 -1
- package/lib/Article/Article.js +25 -3
- package/lib/Article/ArticleNotions.js +79 -30
- package/lib/Breadcrumblist/Breadcrumblist.d.ts +2 -1
- package/lib/Breadcrumblist/Breadcrumblist.js +15 -10
- package/lib/CloseButton/CloseButton.d.ts +6 -0
- package/lib/CloseButton/CloseButton.js +69 -0
- package/lib/CloseButton/index.d.ts +9 -0
- package/lib/CloseButton/index.js +15 -0
- package/lib/Figure/Figure.js +3 -1
- package/lib/Frontpage/FrontpageAllSubjects.d.ts +1 -1
- package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
- package/lib/Frontpage/FrontpageProgramMenu.js +10 -10
- package/lib/Frontpage/FrontpageSearch.d.ts +3 -5
- package/lib/Frontpage/FrontpageSearch.js +2 -4
- package/lib/MediaList/MediaList.d.ts +48 -0
- package/lib/MediaList/MediaList.js +24 -78
- package/lib/MediaList/index.d.ts +8 -0
- package/lib/MessageBox/MessageBox.d.ts +22 -6
- package/lib/MessageBox/MessageBox.js +146 -77
- package/lib/MessageBox/MessageBoxTag.d.ts +12 -0
- package/lib/MessageBox/MessageBoxTag.js +44 -0
- package/lib/MessageBox/index.d.ts +3 -1
- package/lib/MessageBox/index.js +22 -2
- package/lib/NDLAFilm/AboutNdlaFilm.d.ts +15 -0
- package/lib/NDLAFilm/AboutNdlaFilm.js +6 -18
- package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +2 -2
- package/lib/NDLAFilm/AllMoviesAlphabetically.js +11 -11
- package/lib/NDLAFilm/CategorySelect.d.ts +11 -0
- package/lib/NDLAFilm/CategorySelect.js +20 -19
- package/lib/NDLAFilm/FilmContentCard.d.ts +11 -0
- package/lib/NDLAFilm/FilmContentCard.js +8 -23
- package/lib/NDLAFilm/FilmContentCardTags.d.ts +7 -0
- package/lib/NDLAFilm/FilmContentCardTags.js +4 -9
- package/lib/NDLAFilm/FilmMovieList.d.ts +19 -0
- package/lib/NDLAFilm/FilmMovieList.js +5 -21
- package/lib/NDLAFilm/FilmMovieSearch.d.ts +21 -0
- package/lib/NDLAFilm/FilmMovieSearch.js +25 -30
- package/lib/NDLAFilm/FilmSlideshow.d.ts +5 -5
- package/lib/NDLAFilm/MovieGrid.d.ts +13 -0
- package/lib/NDLAFilm/MovieGrid.js +9 -21
- package/lib/NDLAFilm/SlideshowIndicator.d.ts +2 -2
- package/lib/NDLAFilm/VisualElement.d.ts +16 -0
- package/lib/NDLAFilm/VisualElement.js +22 -30
- package/lib/NDLAFilm/index.d.ts +14 -0
- package/lib/NDLAFilm/types.d.ts +6 -4
- package/lib/Programme/Programme.d.ts +2 -1
- package/lib/Programme/Programme.js +18 -9
- package/lib/Search/SearchResultSleeve.d.ts +4 -6
- package/lib/Search/SearchResultSleeve.js +10 -11
- package/lib/SearchTypeResult/SearchFieldHeader.d.ts +3 -3
- package/lib/SearchTypeResult/SearchFieldHeader.js +5 -5
- package/lib/SearchTypeResult/SearchHeader.d.ts +3 -3
- package/lib/SearchTypeResult/SearchHeader.js +9 -9
- package/lib/SearchTypeResult/SearchItem.d.ts +2 -3
- package/lib/SearchTypeResult/SearchItem.js +19 -19
- package/lib/SearchTypeResult/SearchNotionItem.d.ts +1 -1
- package/lib/SearchTypeResult/SearchNotionItem.js +12 -12
- package/lib/SearchTypeResult/SearchNotionsResult.js +8 -13
- package/lib/SearchTypeResult/index.d.ts +1 -0
- package/lib/TopicIntroductionList/TopicIntroduction.d.ts +21 -0
- package/lib/TopicIntroductionList/TopicIntroduction.js +16 -36
- package/lib/TopicIntroductionList/TopicIntroductionList.d.ts +35 -0
- package/lib/TopicIntroductionList/TopicIntroductionList.js +6 -25
- package/lib/TopicIntroductionList/TopicIntroductionShortcuts.d.ts +8 -0
- package/lib/TopicIntroductionList/TopicIntroductionShortcuts.js +72 -110
- package/lib/TopicIntroductionList/TopicShortcutItem.d.ts +6 -0
- package/lib/TopicIntroductionList/TopicShortcutItem.js +0 -11
- package/lib/TopicIntroductionList/index.d.ts +9 -0
- package/lib/all.css +1 -4
- package/lib/index-javascript.js +3 -137
- package/lib/index.d.ts +6 -1
- package/lib/index.js +178 -0
- package/lib/locale/messages-en.d.ts +10 -0
- package/lib/locale/messages-en.js +10 -0
- package/lib/locale/messages-nb.d.ts +10 -0
- package/lib/locale/messages-nb.js +10 -0
- package/lib/locale/messages-nn.d.ts +10 -0
- package/lib/locale/messages-nn.js +10 -0
- package/lib/shapes.js +1 -10
- package/lib/types.d.ts +2 -2
- package/package.json +12 -12
- package/src/Article/Article.tsx +17 -0
- package/src/Article/ArticleNotions.tsx +10 -7
- package/src/Breadcrumblist/Breadcrumblist.tsx +5 -3
- package/src/CloseButton/CloseButton.tsx +40 -0
- package/src/CloseButton/index.ts +11 -0
- package/src/Figure/Figure.tsx +2 -1
- package/src/Figure/component.figure.scss +37 -3
- package/src/Frontpage/FrontpageAllSubjects.tsx +2 -2
- package/src/Frontpage/FrontpageProgramMenu.tsx +1 -0
- package/src/Frontpage/FrontpageSearch.tsx +3 -7
- package/src/MediaList/MediaList.tsx +158 -0
- package/src/MediaList/{index.js → index.ts} +0 -0
- package/src/MessageBox/MessageBox.tsx +117 -96
- package/src/MessageBox/MessageBoxTag.tsx +35 -0
- package/src/MessageBox/index.ts +3 -1
- package/src/NDLAFilm/{AboutNdlaFilm.jsx → AboutNdlaFilm.tsx} +19 -18
- package/src/NDLAFilm/AllMoviesAlphabetically.tsx +3 -3
- package/src/NDLAFilm/{CategorySelect.jsx → CategorySelect.tsx} +23 -20
- package/src/NDLAFilm/{FilmContentCard.jsx → FilmContentCard.tsx} +21 -21
- package/src/NDLAFilm/{FilmContentCardTags.jsx → FilmContentCardTags.tsx} +7 -7
- package/src/NDLAFilm/{FilmMovieList.jsx → FilmMovieList.tsx} +17 -27
- package/src/NDLAFilm/FilmMovieSearch.tsx +71 -0
- package/src/NDLAFilm/FilmSlideshow.tsx +7 -6
- package/src/NDLAFilm/MovieGrid.tsx +76 -0
- package/src/NDLAFilm/SlideshowIndicator.tsx +2 -2
- package/src/NDLAFilm/VisualElement.tsx +40 -0
- package/src/NDLAFilm/{index.js → index.ts} +0 -0
- package/src/NDLAFilm/types.ts +7 -4
- package/src/Programme/Programme.tsx +7 -3
- package/src/Search/SearchResultSleeve.tsx +7 -19
- package/src/SearchTypeResult/SearchFieldHeader.tsx +3 -3
- package/src/SearchTypeResult/SearchHeader.tsx +3 -3
- package/src/SearchTypeResult/SearchItem.tsx +4 -5
- package/src/SearchTypeResult/SearchNotionItem.tsx +1 -2
- package/src/SearchTypeResult/SearchNotionsResult.tsx +3 -8
- package/src/SearchTypeResult/index.ts +2 -0
- package/src/TopicIntroductionList/{TopicIntroduction.jsx → TopicIntroduction.tsx} +22 -35
- package/src/TopicIntroductionList/{TopicIntroductionList.jsx → TopicIntroductionList.tsx} +32 -26
- package/src/TopicIntroductionList/TopicIntroductionShortcuts.tsx +71 -0
- package/src/TopicIntroductionList/{TopicShortcutItem.jsx → TopicShortcutItem.tsx} +5 -13
- package/src/TopicIntroductionList/{index.js → index.ts} +0 -0
- package/src/index-javascript.js +0 -30
- package/src/index.ts +33 -1
- package/src/locale/messages-en.ts +14 -0
- package/src/locale/messages-nb.ts +14 -0
- package/src/locale/messages-nn.ts +14 -0
- package/src/shapes.js +0 -7
- package/src/types.ts +2 -2
- package/es/NDLAFilm/interfaces.js +0 -0
- package/es/NDLAFilm/shapes.js +0 -15
- package/lib/NDLAFilm/interfaces.d.ts +0 -10
- package/lib/NDLAFilm/interfaces.js +0 -1
- package/lib/NDLAFilm/shapes.d.ts +0 -15
- package/lib/NDLAFilm/shapes.js +0 -30
- package/src/MediaList/MediaList.jsx +0 -182
- package/src/NDLAFilm/FilmMovieSearch.jsx +0 -66
- package/src/NDLAFilm/MovieGrid.jsx +0 -75
- package/src/NDLAFilm/VisualElement.jsx +0 -48
- package/src/NDLAFilm/interfaces.ts +0 -10
- package/src/NDLAFilm/shapes.ts +0 -17
- package/src/TopicIntroductionList/TopicIntroductionShortcuts.jsx +0 -92
|
@@ -1,63 +1,92 @@
|
|
|
1
|
-
|
|
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
|
+
|
|
9
|
+
import React, { useState } from 'react';
|
|
2
10
|
import styled from '@emotion/styled';
|
|
3
11
|
import Sticky from 'react-sticky-el';
|
|
4
12
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
5
|
-
|
|
6
|
-
import Button from '@ndla/button';
|
|
7
|
-
import { Cross } from '@ndla/icons/action';
|
|
8
|
-
import { InformationOutline } from '@ndla/icons/common';
|
|
13
|
+
import { InformationOutline, HumanMaleBoard } from '@ndla/icons/common';
|
|
9
14
|
import { WithTranslation, withTranslation } from 'react-i18next';
|
|
15
|
+
import { CloseButton } from '../CloseButton';
|
|
10
16
|
|
|
17
|
+
export enum MessageBoxType {
|
|
18
|
+
ghost = 'ghost',
|
|
19
|
+
fullpage = 'fullpage',
|
|
20
|
+
medium = 'medium',
|
|
21
|
+
}
|
|
11
22
|
type WrapperProps = {
|
|
12
|
-
boxType?:
|
|
23
|
+
boxType?: MessageBoxType;
|
|
13
24
|
};
|
|
14
25
|
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
const StyleByType = (type: WrapperProps['boxType']) => {
|
|
27
|
+
const styles = {
|
|
28
|
+
margin: '1px',
|
|
29
|
+
color: '#444444',
|
|
30
|
+
backgroundColor: '#f9f4c8',
|
|
31
|
+
border: 'none',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
width: 'auto',
|
|
34
|
+
position: 'relative',
|
|
35
|
+
transform: 'auto',
|
|
36
|
+
left: 'auto',
|
|
37
|
+
}; //Different CSS properties for different types of message-boxes
|
|
20
38
|
switch (type) {
|
|
21
|
-
case '
|
|
22
|
-
|
|
39
|
+
case 'fullpage':
|
|
40
|
+
styles.margin = '0 auto';
|
|
41
|
+
styles.display = 'none';
|
|
42
|
+
styles.width = '100vw';
|
|
43
|
+
styles.position = 'relative';
|
|
44
|
+
styles.left = '50%';
|
|
45
|
+
styles.transform = 'translateX(-50%)';
|
|
46
|
+
break;
|
|
47
|
+
case 'medium':
|
|
48
|
+
styles.margin = '0px';
|
|
49
|
+
break;
|
|
50
|
+
case 'ghost':
|
|
51
|
+
styles.backgroundColor = 'transparent';
|
|
52
|
+
styles.border = '1px solid #D1D6DB';
|
|
53
|
+
styles.color = '#444444';
|
|
54
|
+
|
|
23
55
|
break;
|
|
24
56
|
}
|
|
25
|
-
return
|
|
57
|
+
return styles;
|
|
26
58
|
};
|
|
27
59
|
|
|
28
60
|
const Wrapper = styled.div<WrapperProps>`
|
|
29
|
-
background: ${(props) =>
|
|
30
|
-
color: ${(props) =>
|
|
61
|
+
background: ${(props) => StyleByType(props.boxType).backgroundColor};
|
|
62
|
+
color: ${(props) => StyleByType(props.boxType).color};
|
|
31
63
|
font-size: 18px;
|
|
32
64
|
line-height: 32px;
|
|
33
|
-
|
|
65
|
+
font-family: ${fonts.sans};
|
|
34
66
|
display: flex;
|
|
35
67
|
padding: ${spacing.small};
|
|
36
|
-
position:
|
|
68
|
+
position: ${(props) => StyleByType(props.boxType).position};
|
|
69
|
+
border: ${(props) => StyleByType(props.boxType).border};
|
|
70
|
+
border-radius: 5px;
|
|
71
|
+
transform: ${(props) => StyleByType(props.boxType).transform};
|
|
72
|
+
left: ${(props) => StyleByType(props.boxType).left};
|
|
73
|
+
z-index: 10;
|
|
74
|
+
width: ${(props) => StyleByType(props.boxType).width};
|
|
37
75
|
`;
|
|
38
76
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
margin-right: ${spacing.small};
|
|
43
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
44
|
-
font-size: 18px;
|
|
45
|
-
font-weight: ${fonts.weight.semibold};
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
const InfoWrapper = styled.div`
|
|
50
|
-
margin: 0 auto;
|
|
51
|
-
padding: 0 100px;
|
|
77
|
+
const InfoWrapper = styled.div<WrapperProps>`
|
|
78
|
+
margin: ${(props) => StyleByType(props.boxType).margin};
|
|
79
|
+
padding: 10px;
|
|
52
80
|
display: flex;
|
|
53
81
|
${mq.range({ until: breakpoints.tabletWide })} {
|
|
54
82
|
padding: 0 90px 0 0;
|
|
55
83
|
}
|
|
56
84
|
${mq.range({ until: breakpoints.mobileWide })} {
|
|
57
|
-
padding: 0
|
|
85
|
+
padding: 0 5px 0 0;
|
|
86
|
+
font-size: 16px;
|
|
58
87
|
}
|
|
59
88
|
`;
|
|
60
|
-
const TextWrapper = styled.div
|
|
89
|
+
const TextWrapper = styled.div<WrapperProps>`
|
|
61
90
|
display: flex;
|
|
62
91
|
align-items: center;
|
|
63
92
|
flex-wrap: wrap;
|
|
@@ -67,88 +96,80 @@ const TextWrapper = styled.div`
|
|
|
67
96
|
}
|
|
68
97
|
`;
|
|
69
98
|
|
|
70
|
-
const IconWrapper = styled.div
|
|
99
|
+
const IconWrapper = styled.div<WrapperProps>`
|
|
71
100
|
padding-right: ${spacing.small};
|
|
72
|
-
display:
|
|
101
|
+
display: ${(props) => StyleByType(props.boxType).display};
|
|
73
102
|
align-items: flex-start;
|
|
74
103
|
${mq.range({ from: breakpoints.tabletWide })} {
|
|
75
104
|
padding-top: 4px;
|
|
76
105
|
}
|
|
77
106
|
`;
|
|
78
107
|
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
const CloseButton = styled(Button)`
|
|
91
|
-
display: flex;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
align-items: center;
|
|
94
|
-
font-weight: ${fonts.weight.semibold};
|
|
95
|
-
font-size: 16px;
|
|
96
|
-
color: ${(props) => colorsByType(props.boxType).color};
|
|
97
|
-
&:hover {
|
|
98
|
-
color: ${(props) => colorsByType(props.boxType).color};
|
|
99
|
-
}
|
|
108
|
+
const LinkWrapper = styled.div`
|
|
109
|
+
display: block;
|
|
110
|
+
width: 100%;
|
|
111
|
+
background-color: #f9f4c8;
|
|
112
|
+
padding-bottom: 20px;
|
|
113
|
+
margin-top: -2px;
|
|
114
|
+
padding-left: 58px;
|
|
115
|
+
border-radius: 0px 0px 5px 5px;
|
|
100
116
|
${mq.range({ until: breakpoints.mobileWide })} {
|
|
101
|
-
|
|
117
|
+
padding-left: 45px;
|
|
102
118
|
}
|
|
103
119
|
`;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
const Link = styled.a`
|
|
121
|
+
color: #20588f;
|
|
122
|
+
font-size: 16px;
|
|
123
|
+
padding-bottom: 1px;
|
|
124
|
+
margin: 0px 40px 1px 2px;
|
|
125
|
+
font-family: ${fonts.sans};
|
|
108
126
|
${mq.range({ until: breakpoints.mobileWide })} {
|
|
109
|
-
margin
|
|
110
|
-
|
|
111
|
-
font-weight: ${fonts.weight.normal};
|
|
127
|
+
margin: 0px 15px 1px 5px;
|
|
128
|
+
box-shadow: none;
|
|
112
129
|
}
|
|
113
130
|
`;
|
|
114
131
|
|
|
132
|
+
type LinkProps = {
|
|
133
|
+
href?: string;
|
|
134
|
+
text?: string;
|
|
135
|
+
};
|
|
115
136
|
type Props = {
|
|
116
137
|
type?: WrapperProps['boxType'];
|
|
117
|
-
heading?: string;
|
|
118
138
|
sticky?: boolean;
|
|
119
|
-
onClose?:
|
|
120
|
-
children
|
|
139
|
+
onClose?: boolean;
|
|
140
|
+
children?: string;
|
|
141
|
+
links?: LinkProps[];
|
|
121
142
|
};
|
|
122
143
|
|
|
123
|
-
export const MessageBox = ({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
</
|
|
144
|
+
export const MessageBox = ({ type, sticky = false, onClose, children, links, t }: Props & WithTranslation) => {
|
|
145
|
+
const [hideMessageBox, setHideMessageBox] = useState(false);
|
|
146
|
+
const onCloseMessageBox = () => {
|
|
147
|
+
setHideMessageBox(true);
|
|
148
|
+
};
|
|
149
|
+
const Icon = type === 'ghost' ? HumanMaleBoard : InformationOutline;
|
|
150
|
+
return (
|
|
151
|
+
//StickyStyle top:84 makes sure that the messagebox sits beneath the masthead (header ) and the topOffsett sets it so that it applies when reaching the top of the messagebox
|
|
152
|
+
<Sticky disabled={!sticky} stickyStyle={{ zIndex: 9998, top: 84 }} topOffset={-84}>
|
|
153
|
+
<Wrapper boxType={type} style={{ display: hideMessageBox ? 'none' : 'flex' }}>
|
|
154
|
+
<InfoWrapper boxType={type}>
|
|
155
|
+
<IconWrapper boxType={type}>
|
|
156
|
+
<Icon style={{ width: '24px', height: '24px' }} />
|
|
157
|
+
</IconWrapper>
|
|
158
|
+
<TextWrapper>{children}</TextWrapper>
|
|
159
|
+
</InfoWrapper>
|
|
160
|
+
{onClose && <CloseButton onClick={onCloseMessageBox} color="#444444" />}
|
|
161
|
+
</Wrapper>
|
|
162
|
+
|
|
163
|
+
{links && (
|
|
164
|
+
//loops through the links passed in as properties if there are any and creates a working link for each of them
|
|
165
|
+
<LinkWrapper style={{ display: hideMessageBox ? 'none' : 'flex' }}>
|
|
166
|
+
{links.map((x) => (
|
|
167
|
+
<Link href={x.href}>{x.text}</Link>
|
|
168
|
+
))}
|
|
169
|
+
</LinkWrapper>
|
|
149
170
|
)}
|
|
150
|
-
</
|
|
151
|
-
|
|
152
|
-
|
|
171
|
+
</Sticky>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
153
174
|
|
|
154
175
|
export default withTranslation()(MessageBox);
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
|
|
12
|
+
import styled from '@emotion/styled';
|
|
13
|
+
|
|
14
|
+
const MiniMesssage = styled.div`
|
|
15
|
+
background-color: #f9f4c8;
|
|
16
|
+
text-align: center;
|
|
17
|
+
display: inline-block;
|
|
18
|
+
padding: 5px;
|
|
19
|
+
text-transform: uppercase;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
margin-left: 10px;
|
|
23
|
+
margin-bottom: 10px;
|
|
24
|
+
border-radius: 5px;
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
type Props = {
|
|
28
|
+
tagMessage: string;
|
|
29
|
+
};
|
|
30
|
+
export const MessageBoxTag = ({ tagMessage }: Props) => {
|
|
31
|
+
const { t } = useTranslation();
|
|
32
|
+
return <MiniMesssage>{t(tagMessage)}</MiniMesssage>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default MessageBoxTag;
|
package/src/MessageBox/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
4
|
import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
|
|
5
5
|
import { colors, spacing, fonts, mq, breakpoints } from '@ndla/core';
|
|
6
|
+
//@ts-ignore
|
|
6
7
|
import Button from '@ndla/button';
|
|
7
|
-
import
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { OneColumn } from '..';
|
|
9
9
|
import VisualElement from './VisualElement';
|
|
10
10
|
|
|
11
11
|
const StyledAside = styled.aside`
|
|
@@ -44,7 +44,20 @@ const StyledAside = styled.aside`
|
|
|
44
44
|
}
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
interface Props {
|
|
48
|
+
aboutNDLAVideo: {
|
|
49
|
+
title: string;
|
|
50
|
+
description: string;
|
|
51
|
+
visualElement: {
|
|
52
|
+
alt?: string;
|
|
53
|
+
url: string;
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
moreAboutNdlaFilm: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const AboutNdlaFilm = ({ aboutNDLAVideo, moreAboutNdlaFilm }: Props) => {
|
|
48
61
|
const { t } = useTranslation();
|
|
49
62
|
return (
|
|
50
63
|
<div className="o-wrapper">
|
|
@@ -71,16 +84,4 @@ const AboutNdlaFilm = ({ aboutNDLAVideo, moreAboutNdlaFilm }) => {
|
|
|
71
84
|
);
|
|
72
85
|
};
|
|
73
86
|
|
|
74
|
-
AboutNdlaFilm.propTypes = {
|
|
75
|
-
aboutNDLAVideo: PropTypes.shape({
|
|
76
|
-
title: PropTypes.string,
|
|
77
|
-
description: PropTypes.string,
|
|
78
|
-
visualElement: PropTypes.shape({
|
|
79
|
-
url: PropTypes.string,
|
|
80
|
-
alt: PropTypes.string,
|
|
81
|
-
type: PropTypes.string,
|
|
82
|
-
}),
|
|
83
|
-
}),
|
|
84
|
-
};
|
|
85
|
-
|
|
86
87
|
export default AboutNdlaFilm;
|
|
@@ -15,7 +15,7 @@ import { breakpoints, mq, spacing, spacingUnit, colors, fonts, animations } from
|
|
|
15
15
|
import SafeLink from '@ndla/safelink';
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
import { makeSrcQueryString } from '../Image';
|
|
18
|
-
import {
|
|
18
|
+
import { MovieType } from './types';
|
|
19
19
|
import { isLetter } from './isLetter';
|
|
20
20
|
const IMAGE_WIDTH = 143;
|
|
21
21
|
|
|
@@ -158,7 +158,7 @@ const StyledSafeLink = styled(SafeLink)<isIEProps>`
|
|
|
158
158
|
`;
|
|
159
159
|
|
|
160
160
|
interface Props {
|
|
161
|
-
movies:
|
|
161
|
+
movies: MovieType[];
|
|
162
162
|
locale: string;
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -231,7 +231,7 @@ const AllMoviesAlphabetically: React.FunctionComponent<Props> = ({ movies, local
|
|
|
231
231
|
|
|
232
232
|
return (
|
|
233
233
|
<StyledWrapper ref={wrapperRef}>
|
|
234
|
-
{movies.map((movie:
|
|
234
|
+
{movies.map((movie: MovieType, index: number) => {
|
|
235
235
|
const currentLetter = movie.title.substr(0, 1);
|
|
236
236
|
const isNewLetter = currentLetter.localeCompare(previousLetter, locale) === 1 && isLetter(movie.title);
|
|
237
237
|
previousLetter = currentLetter;
|
|
@@ -1,28 +1,40 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { Component } from 'react';
|
|
3
2
|
import BEMHelper from 'react-bem-helper';
|
|
4
3
|
import FocusTrapReact from 'focus-trap-react';
|
|
5
4
|
import { ChevronDown } from '@ndla/icons/common';
|
|
6
|
-
import { withTranslation } from 'react-i18next';
|
|
5
|
+
import { WithTranslation, withTranslation } from 'react-i18next';
|
|
6
|
+
import { MovieResourceType } from './types';
|
|
7
7
|
|
|
8
8
|
const classes = new BEMHelper({
|
|
9
9
|
name: 'film-moviesearch',
|
|
10
10
|
prefix: 'c-',
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
interface Props extends WithTranslation {
|
|
14
|
+
resourceTypes: MovieResourceType[];
|
|
15
|
+
resourceTypeSelected?: MovieResourceType;
|
|
16
|
+
ariaControlId?: string;
|
|
17
|
+
onChangeResourceType: (resourceId?: string) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface State {
|
|
21
|
+
resourceTypesIsOpen: boolean;
|
|
22
|
+
}
|
|
23
|
+
class CategorySelect extends Component<Props, State> {
|
|
24
|
+
references: Record<string, HTMLButtonElement | null>;
|
|
25
|
+
constructor(props: Props) {
|
|
15
26
|
super(props);
|
|
16
27
|
this.state = {
|
|
17
28
|
resourceTypesIsOpen: false,
|
|
18
29
|
};
|
|
30
|
+
this.references = {};
|
|
19
31
|
this.createRef = this.createRef.bind(this);
|
|
20
32
|
this.openSelect = this.openSelect.bind(this);
|
|
21
33
|
this.onSelect = this.onSelect.bind(this);
|
|
22
34
|
}
|
|
23
35
|
|
|
24
|
-
createRef(el, name) {
|
|
25
|
-
this[name] = el;
|
|
36
|
+
createRef(el: HTMLButtonElement | null, name: string) {
|
|
37
|
+
this.references[name] = el;
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
openSelect() {
|
|
@@ -32,14 +44,14 @@ class CategorySelect extends React.Component {
|
|
|
32
44
|
resourceTypesIsOpen: true,
|
|
33
45
|
},
|
|
34
46
|
() => {
|
|
35
|
-
if (resourceTypeSelected && this[resourceTypeSelected.id]) {
|
|
36
|
-
this[resourceTypeSelected.id]
|
|
47
|
+
if (resourceTypeSelected && this.references[resourceTypeSelected.id]) {
|
|
48
|
+
this.references[resourceTypeSelected.id]?.focus();
|
|
37
49
|
}
|
|
38
50
|
},
|
|
39
51
|
);
|
|
40
52
|
}
|
|
41
53
|
|
|
42
|
-
onSelect(val) {
|
|
54
|
+
onSelect(val?: string) {
|
|
43
55
|
this.props.onChangeResourceType(val);
|
|
44
56
|
this.setState({
|
|
45
57
|
resourceTypesIsOpen: false,
|
|
@@ -97,7 +109,7 @@ class CategorySelect extends React.Component {
|
|
|
97
109
|
ref={(el) => this.createRef(el, resourceType.id)}
|
|
98
110
|
onClick={() => this.onSelect(resourceType.id)}
|
|
99
111
|
{...classes('dropdown-button', {
|
|
100
|
-
selected: resourceTypeSelected && resourceTypeSelected.id === resourceType.id,
|
|
112
|
+
selected: !!resourceTypeSelected && resourceTypeSelected.id === resourceType.id,
|
|
101
113
|
})}
|
|
102
114
|
data-id={resourceType.id}
|
|
103
115
|
key={resourceType.id}>
|
|
@@ -112,13 +124,4 @@ class CategorySelect extends React.Component {
|
|
|
112
124
|
}
|
|
113
125
|
}
|
|
114
126
|
|
|
115
|
-
CategorySelect.propTypes = {
|
|
116
|
-
resourceTypes: PropTypes.arrayOf(PropTypes.object),
|
|
117
|
-
resourceTypeSelected: PropTypes.shape({
|
|
118
|
-
id: PropTypes.string,
|
|
119
|
-
name: PropTypes.string,
|
|
120
|
-
}),
|
|
121
|
-
ariaControlId: PropTypes.string,
|
|
122
|
-
};
|
|
123
|
-
|
|
124
127
|
export default withTranslation()(CategorySelect);
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { spacing, colors, fonts, breakpoints } from '@ndla/core';
|
|
4
3
|
import SafeLink from '@ndla/safelink';
|
|
5
4
|
import styled from '@emotion/styled';
|
|
6
5
|
// @ts-ignore
|
|
7
6
|
import { makeSrcQueryString } from '../Image';
|
|
8
7
|
import FilmContentCardTags from './FilmContentCardTags';
|
|
8
|
+
import { MovieResourceType, MovieType } from './types';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
movie: MovieType;
|
|
12
|
+
columnWidth: number;
|
|
13
|
+
distanceBetweenItems?: number;
|
|
14
|
+
resourceTypes: MovieResourceType[];
|
|
15
|
+
resizeThumbnailImages?: boolean;
|
|
16
|
+
hideTags?: boolean;
|
|
17
|
+
}
|
|
9
18
|
|
|
10
19
|
const FilmContentCard = ({
|
|
11
20
|
movie: { metaImage, resourceTypes: movieResourceTypes, title, id, path },
|
|
@@ -13,8 +22,8 @@ const FilmContentCard = ({
|
|
|
13
22
|
distanceBetweenItems,
|
|
14
23
|
resourceTypes,
|
|
15
24
|
resizeThumbnailImages,
|
|
16
|
-
hideTags,
|
|
17
|
-
}) => {
|
|
25
|
+
hideTags = false,
|
|
26
|
+
}: Props) => {
|
|
18
27
|
let backgroundImage = `${(metaImage && metaImage.url) || ''}`;
|
|
19
28
|
if (resizeThumbnailImages && metaImage) {
|
|
20
29
|
backgroundImage += '?width=480';
|
|
@@ -55,7 +64,10 @@ const StyledMovieTitle = styled.h2`
|
|
|
55
64
|
}
|
|
56
65
|
`;
|
|
57
66
|
|
|
58
|
-
|
|
67
|
+
interface StyledImageProps {
|
|
68
|
+
columnWidth: number;
|
|
69
|
+
}
|
|
70
|
+
const StyledImage = styled.div<StyledImageProps>`
|
|
59
71
|
height: ${(props) => props.columnWidth * 0.5625}px;
|
|
60
72
|
background-size: cover;
|
|
61
73
|
background-color: ${colors.ndlaFilm.filmColorLight};
|
|
@@ -78,7 +90,11 @@ const StyledImage = styled.div`
|
|
|
78
90
|
}
|
|
79
91
|
`;
|
|
80
92
|
|
|
81
|
-
|
|
93
|
+
interface StyledSlideWrapperProps {
|
|
94
|
+
columnWidth: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const StyledSlideWrapper = styled.div<StyledSlideWrapperProps>`
|
|
82
98
|
width: ${(props) => props.columnWidth}px;
|
|
83
99
|
color: #fff;
|
|
84
100
|
box-shadow: none;
|
|
@@ -98,20 +114,4 @@ const StyledSlideWrapper = styled.div`
|
|
|
98
114
|
}
|
|
99
115
|
`;
|
|
100
116
|
|
|
101
|
-
FilmContentCard.propTypes = {
|
|
102
|
-
movie: PropTypes.shape({
|
|
103
|
-
id: PropTypes.string,
|
|
104
|
-
url: PropTypes.string,
|
|
105
|
-
}).isRequired,
|
|
106
|
-
columnWidth: PropTypes.number,
|
|
107
|
-
distanceBetweenItems: PropTypes.number,
|
|
108
|
-
resourceTypes: PropTypes.arrayOf(PropTypes.object),
|
|
109
|
-
resizeThumbnailImages: PropTypes.bool,
|
|
110
|
-
hideTags: PropTypes.bool,
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
FilmContentCard.defaultProps = {
|
|
114
|
-
hideTags: false,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
117
|
export default FilmContentCard;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { spacing, spacingUnit, colors, fonts, misc } from '@ndla/core';
|
|
4
3
|
import styled from '@emotion/styled';
|
|
4
|
+
import { MovieResourceType } from './types';
|
|
5
5
|
|
|
6
6
|
const StyledWrapperDiv = styled.div`
|
|
7
7
|
transition: opacity 200ms ease;
|
|
@@ -22,8 +22,12 @@ const StyledMovieTags = styled.span`
|
|
|
22
22
|
margin-bottom: ${spacingUnit / 8}px;
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
interface Props {
|
|
26
|
+
movieResourceTypes: MovieResourceType[];
|
|
27
|
+
resourceTypes: MovieResourceType[];
|
|
28
|
+
}
|
|
29
|
+
const FilmContentCardTags = ({ movieResourceTypes, resourceTypes }: Props) => {
|
|
30
|
+
const resources: Record<string, boolean> = {};
|
|
27
31
|
movieResourceTypes.forEach((movieResourceType) => {
|
|
28
32
|
const resource = resourceTypes.find((resourceType) => resourceType.id === movieResourceType.id);
|
|
29
33
|
if (resource) {
|
|
@@ -39,8 +43,4 @@ const FilmContentCardTags = ({ movieResourceTypes, resourceTypes }) => {
|
|
|
39
43
|
);
|
|
40
44
|
};
|
|
41
45
|
|
|
42
|
-
FilmContentCardTags.propTypes = {
|
|
43
|
-
resourceTypes: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
46
|
export default FilmContentCardTags;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present, NDLA.
|
|
1
|
+
/** * Copyright (c) 2016-present, NDLA.
|
|
3
2
|
*
|
|
4
3
|
* This source code is licensed under the GPLv3 license found in the
|
|
5
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,31 +6,41 @@
|
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
9
|
import BEMHelper from 'react-bem-helper';
|
|
12
|
-
import { Carousel } from '@ndla/carousel';
|
|
10
|
+
import { Carousel, CalculatedCarouselProps } from '@ndla/carousel';
|
|
13
11
|
import FilmContentCard from './FilmContentCard';
|
|
14
|
-
import {
|
|
12
|
+
import { MovieResourceType, MovieType } from './types';
|
|
15
13
|
|
|
16
14
|
const classes = new BEMHelper({
|
|
17
15
|
name: 'film-movielist',
|
|
18
16
|
prefix: 'c-',
|
|
19
17
|
});
|
|
20
18
|
|
|
19
|
+
interface Props {
|
|
20
|
+
movies: MovieType[];
|
|
21
|
+
name: string;
|
|
22
|
+
slideBackwardsLabel: string;
|
|
23
|
+
slideForwardsLabel: string;
|
|
24
|
+
resourceTypes: MovieResourceType[];
|
|
25
|
+
autoSizedProps: CalculatedCarouselProps;
|
|
26
|
+
resizeThumbnailImages?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
const FilmMovieList = ({
|
|
22
30
|
name,
|
|
23
|
-
movies,
|
|
31
|
+
movies = [],
|
|
24
32
|
slideBackwardsLabel,
|
|
25
33
|
slideForwardsLabel,
|
|
26
|
-
resourceTypes,
|
|
34
|
+
resourceTypes = [],
|
|
27
35
|
autoSizedProps,
|
|
28
36
|
resizeThumbnailImages,
|
|
29
|
-
}) => (
|
|
37
|
+
}: Props) => (
|
|
30
38
|
<section {...classes()}>
|
|
31
39
|
<h1 {...classes('heading')} style={{ marginLeft: `${autoSizedProps.margin}px` }}>
|
|
32
40
|
{name}
|
|
33
41
|
</h1>
|
|
34
42
|
<Carousel
|
|
43
|
+
disableScroll={false}
|
|
35
44
|
slideBackwardsLabel={slideBackwardsLabel}
|
|
36
45
|
slideForwardsLabel={slideForwardsLabel}
|
|
37
46
|
buttonClass="c-film-movielist__carousel-buttons"
|
|
@@ -50,23 +59,4 @@ const FilmMovieList = ({
|
|
|
50
59
|
</section>
|
|
51
60
|
);
|
|
52
61
|
|
|
53
|
-
FilmMovieList.propTypes = {
|
|
54
|
-
movies: PropTypes.arrayOf(movieShape),
|
|
55
|
-
name: PropTypes.string.isRequired,
|
|
56
|
-
slideBackwardsLabel: PropTypes.string.isRequired,
|
|
57
|
-
slideForwardsLabel: PropTypes.string.isRequired,
|
|
58
|
-
resourceTypes: PropTypes.arrayOf(
|
|
59
|
-
PropTypes.shape({
|
|
60
|
-
name: PropTypes.string,
|
|
61
|
-
id: PropTypes.id,
|
|
62
|
-
}),
|
|
63
|
-
),
|
|
64
|
-
autoSizedProps: PropTypes.shape({}),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
FilmMovieList.defaultProps = {
|
|
68
|
-
movies: [],
|
|
69
|
-
resourceTypes: [],
|
|
70
|
-
};
|
|
71
|
-
|
|
72
62
|
export default FilmMovieList;
|