@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
|
@@ -12,8 +12,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
12
12
|
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
import Modal, { ModalHeader, ModalCloseButton, ModalBody } from '@ndla/modal';
|
|
15
|
-
import { mq, breakpoints
|
|
16
|
-
import { Explanation
|
|
15
|
+
import { mq, breakpoints } from '@ndla/core';
|
|
16
|
+
import { Explanation } from '@ndla/icons/common';
|
|
17
17
|
import { Locale } from '../types';
|
|
18
18
|
import { Notion } from '../Notion';
|
|
19
19
|
import { NotionProps } from '../Notion/Notion';
|
|
@@ -25,6 +25,7 @@ const ArticleNotionsContainer = styled.div`
|
|
|
25
25
|
margin-bottom: 0;
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
|
+
/* Stored for later
|
|
28
29
|
|
|
29
30
|
const NotionsTrigger = styled.div`
|
|
30
31
|
padding: 0 16px;
|
|
@@ -33,7 +34,7 @@ const NotionsTrigger = styled.div`
|
|
|
33
34
|
background-color: ${colors.brand.greyLighter};
|
|
34
35
|
border-radius: 4px;
|
|
35
36
|
cursor: pointer;
|
|
36
|
-
|
|
37
|
+
|
|
37
38
|
${mq.range({ from: breakpoints.tablet })} {
|
|
38
39
|
position: fixed;
|
|
39
40
|
border: none;
|
|
@@ -81,7 +82,7 @@ const NotionsTrigger = styled.div`
|
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
`;
|
|
84
|
-
|
|
85
|
+
*/
|
|
85
86
|
const ModalHeadingContainer = styled.div`
|
|
86
87
|
display: flex;
|
|
87
88
|
align-items: center;
|
|
@@ -176,17 +177,19 @@ export const ArticleNotions = ({
|
|
|
176
177
|
buttonOffsetRight,
|
|
177
178
|
}: ArticleNotionsProps) => {
|
|
178
179
|
const { t } = useTranslation();
|
|
179
|
-
const leftOffset = `${buttonOffsetRight - 32}px`;
|
|
180
|
+
//const leftOffset = `${buttonOffsetRight - 32}px`;
|
|
180
181
|
return (
|
|
181
182
|
<ArticleNotionsContainer>
|
|
182
183
|
<Modal
|
|
183
|
-
|
|
184
|
+
/* Stored for later
|
|
185
|
+
|
|
186
|
+
activateButton={
|
|
184
187
|
<NotionsTrigger role="button" aria-label={t('article.notionsPrompt')} style={{ left: leftOffset }}>
|
|
185
188
|
<NotionFlip />
|
|
186
189
|
<Explanation />
|
|
187
190
|
<span>{t('article.notionsPrompt')}</span>
|
|
188
191
|
</NotionsTrigger>
|
|
189
|
-
}
|
|
192
|
+
} */
|
|
190
193
|
size="large"
|
|
191
194
|
backgroundColor="white">
|
|
192
195
|
{(onClose: () => void) => (
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import React, { useEffect, useState } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { mq, breakpoints, colors } from '@ndla/core';
|
|
12
|
-
|
|
13
12
|
import {
|
|
14
13
|
School as SchoolIcon,
|
|
15
14
|
MenuBook as MenuBookIcon,
|
|
@@ -20,6 +19,7 @@ import {
|
|
|
20
19
|
} from '@ndla/icons/action';
|
|
21
20
|
import SafeLink from '@ndla/safelink';
|
|
22
21
|
import { useTranslation } from 'react-i18next';
|
|
22
|
+
import MessageBoxTag from '../MessageBox/MessageBoxTag';
|
|
23
23
|
|
|
24
24
|
type WrapperProps = {
|
|
25
25
|
startOffset?: number;
|
|
@@ -51,7 +51,6 @@ const Wrapper = styled.div<WrapperProps>`
|
|
|
51
51
|
${(props) =>
|
|
52
52
|
props.startOffset &&
|
|
53
53
|
`
|
|
54
|
-
position: absolute;
|
|
55
54
|
top: calc(${props.startOffset}px + 85px);
|
|
56
55
|
`}
|
|
57
56
|
}
|
|
@@ -87,7 +86,7 @@ const Heading = styled.div<InvertItProps>`
|
|
|
87
86
|
font-size: 12px;
|
|
88
87
|
line-height: 15px;
|
|
89
88
|
text-transform: uppercase;
|
|
90
|
-
padding: 0 0
|
|
89
|
+
padding: 0 0 10px 10px;
|
|
91
90
|
${(props) =>
|
|
92
91
|
props.invertedStyle &&
|
|
93
92
|
`
|
|
@@ -214,6 +213,7 @@ type BreadCrumbProps = {
|
|
|
214
213
|
leftAlign?: boolean;
|
|
215
214
|
hideOnNarrow?: boolean;
|
|
216
215
|
onNav?: (e: React.MouseEvent<HTMLElement>, item: BreadcrumbItemProps) => void;
|
|
216
|
+
messageBoxTagMessage?: string;
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
const Breadcrumblist = ({
|
|
@@ -225,6 +225,7 @@ const Breadcrumblist = ({
|
|
|
225
225
|
leftAlign,
|
|
226
226
|
hideOnNarrow,
|
|
227
227
|
onNav,
|
|
228
|
+
messageBoxTagMessage,
|
|
228
229
|
}: BreadCrumbProps) => {
|
|
229
230
|
const { t } = useTranslation();
|
|
230
231
|
const [wrapperOffset, setWrapperOffset] = useState(startOffset);
|
|
@@ -274,6 +275,7 @@ const Breadcrumblist = ({
|
|
|
274
275
|
{items.length > 0 && (
|
|
275
276
|
<>
|
|
276
277
|
<Heading invertedStyle={invertedStyle}>{t('breadcrumb.youAreHere')}</Heading>
|
|
278
|
+
{messageBoxTagMessage && <MessageBoxTag tagMessage={messageBoxTagMessage} />}
|
|
277
279
|
<List data-testid="breadcrumb-list">
|
|
278
280
|
{items.map((item: BreadcrumbItemProps) => {
|
|
279
281
|
const { id, label, url, typename, icon, isCurrent = false } = item;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import styled from '@emotion/styled';
|
|
10
|
+
import { Cross } from '@ndla/icons/action';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
|
+
const CloseButtonWrapper = styled.div`
|
|
13
|
+
position: relative;
|
|
14
|
+
top: 1px;
|
|
15
|
+
right: 1px;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const CloseBut = styled.button`
|
|
19
|
+
background-color: transparent;
|
|
20
|
+
border: none;
|
|
21
|
+
display: flex;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
type Props = {
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
color: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const CloseButton = ({ onClick, color }: Props) => {
|
|
30
|
+
const { t } = useTranslation();
|
|
31
|
+
return (
|
|
32
|
+
<CloseButtonWrapper aria-label={t('lukk')}>
|
|
33
|
+
<CloseBut onClick={onClick}>
|
|
34
|
+
<Cross style={{ width: '24px', height: '24px', color: color }} />
|
|
35
|
+
</CloseBut>
|
|
36
|
+
</CloseButtonWrapper>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default CloseButton;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2019-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import CloseButton from './CloseButton';
|
|
10
|
+
|
|
11
|
+
export { CloseButton };
|
package/src/Figure/Figure.tsx
CHANGED
|
@@ -121,8 +121,9 @@ interface FigureCaptionProps {
|
|
|
121
121
|
|
|
122
122
|
const Figure = ({ children, type = 'full', resizeIframe, ...rest }: Props) => {
|
|
123
123
|
const typeClass = type === 'full-column' ? 'c-figure--full-column' : `u-float-${type}`;
|
|
124
|
+
const right = ['small-right', 'xsmall-right'].includes(type);
|
|
124
125
|
return (
|
|
125
|
-
<figure data-sizetype={type} {...classes('', { resize: !!resizeIframe }, typeClass)} {...rest}>
|
|
126
|
+
<figure data-sizetype={type} {...classes('', { resize: !!resizeIframe, right }, typeClass)} {...rest}>
|
|
126
127
|
{isFunction(children) ? children({ typeClass }) : children}
|
|
127
128
|
</figure>
|
|
128
129
|
);
|
|
@@ -17,6 +17,25 @@
|
|
|
17
17
|
**/
|
|
18
18
|
|
|
19
19
|
/* 1. */
|
|
20
|
+
|
|
21
|
+
@keyframes rightFloatTransition {
|
|
22
|
+
0% {
|
|
23
|
+
left: 75%;
|
|
24
|
+
}
|
|
25
|
+
100% {
|
|
26
|
+
left: -16.6%;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes smallRightFloatTransition {
|
|
31
|
+
0% {
|
|
32
|
+
left: 78.5%;
|
|
33
|
+
}
|
|
34
|
+
100% {
|
|
35
|
+
left: -16.6%;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
.c-figure {
|
|
21
40
|
img {
|
|
22
41
|
width: 100%;
|
|
@@ -51,6 +70,21 @@
|
|
|
51
70
|
padding-bottom: $spacing--large;
|
|
52
71
|
margin-bottom: 0;
|
|
53
72
|
}
|
|
73
|
+
&--right {
|
|
74
|
+
&.expanded {
|
|
75
|
+
@include mq($from: desktop) {
|
|
76
|
+
animation-name: rightFloatTransition;
|
|
77
|
+
animation-duration: 0.4s;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&[data-sizetype='xsmall-right'] {
|
|
81
|
+
@include mq($from: desktop) {
|
|
82
|
+
animation-name: smallRightFloatTransition;
|
|
83
|
+
animation-duration: 0.4s;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
54
88
|
&.expanded {
|
|
55
89
|
.c-figure__caption--hidden-caption {
|
|
56
90
|
display: block;
|
|
@@ -74,7 +108,7 @@
|
|
|
74
108
|
background-color: $white;
|
|
75
109
|
padding: $spacing--small 0;
|
|
76
110
|
display: block;
|
|
77
|
-
border-bottom: 1px solid #
|
|
111
|
+
border-bottom: 1px solid #d1d6db;
|
|
78
112
|
}
|
|
79
113
|
|
|
80
114
|
.c-figure__caption--hidden-caption {
|
|
@@ -119,7 +153,7 @@
|
|
|
119
153
|
margin-bottom: $spacing--small;
|
|
120
154
|
}
|
|
121
155
|
p {
|
|
122
|
-
margin:0;
|
|
156
|
+
margin: 0;
|
|
123
157
|
}
|
|
124
158
|
}
|
|
125
159
|
|
|
@@ -179,7 +213,7 @@
|
|
|
179
213
|
padding: $spacing--small;
|
|
180
214
|
transition: all 0.3s ease-out;
|
|
181
215
|
background: rgba($white, 0.2);
|
|
182
|
-
border:0;
|
|
216
|
+
border: 0;
|
|
183
217
|
|
|
184
218
|
.expanded-icon {
|
|
185
219
|
display: none;
|
|
@@ -73,7 +73,7 @@ const StyledLetterSpacing = styled.span`
|
|
|
73
73
|
type subjectProps = {
|
|
74
74
|
name: string;
|
|
75
75
|
url?: string;
|
|
76
|
-
path
|
|
76
|
+
path?: string;
|
|
77
77
|
id?: string;
|
|
78
78
|
};
|
|
79
79
|
type categoryProps = {
|
|
@@ -160,7 +160,7 @@ const renderList = (
|
|
|
160
160
|
onNavigate();
|
|
161
161
|
}
|
|
162
162
|
}}
|
|
163
|
-
to={subject.url || subject.path}>
|
|
163
|
+
to={subject.url || subject.path || ''}>
|
|
164
164
|
{subject.name}
|
|
165
165
|
</SafeLink>
|
|
166
166
|
<StyledSpacingElement />
|
|
@@ -120,6 +120,7 @@ const FrontpageProgramMenu = ({ programItems, subjectCategories, showBetaCursor
|
|
|
120
120
|
<Button onClick={() => toggleSubjects(true)} lighter={!showSubjects} size="medium" borderShape="rounded">
|
|
121
121
|
<StyledMenuItem>{t('frontpageMenu.allsubjects')}</StyledMenuItem>
|
|
122
122
|
</Button>
|
|
123
|
+
|
|
123
124
|
{showBetaCursor && (
|
|
124
125
|
<CursorPlaceholder>
|
|
125
126
|
<CursorWrapper>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { isIE, browserVersion, isMobileSafari } from 'react-device-detect';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import { History } from 'history';
|
|
5
4
|
import { colors, spacing, mq, breakpoints, animations } from '@ndla/core';
|
|
6
5
|
// @ts-ignore
|
|
7
6
|
import { noScroll } from '@ndla/util';
|
|
@@ -54,11 +53,10 @@ type Props = {
|
|
|
54
53
|
};
|
|
55
54
|
onSearch: (event: React.FormEvent) => void;
|
|
56
55
|
allResultUrl: string;
|
|
57
|
-
searchResult
|
|
56
|
+
searchResult?: Array<ContentTypeResultType>;
|
|
58
57
|
loading: boolean;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
suggestionUrl: string;
|
|
58
|
+
suggestion?: string;
|
|
59
|
+
suggestionUrl?: string;
|
|
62
60
|
};
|
|
63
61
|
|
|
64
62
|
const FrontpageSearch: React.FunctionComponent<Props> = ({
|
|
@@ -73,7 +71,6 @@ const FrontpageSearch: React.FunctionComponent<Props> = ({
|
|
|
73
71
|
allResultUrl,
|
|
74
72
|
searchResult,
|
|
75
73
|
loading,
|
|
76
|
-
history,
|
|
77
74
|
suggestion,
|
|
78
75
|
suggestionUrl,
|
|
79
76
|
}) => {
|
|
@@ -190,7 +187,6 @@ const FrontpageSearch: React.FunctionComponent<Props> = ({
|
|
|
190
187
|
allResultUrl={allResultUrl}
|
|
191
188
|
resourceToLinkProps={resourceToLinkProps}
|
|
192
189
|
infoText={t('welcomePage.searchDisclaimer')}
|
|
193
|
-
history={history}
|
|
194
190
|
suggestion={suggestion}
|
|
195
191
|
suggestionUrl={suggestionUrl}
|
|
196
192
|
/>
|
|
@@ -0,0 +1,158 @@
|
|
|
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 React, { ReactNode } from 'react';
|
|
10
|
+
import {
|
|
11
|
+
LicenseDescription,
|
|
12
|
+
getLicenseByAbbreviation,
|
|
13
|
+
getResourceTypeNamespace,
|
|
14
|
+
isCreativeCommonsLicense,
|
|
15
|
+
metaTypes,
|
|
16
|
+
} from '@ndla/licenses';
|
|
17
|
+
import BEMHelper from 'react-bem-helper';
|
|
18
|
+
import { uuid } from '@ndla/util';
|
|
19
|
+
|
|
20
|
+
const oClasses = new BEMHelper({
|
|
21
|
+
name: 'media',
|
|
22
|
+
prefix: 'o-',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const cClasses = new BEMHelper({
|
|
26
|
+
name: 'medialist',
|
|
27
|
+
prefix: 'c-',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
interface MediaListProps {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const MediaList = ({ children }: MediaListProps) => <ul {...cClasses()}>{children}</ul>;
|
|
35
|
+
|
|
36
|
+
interface MediaListItemProps {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export const MediaListItem = ({ children }: MediaListItemProps) => (
|
|
40
|
+
<li {...oClasses(undefined, undefined, cClasses('item').className)}>{children}</li>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
interface MediaListItemImageProps {
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
export const MediaListItemImage = ({ children }: MediaListItemImageProps) => (
|
|
47
|
+
<div {...oClasses('img', undefined, cClasses('img').className)}>
|
|
48
|
+
<div>{children}</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
interface MediaListCCLinkProps {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
url: string;
|
|
55
|
+
}
|
|
56
|
+
export const MediaListCCLink = ({ children, url }: MediaListCCLinkProps) => (
|
|
57
|
+
<a className="c-figure-license__link" target="_blank" rel="noopener noreferrer license" href={url}>
|
|
58
|
+
{children}
|
|
59
|
+
</a>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
interface MediaListItemBodyProps {
|
|
63
|
+
children: ReactNode;
|
|
64
|
+
license: string;
|
|
65
|
+
locale: string;
|
|
66
|
+
resourceUrl?: string;
|
|
67
|
+
resourceType?: 'video' | 'image' | 'audio' | 'text' | 'h5p';
|
|
68
|
+
messages?: {
|
|
69
|
+
modelPremission?: string;
|
|
70
|
+
};
|
|
71
|
+
title?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const MediaListItemBody = ({
|
|
75
|
+
children,
|
|
76
|
+
license: licenseAbbreviation,
|
|
77
|
+
messages,
|
|
78
|
+
title,
|
|
79
|
+
locale,
|
|
80
|
+
resourceUrl = '', // defaults to current page
|
|
81
|
+
resourceType,
|
|
82
|
+
}: MediaListItemBodyProps) => {
|
|
83
|
+
const license = getLicenseByAbbreviation(licenseAbbreviation, locale);
|
|
84
|
+
const containerProps = isCreativeCommonsLicense(license.rights)
|
|
85
|
+
? {
|
|
86
|
+
...oClasses('body', undefined, cClasses('body').className),
|
|
87
|
+
'xmlns:cc': 'https://creativecommons.org/ns#',
|
|
88
|
+
'xmlns:dct': 'http://purl.org/dc/terms/',
|
|
89
|
+
about: resourceUrl,
|
|
90
|
+
}
|
|
91
|
+
: {
|
|
92
|
+
...oClasses('body', undefined, cClasses('body').className),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const metaResourceType = getResourceTypeNamespace(resourceType);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div {...containerProps}>
|
|
99
|
+
{/* @ts-ignore */}
|
|
100
|
+
{metaResourceType && <span rel="dct:type" href={metaResourceType} style={{ display: 'none' }} />}
|
|
101
|
+
{title ? <h3 className="c-medialist__title">{title} </h3> : null}
|
|
102
|
+
<LicenseDescription locale={locale} messages={messages} licenseRights={license.rights} highlightCC />
|
|
103
|
+
<MediaListCCLink url={license.url}>{license.linkText}</MediaListCCLink>
|
|
104
|
+
{children}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
interface MediaListItemActionsProps {
|
|
110
|
+
children: ReactNode;
|
|
111
|
+
}
|
|
112
|
+
export const MediaListItemActions = ({ children }: MediaListItemActionsProps) => (
|
|
113
|
+
<div {...cClasses('actions')}>{children}</div>
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const isLink = (text: string) => text.startsWith('http') || text.startsWith('https');
|
|
117
|
+
|
|
118
|
+
interface HandleLinkProps {
|
|
119
|
+
text: string;
|
|
120
|
+
children: ReactNode;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const HandleLink = ({ text, children }: HandleLinkProps) => {
|
|
124
|
+
if (isLink(text)) {
|
|
125
|
+
return (
|
|
126
|
+
<a href={text} target="_blank" rel="noopener noreferrer">
|
|
127
|
+
{children}
|
|
128
|
+
</a>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
return <span>{children}</span>;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const attributionTypes = [metaTypes.author, metaTypes.copyrightHolder, metaTypes.contributor];
|
|
135
|
+
|
|
136
|
+
interface MediaListItemMetaProps {
|
|
137
|
+
items?: {
|
|
138
|
+
label: string;
|
|
139
|
+
description: string;
|
|
140
|
+
metaType: string;
|
|
141
|
+
}[];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export const MediaListItemMeta = ({ items = [] }: MediaListItemMetaProps) => {
|
|
145
|
+
const attributionItems = items.filter((item) => attributionTypes.some((type) => type === item.metaType));
|
|
146
|
+
const attributionMeta = attributionItems.map((item) => `${item.label}: ${item.description}`).join(', ');
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
//@ts-ignore
|
|
150
|
+
<ul {...cClasses('actions')} property="cc:attributionName" content={attributionMeta}>
|
|
151
|
+
{items.map((item) => (
|
|
152
|
+
<li key={uuid()} className="c-medialist__meta-item">
|
|
153
|
+
{item.label}: <HandleLink text={item.description}>{item.description}</HandleLink>
|
|
154
|
+
</li>
|
|
155
|
+
))}
|
|
156
|
+
</ul>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
File without changes
|