@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
|
@@ -0,0 +1,71 @@
|
|
|
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 from 'react';
|
|
10
|
+
import BEMHelper from 'react-bem-helper';
|
|
11
|
+
import SafeLink from '@ndla/safelink';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
13
|
+
import CategorySelect from './CategorySelect';
|
|
14
|
+
import { MovieResourceType } from './types';
|
|
15
|
+
import { OneColumn } from '..';
|
|
16
|
+
|
|
17
|
+
const classes = new BEMHelper({
|
|
18
|
+
name: 'film-moviesearch',
|
|
19
|
+
prefix: 'c-',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const classesMovieList = new BEMHelper({
|
|
23
|
+
name: 'film-movielist',
|
|
24
|
+
prefix: 'c-',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
topics?: { id: string; path: string; name: string }[];
|
|
29
|
+
onChangeResourceType: (resourceType?: string) => void;
|
|
30
|
+
resourceTypeSelected?: MovieResourceType;
|
|
31
|
+
resourceTypes: MovieResourceType[];
|
|
32
|
+
ariaControlId: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const FilmMovieSearch = ({
|
|
36
|
+
topics = [],
|
|
37
|
+
onChangeResourceType,
|
|
38
|
+
resourceTypes,
|
|
39
|
+
resourceTypeSelected,
|
|
40
|
+
ariaControlId,
|
|
41
|
+
}: Props) => {
|
|
42
|
+
const { t } = useTranslation();
|
|
43
|
+
return (
|
|
44
|
+
<div {...classes('')}>
|
|
45
|
+
<OneColumn>
|
|
46
|
+
<div {...classes('topic-navigation')}>
|
|
47
|
+
<h2 {...classesMovieList('heading', '', 'u-12/12 u-4/12@tablet')}>{t('ndlaFilm.subjectsInMovies')}:</h2>
|
|
48
|
+
<nav className="u-12/12 u-8/12@tablet">
|
|
49
|
+
<ul>
|
|
50
|
+
{topics.map((topic) => (
|
|
51
|
+
<li key={topic.id}>
|
|
52
|
+
<SafeLink to={topic.path} key={topic.id}>
|
|
53
|
+
<span>{topic.name}</span>
|
|
54
|
+
</SafeLink>
|
|
55
|
+
</li>
|
|
56
|
+
))}
|
|
57
|
+
</ul>
|
|
58
|
+
</nav>
|
|
59
|
+
</div>
|
|
60
|
+
<CategorySelect
|
|
61
|
+
onChangeResourceType={onChangeResourceType}
|
|
62
|
+
resourceTypes={resourceTypes}
|
|
63
|
+
resourceTypeSelected={resourceTypeSelected}
|
|
64
|
+
ariaControlId={ariaControlId}
|
|
65
|
+
/>
|
|
66
|
+
</OneColumn>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default FilmMovieSearch;
|
|
@@ -7,20 +7,21 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
10
|
+
// @ts-ignore
|
|
10
11
|
import { SwipeEventData, useSwipeable } from 'react-swipeable';
|
|
11
12
|
import BEMHelper from 'react-bem-helper';
|
|
12
13
|
import SafeLink from '@ndla/safelink';
|
|
13
14
|
import { OneColumn } from '../Layout';
|
|
14
15
|
import Spinner from '../Spinner';
|
|
15
|
-
import { NDLAMovie } from './interfaces';
|
|
16
16
|
import NavigationArrow from './NavigationArrow';
|
|
17
17
|
import SlideshowIndicator from './SlideshowIndicator';
|
|
18
|
+
import { MovieType } from './types';
|
|
18
19
|
|
|
19
20
|
interface Props {
|
|
20
|
-
autoSlide
|
|
21
|
-
randomStart
|
|
22
|
-
slideshow:
|
|
23
|
-
slideInterval
|
|
21
|
+
autoSlide?: boolean;
|
|
22
|
+
randomStart?: boolean;
|
|
23
|
+
slideshow: MovieType[];
|
|
24
|
+
slideInterval?: number;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const classes = new BEMHelper({
|
|
@@ -31,7 +32,7 @@ const classes = new BEMHelper({
|
|
|
31
32
|
const defaultTransitionSwipeEnd = 'transform 600ms cubic-bezier(0, 0.76, 0.09, 1)';
|
|
32
33
|
const defaultTransitionText = 'opacity 600ms ease';
|
|
33
34
|
|
|
34
|
-
const renderSlideItem = (slide:
|
|
35
|
+
const renderSlideItem = (slide: MovieType) => (
|
|
35
36
|
<div
|
|
36
37
|
{...classes('item')}
|
|
37
38
|
key={slide.id}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import BEMHelper from 'react-bem-helper';
|
|
3
|
+
import { css } from '@emotion/core';
|
|
4
|
+
import { CalculatedCarouselProps } from '@ndla/carousel';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import FilmContentCard from './FilmContentCard';
|
|
7
|
+
import { MovieResourceType, MovieType } from './types';
|
|
8
|
+
|
|
9
|
+
const movieListClasses = new BEMHelper({
|
|
10
|
+
name: 'film-movielist',
|
|
11
|
+
prefix: 'c-',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
autoSizedProps: CalculatedCarouselProps;
|
|
16
|
+
resourceTypeName?: MovieResourceType;
|
|
17
|
+
fetchingMoviesByType: boolean;
|
|
18
|
+
moviesByType: MovieType[];
|
|
19
|
+
resourceTypes: MovieResourceType[];
|
|
20
|
+
loadingPlaceholderHeight?: string;
|
|
21
|
+
resizeThumbnailImages?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const MovieGrid = ({
|
|
25
|
+
resourceTypeName,
|
|
26
|
+
fetchingMoviesByType,
|
|
27
|
+
moviesByType,
|
|
28
|
+
resourceTypes,
|
|
29
|
+
loadingPlaceholderHeight,
|
|
30
|
+
autoSizedProps,
|
|
31
|
+
resizeThumbnailImages,
|
|
32
|
+
}: Props) => {
|
|
33
|
+
const { t } = useTranslation();
|
|
34
|
+
return (
|
|
35
|
+
<section>
|
|
36
|
+
<h1
|
|
37
|
+
{...movieListClasses('heading')}
|
|
38
|
+
css={css`
|
|
39
|
+
margin-left: ${autoSizedProps.margin}px;
|
|
40
|
+
`}>
|
|
41
|
+
{resourceTypeName && resourceTypeName.name}
|
|
42
|
+
<small>
|
|
43
|
+
{fetchingMoviesByType
|
|
44
|
+
? t('ndlaFilm.loadingMovies')
|
|
45
|
+
: `${moviesByType.length} ${t('ndlaFilm.movieMatchInCategory')}`}
|
|
46
|
+
</small>
|
|
47
|
+
</h1>
|
|
48
|
+
<div
|
|
49
|
+
{...movieListClasses('movie-listing')}
|
|
50
|
+
css={css`
|
|
51
|
+
margin-left: ${autoSizedProps.margin}px;
|
|
52
|
+
`}>
|
|
53
|
+
{fetchingMoviesByType && (
|
|
54
|
+
<div
|
|
55
|
+
css={css`
|
|
56
|
+
height: ${loadingPlaceholderHeight};
|
|
57
|
+
`}
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
60
|
+
{!fetchingMoviesByType &&
|
|
61
|
+
moviesByType.map((movie) => (
|
|
62
|
+
<FilmContentCard
|
|
63
|
+
hideTags
|
|
64
|
+
movie={movie}
|
|
65
|
+
columnWidth={autoSizedProps.columnWidth}
|
|
66
|
+
distanceBetweenItems={autoSizedProps.distanceBetweenItems}
|
|
67
|
+
resourceTypes={resourceTypes}
|
|
68
|
+
resizeThumbnailImages={resizeThumbnailImages}
|
|
69
|
+
/>
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
</section>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default MovieGrid;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import BEMHelper from 'react-bem-helper';
|
|
11
|
-
import {
|
|
11
|
+
import { MovieType } from './types';
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
14
|
-
slideshow:
|
|
14
|
+
slideshow: MovieType[];
|
|
15
15
|
activeSlide: number;
|
|
16
16
|
gotoSlide: (indexTarget: number, useAnimation: boolean) => void;
|
|
17
17
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 React from 'react';
|
|
10
|
+
import styled from '@emotion/styled';
|
|
11
|
+
import Image from '../Image';
|
|
12
|
+
|
|
13
|
+
const StylediFrame = styled.iframe`
|
|
14
|
+
height: 100%;
|
|
15
|
+
width: 100%;
|
|
16
|
+
border: 0;
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
visualElement: {
|
|
23
|
+
alt?: string;
|
|
24
|
+
url: string;
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const VisualElement = ({ visualElement }: Props) => {
|
|
29
|
+
const { type, url, alt } = visualElement;
|
|
30
|
+
if (type === 'image') {
|
|
31
|
+
return <Image src={url} alt={alt ?? ''} />;
|
|
32
|
+
} else if (type === 'brightcove') {
|
|
33
|
+
//@ts-ignore react does not recognize fullscreen properties.
|
|
34
|
+
return <StylediFrame allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" src={url} />;
|
|
35
|
+
} else {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default VisualElement;
|
|
File without changes
|
package/src/NDLAFilm/types.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface MovieType {
|
|
2
2
|
id: string;
|
|
3
3
|
metaDescription: string;
|
|
4
|
+
resourceTypes: MovieResourceType[];
|
|
4
5
|
metaImage: {
|
|
5
6
|
alt: string;
|
|
6
7
|
url: string;
|
|
7
8
|
};
|
|
8
|
-
movieTypes: {
|
|
9
|
-
[key: string]: boolean;
|
|
10
|
-
};
|
|
11
9
|
path: string;
|
|
12
10
|
title: string;
|
|
13
11
|
}
|
|
12
|
+
|
|
13
|
+
export interface MovieResourceType {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { breakpoints, mq, spacing } from '@ndla/core';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import LayoutItem, { OneColumn } from '../Layout';
|
|
5
|
-
import { NavigationHeading } from '../Navigation';
|
|
6
6
|
import ProgrammeSubjects from './ProgrammeSubjects';
|
|
7
7
|
import { GradesProps } from './ProgrammeSubjects';
|
|
8
|
-
|
|
8
|
+
import MessageBox from '../MessageBox/MessageBox';
|
|
9
|
+
import { NavigationHeading } from '..';
|
|
9
10
|
const StyledWrapper = styled.div`
|
|
10
11
|
display: flex;
|
|
11
12
|
flex-direction: column;
|
|
@@ -63,9 +64,11 @@ const SubjectsWrapper = styled.div`
|
|
|
63
64
|
type Props = GradesProps & {
|
|
64
65
|
heading?: string;
|
|
65
66
|
image?: string;
|
|
67
|
+
messageBoxText?: string;
|
|
66
68
|
};
|
|
67
69
|
|
|
68
|
-
export const Programme = ({ heading, image, grades, selectedGrade, onChangeGrade }: Props) => {
|
|
70
|
+
export const Programme = ({ heading, image, grades, selectedGrade, onChangeGrade, messageBoxText }: Props) => {
|
|
71
|
+
const { t } = useTranslation();
|
|
69
72
|
return (
|
|
70
73
|
<StyledWrapper>
|
|
71
74
|
<StyledBackground image={image} />
|
|
@@ -74,6 +77,7 @@ export const Programme = ({ heading, image, grades, selectedGrade, onChangeGrade
|
|
|
74
77
|
<LayoutItem layout="extend">
|
|
75
78
|
<StyledContentWrapper>
|
|
76
79
|
<NavigationHeading>{heading}</NavigationHeading>
|
|
80
|
+
{messageBoxText && <MessageBox>{t(messageBoxText)}</MessageBox>}
|
|
77
81
|
<SubjectsWrapper>
|
|
78
82
|
<ProgrammeSubjects grades={grades} selectedGrade={selectedGrade} onChangeGrade={onChangeGrade} />
|
|
79
83
|
</SubjectsWrapper>
|
|
@@ -7,20 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React, { useEffect, useRef, useState } from 'react';
|
|
10
|
-
import { History } from 'history';
|
|
11
10
|
import styled from '@emotion/styled';
|
|
12
11
|
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
13
|
-
import {
|
|
14
|
-
ChevronDown,
|
|
15
|
-
ChevronUp,
|
|
16
|
-
Esc,
|
|
17
|
-
KeyboardReturn,
|
|
18
|
-
Search as SearchIcon,
|
|
19
|
-
Wrench,
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
} from '@ndla/icons/common';
|
|
12
|
+
import { ChevronDown, ChevronUp, Esc, KeyboardReturn, Search as SearchIcon, Wrench } from '@ndla/icons/common';
|
|
22
13
|
import SafeLink from '@ndla/safelink';
|
|
23
|
-
// @ts-ignore
|
|
24
14
|
import { useTranslation } from 'react-i18next';
|
|
25
15
|
import ContentTypeResult from './ContentTypeResult';
|
|
26
16
|
import { highlightStyle } from './ContentTypeResultStyles';
|
|
@@ -218,14 +208,13 @@ type Props = {
|
|
|
218
208
|
to: string;
|
|
219
209
|
};
|
|
220
210
|
onNavigate?: VoidFunction;
|
|
221
|
-
infoText
|
|
222
|
-
ignoreContentTypeBadge
|
|
211
|
+
infoText?: string;
|
|
212
|
+
ignoreContentTypeBadge?: boolean;
|
|
223
213
|
searchString: string;
|
|
224
214
|
loading: boolean;
|
|
225
215
|
frontpage?: boolean;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
suggestionUrl: string;
|
|
216
|
+
suggestion?: string;
|
|
217
|
+
suggestionUrl?: string;
|
|
229
218
|
};
|
|
230
219
|
|
|
231
220
|
const SearchResultSleeve: React.FC<Props> = ({
|
|
@@ -238,7 +227,6 @@ const SearchResultSleeve: React.FC<Props> = ({
|
|
|
238
227
|
searchString,
|
|
239
228
|
loading,
|
|
240
229
|
frontpage,
|
|
241
|
-
history,
|
|
242
230
|
suggestion,
|
|
243
231
|
suggestionUrl,
|
|
244
232
|
}) => {
|
|
@@ -332,7 +320,7 @@ const SearchResultSleeve: React.FC<Props> = ({
|
|
|
332
320
|
<strong ref={searchAllRef}>{searchString}</strong>
|
|
333
321
|
<small>{t('welcomePage.searchAllInfo')}</small>
|
|
334
322
|
</StyledSearchLink>
|
|
335
|
-
{suggestion && (
|
|
323
|
+
{suggestion && suggestionUrl && (
|
|
336
324
|
<StyledSearchLink css={keyboardPathNavigation === GO_TO_SUGGESTION && highlightStyle} to={suggestionUrl}>
|
|
337
325
|
<SearchIcon className="c-icon--22" />
|
|
338
326
|
<small>{t('searchPage.resultType.searchPhraseSuggestion')}</small>
|
|
@@ -342,7 +330,7 @@ const SearchResultSleeve: React.FC<Props> = ({
|
|
|
342
330
|
</SearchLinkContainer>
|
|
343
331
|
{result.map((contentTypeResult: ContentTypeResultType) => (
|
|
344
332
|
<ContentTypeResult
|
|
345
|
-
ignoreContentTypeBadge={ignoreContentTypeBadge}
|
|
333
|
+
ignoreContentTypeBadge={!!ignoreContentTypeBadge}
|
|
346
334
|
onNavigate={onNavigate}
|
|
347
335
|
contentTypeResult={contentTypeResult}
|
|
348
336
|
resourceToLinkProps={resourceToLinkProps}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
9
|
+
import React, { FormEvent, useEffect, useRef, useState } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { colors, breakpoints, mq } from '@ndla/core';
|
|
12
12
|
// @ts-ignore
|
|
@@ -76,8 +76,8 @@ const SearchInput = styled.input`
|
|
|
76
76
|
`;
|
|
77
77
|
|
|
78
78
|
type Props = {
|
|
79
|
-
onSubmit: (event:
|
|
80
|
-
value
|
|
79
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
80
|
+
value?: string;
|
|
81
81
|
onChange: (value: string) => void;
|
|
82
82
|
filters?: PopupFilterProps;
|
|
83
83
|
activeFilters?: {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
9
|
+
import React, { FormEvent } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
12
12
|
|
|
@@ -75,7 +75,7 @@ type Props = {
|
|
|
75
75
|
searchPhrase?: string;
|
|
76
76
|
searchPhraseSuggestion?: string;
|
|
77
77
|
searchPhraseSuggestionOnClick?: () => void;
|
|
78
|
-
searchValue
|
|
78
|
+
searchValue?: string;
|
|
79
79
|
filters?: PopupFilterProps;
|
|
80
80
|
activeFilters?: {
|
|
81
81
|
filters: FilterProps[];
|
|
@@ -83,7 +83,7 @@ type Props = {
|
|
|
83
83
|
};
|
|
84
84
|
competenceGoals?: CompetenceGoalsItemType[];
|
|
85
85
|
onSearchValueChange: (value: string) => void;
|
|
86
|
-
onSubmit: () => void;
|
|
86
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
87
87
|
noResults?: boolean;
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -203,12 +203,11 @@ type context = {
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
export type SearchItemType = {
|
|
206
|
-
id: string;
|
|
206
|
+
id: string | number;
|
|
207
207
|
title: string;
|
|
208
208
|
url: string;
|
|
209
209
|
ingress: string;
|
|
210
|
-
contexts
|
|
211
|
-
image: React.ReactNode | null;
|
|
210
|
+
contexts?: context[];
|
|
212
211
|
img?: { url: string; alt: string };
|
|
213
212
|
labels?: string[];
|
|
214
213
|
children?: React.ReactNode;
|
|
@@ -220,7 +219,7 @@ type Props = {
|
|
|
220
219
|
const SearchItem = ({ item, type }: Props) => {
|
|
221
220
|
const { t } = useTranslation();
|
|
222
221
|
const { title, url, ingress, contexts, img = null, labels = [] } = item;
|
|
223
|
-
const mainContext = contexts[0];
|
|
222
|
+
const mainContext = contexts?.[0];
|
|
224
223
|
|
|
225
224
|
const Breadcrumb = ({ breadcrumb, children }: { breadcrumb: string[]; children?: React.ReactNode }) => (
|
|
226
225
|
<BreadcrumbPath>
|
|
@@ -268,7 +267,7 @@ const SearchItem = ({ item, type }: Props) => {
|
|
|
268
267
|
{item.children}
|
|
269
268
|
<ItemText>{parse(ingress)}</ItemText>
|
|
270
269
|
{mainContext && <Breadcrumb breadcrumb={mainContext.breadcrumb} />}
|
|
271
|
-
{contexts.length > 1 && (
|
|
270
|
+
{contexts && contexts.length > 1 && (
|
|
272
271
|
<ContextsWrapper>
|
|
273
272
|
<Modal
|
|
274
273
|
activateButton={
|
|
@@ -48,7 +48,6 @@ const ItemWrapper = styled.div<ItemWrapperProps>`
|
|
|
48
48
|
const TextWrapper = styled.div``;
|
|
49
49
|
const DescriptionWrapper = styled.div`
|
|
50
50
|
${fonts.sizes('18px', '26px')};
|
|
51
|
-
font-family: ${fonts.serif};
|
|
52
51
|
`;
|
|
53
52
|
|
|
54
53
|
const MediaWrapper = styled.div`
|
|
@@ -121,7 +120,7 @@ const AuthorsWrapper = styled.div`
|
|
|
121
120
|
`;
|
|
122
121
|
|
|
123
122
|
export type SearchNotionItemProps = {
|
|
124
|
-
id: string;
|
|
123
|
+
id: string | number;
|
|
125
124
|
title: string;
|
|
126
125
|
text: React.ReactNode;
|
|
127
126
|
image?: { url: string; alt: string };
|
|
@@ -10,7 +10,8 @@ import React from 'react';
|
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { fonts, mq, breakpoints, spacing } from '@ndla/core';
|
|
12
12
|
// @ts-ignore
|
|
13
|
-
import
|
|
13
|
+
import { ModalCloseButton } from '@ndla/modal';
|
|
14
|
+
// @ts-ignore
|
|
14
15
|
import { withTranslation, WithTranslation } from 'react-i18next';
|
|
15
16
|
import SearchNotionItem, { SearchNotionItemProps } from './SearchNotionItem';
|
|
16
17
|
|
|
@@ -47,10 +48,6 @@ const HeadingCount = styled.span`
|
|
|
47
48
|
text-transform: lowercase;
|
|
48
49
|
`;
|
|
49
50
|
|
|
50
|
-
const ButtonRemoveText = styled.span`
|
|
51
|
-
${fonts.sizes('18px', '22px')};
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
51
|
type Props = {
|
|
55
52
|
items: SearchNotionItemProps[];
|
|
56
53
|
totalCount: number;
|
|
@@ -65,9 +62,7 @@ const SearchNotionsResult = ({ items, totalCount, onRemove, renderMarkdown, t }:
|
|
|
65
62
|
{t(`searchPage.resultType.notionsHeading`)}
|
|
66
63
|
<HeadingCount>{t(`searchPage.resultType.hits`, { count: totalCount })}</HeadingCount>
|
|
67
64
|
</Heading>
|
|
68
|
-
<
|
|
69
|
-
<ButtonRemoveText>{t(`searchPage.resultType.notionsRemove`)}</ButtonRemoveText>
|
|
70
|
-
</Button>
|
|
65
|
+
<ModalCloseButton onClick={onRemove} />
|
|
71
66
|
</HeadingWrapper>
|
|
72
67
|
{items.map((item) => (
|
|
73
68
|
<SearchNotionItem key={item.id} {...item} renderMarkdown={renderMarkdown} />
|
|
@@ -12,4 +12,6 @@ import SearchFieldHeader from './SearchFieldHeader';
|
|
|
12
12
|
import SearchNotionsResult from './SearchNotionsResult';
|
|
13
13
|
import SearchSubjectResult from './SearchSubjectResult';
|
|
14
14
|
|
|
15
|
+
export type { ContentType } from './SearchTypeResult';
|
|
16
|
+
|
|
15
17
|
export { SearchTypeResult, SearchHeader, SearchFieldHeader, SearchNotionsResult, SearchSubjectResult };
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
12
|
import { Additional, Core } from '@ndla/icons/common';
|
|
13
13
|
import Tooltip from '@ndla/tooltip';
|
|
14
14
|
import SafeLink from '@ndla/safelink';
|
|
15
|
-
import { TopicShape, ShortcutShape } from '../shapes';
|
|
16
15
|
import TopicIntroductionShortcuts from './TopicIntroductionShortcuts';
|
|
16
|
+
import { Shortcut, Topic } from './TopicIntroductionList';
|
|
17
17
|
|
|
18
18
|
const topicClasses = new BEMHelper({
|
|
19
19
|
prefix: 'c-',
|
|
@@ -21,23 +21,35 @@ const topicClasses = new BEMHelper({
|
|
|
21
21
|
outputIsString: true,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
interface Props {
|
|
25
|
+
additional?: boolean;
|
|
26
|
+
showAdditionalCores?: boolean;
|
|
27
|
+
topic: Topic;
|
|
28
|
+
toTopic: (id: string) => string;
|
|
29
|
+
subjectPage?: boolean;
|
|
30
|
+
shortcuts?: Shortcut[];
|
|
31
|
+
twoColumns?: boolean;
|
|
32
|
+
shortcutAlwaysExpanded?: boolean;
|
|
33
|
+
id: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
export const TopicIntroduction = ({
|
|
25
37
|
toTopic,
|
|
26
38
|
topic,
|
|
27
39
|
subjectPage,
|
|
28
40
|
shortcuts,
|
|
29
|
-
messages,
|
|
30
41
|
shortcutAlwaysExpanded,
|
|
31
|
-
additional,
|
|
32
|
-
showAdditionalCores,
|
|
42
|
+
additional = false,
|
|
43
|
+
showAdditionalCores = false,
|
|
33
44
|
id,
|
|
34
|
-
}) => {
|
|
35
|
-
const
|
|
45
|
+
}: Props) => {
|
|
46
|
+
const { t } = useTranslation();
|
|
47
|
+
const contentTypeDescription = t(additional ? 'resource.tooltipAdditionalTopic' : 'resource.tooltipCoreTopic');
|
|
36
48
|
|
|
37
49
|
return (
|
|
38
50
|
<li
|
|
39
51
|
className={topicClasses('item', {
|
|
40
|
-
subjectPage,
|
|
52
|
+
subjectPage: !!subjectPage,
|
|
41
53
|
additional,
|
|
42
54
|
showAdditionalCores,
|
|
43
55
|
})}>
|
|
@@ -52,12 +64,12 @@ export const TopicIntroduction = ({
|
|
|
52
64
|
{contentTypeDescription}
|
|
53
65
|
</span>
|
|
54
66
|
{additional && (
|
|
55
|
-
<Tooltip tooltip={
|
|
67
|
+
<Tooltip tooltip={t('resource.tooltipAdditionalTopic')} align="left">
|
|
56
68
|
<Additional className="c-icon--20 u-margin-left-tiny" />
|
|
57
69
|
</Tooltip>
|
|
58
70
|
)}
|
|
59
71
|
{!additional && showAdditionalCores && (
|
|
60
|
-
<Tooltip tooltip={
|
|
72
|
+
<Tooltip tooltip={t('resource.tooltipCoreTopic')} align="left">
|
|
61
73
|
<Core className="c-icon--20 u-margin-left-tiny" />
|
|
62
74
|
</Tooltip>
|
|
63
75
|
)}
|
|
@@ -73,9 +85,6 @@ export const TopicIntroduction = ({
|
|
|
73
85
|
alwaysExpanded={shortcutAlwaysExpanded}
|
|
74
86
|
id={`${topic.id}_shortcuts`}
|
|
75
87
|
shortcuts={shortcuts}
|
|
76
|
-
messages={{
|
|
77
|
-
toggleButtonText: messages.shortcutButtonText,
|
|
78
|
-
}}
|
|
79
88
|
/>
|
|
80
89
|
)}
|
|
81
90
|
</div>
|
|
@@ -89,25 +98,3 @@ export const TopicIntroduction = ({
|
|
|
89
98
|
</li>
|
|
90
99
|
);
|
|
91
100
|
};
|
|
92
|
-
|
|
93
|
-
TopicIntroduction.propTypes = {
|
|
94
|
-
additional: PropTypes.bool,
|
|
95
|
-
showAdditionalCores: PropTypes.bool,
|
|
96
|
-
messages: PropTypes.shape({
|
|
97
|
-
shortcutButtonText: PropTypes.string.isRequired,
|
|
98
|
-
tooltipAdditionalTopic: PropTypes.string,
|
|
99
|
-
tooltipCoreTopic: PropTypes.string,
|
|
100
|
-
}),
|
|
101
|
-
topic: TopicShape.isRequired,
|
|
102
|
-
toTopic: PropTypes.func.isRequired,
|
|
103
|
-
subjectPage: PropTypes.bool,
|
|
104
|
-
shortcuts: PropTypes.arrayOf(ShortcutShape),
|
|
105
|
-
twoColumns: PropTypes.bool,
|
|
106
|
-
shortcutAlwaysExpanded: PropTypes.bool,
|
|
107
|
-
id: PropTypes.string.isRequired,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
TopicIntroduction.defaultProps = {
|
|
111
|
-
showAdditionalCores: false,
|
|
112
|
-
additional: false,
|
|
113
|
-
};
|