@ndla/ui 3.3.13 → 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/Figure/Figure.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/MovieGrid.js +10 -19
- package/es/NDLAFilm/VisualElement.js +22 -29
- 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 +4 -0
- package/es/shapes.js +0 -6
- package/lib/Figure/Figure.js +3 -1
- 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/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 +4 -0
- package/lib/index.js +155 -0
- package/lib/shapes.js +1 -10
- package/package.json +10 -10
- package/src/Figure/Figure.tsx +2 -1
- package/src/Figure/component.figure.scss +37 -3
- 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 +6 -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/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 +31 -0
- package/src/shapes.js +0 -7
- 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/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,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;
|
|
@@ -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;
|
|
@@ -13,15 +13,15 @@ import BEMHelper from 'react-bem-helper';
|
|
|
13
13
|
import SafeLink from '@ndla/safelink';
|
|
14
14
|
import { OneColumn } from '../Layout';
|
|
15
15
|
import Spinner from '../Spinner';
|
|
16
|
-
import { NDLAMovie } from './interfaces';
|
|
17
16
|
import NavigationArrow from './NavigationArrow';
|
|
18
17
|
import SlideshowIndicator from './SlideshowIndicator';
|
|
18
|
+
import { MovieType } from './types';
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
|
-
autoSlide
|
|
22
|
-
randomStart
|
|
23
|
-
slideshow:
|
|
24
|
-
slideInterval
|
|
21
|
+
autoSlide?: boolean;
|
|
22
|
+
randomStart?: boolean;
|
|
23
|
+
slideshow: MovieType[];
|
|
24
|
+
slideInterval?: number;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const classes = new BEMHelper({
|
|
@@ -32,7 +32,7 @@ const classes = new BEMHelper({
|
|
|
32
32
|
const defaultTransitionSwipeEnd = 'transform 600ms cubic-bezier(0, 0.76, 0.09, 1)';
|
|
33
33
|
const defaultTransitionText = 'opacity 600ms ease';
|
|
34
34
|
|
|
35
|
-
const renderSlideItem = (slide:
|
|
35
|
+
const renderSlideItem = (slide: MovieType) => (
|
|
36
36
|
<div
|
|
37
37
|
{...classes('item')}
|
|
38
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
|
+
}
|
|
@@ -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
|
-
};
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
12
11
|
import { useTranslation } from 'react-i18next';
|
|
13
12
|
import NoContentBox from '../NoContentBox';
|
|
14
|
-
import { TopicShape } from '../shapes';
|
|
15
13
|
import { TopicIntroduction } from './TopicIntroduction';
|
|
16
14
|
|
|
17
15
|
const topicClasses = new BEMHelper({
|
|
@@ -20,14 +18,42 @@ const topicClasses = new BEMHelper({
|
|
|
20
18
|
outputIsString: true,
|
|
21
19
|
});
|
|
22
20
|
|
|
21
|
+
export interface Shortcut {
|
|
22
|
+
id: string | number;
|
|
23
|
+
tooltip: string;
|
|
24
|
+
contentType: string;
|
|
25
|
+
url: string;
|
|
26
|
+
count: number;
|
|
27
|
+
}
|
|
28
|
+
export interface Topic {
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
additional?: boolean;
|
|
32
|
+
shortcuts?: Shortcut[];
|
|
33
|
+
introduction: string;
|
|
34
|
+
metaImage?: {
|
|
35
|
+
url?: string;
|
|
36
|
+
alt?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface Props {
|
|
41
|
+
toTopic: (id: string) => string;
|
|
42
|
+
topics: Topic[];
|
|
43
|
+
twoColumns?: boolean;
|
|
44
|
+
shortcutAlwaysExpanded?: boolean;
|
|
45
|
+
showAdditionalCores?: boolean;
|
|
46
|
+
toggleAdditionalCores?: () => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
23
49
|
const TopicIntroductionList = ({
|
|
24
50
|
topics,
|
|
25
|
-
twoColumns,
|
|
26
|
-
shortcutAlwaysExpanded,
|
|
27
|
-
showAdditionalCores,
|
|
51
|
+
twoColumns = false,
|
|
52
|
+
shortcutAlwaysExpanded = false,
|
|
53
|
+
showAdditionalCores = false,
|
|
28
54
|
toggleAdditionalCores,
|
|
29
55
|
...rest
|
|
30
|
-
}) => {
|
|
56
|
+
}: Props) => {
|
|
31
57
|
const { t } = useTranslation();
|
|
32
58
|
const renderAdditionalTopicsTrigger =
|
|
33
59
|
!showAdditionalCores &&
|
|
@@ -47,11 +73,6 @@ const TopicIntroductionList = ({
|
|
|
47
73
|
additional={additional}
|
|
48
74
|
showAdditionalCores={showAdditionalCores}
|
|
49
75
|
shortcutAlwaysExpanded={shortcutAlwaysExpanded}
|
|
50
|
-
messages={{
|
|
51
|
-
shortcutButtonText: t('resource.label'),
|
|
52
|
-
tooltipAdditionalTopic: t('resource.tooltipAdditionalTopic'),
|
|
53
|
-
tooltipCoreTopic: t('resource.tooltipCoreTopic'),
|
|
54
|
-
}}
|
|
55
76
|
id={`${topic.id}_${index}`}
|
|
56
77
|
/>
|
|
57
78
|
);
|
|
@@ -69,19 +90,4 @@ const TopicIntroductionList = ({
|
|
|
69
90
|
);
|
|
70
91
|
};
|
|
71
92
|
|
|
72
|
-
TopicIntroductionList.propTypes = {
|
|
73
|
-
toTopic: PropTypes.func.isRequired,
|
|
74
|
-
topics: PropTypes.arrayOf(TopicShape).isRequired,
|
|
75
|
-
twoColumns: PropTypes.bool,
|
|
76
|
-
shortcutAlwaysExpanded: PropTypes.bool,
|
|
77
|
-
showAdditionalCores: PropTypes.bool,
|
|
78
|
-
toggleAdditionalCores: PropTypes.func.isRequired,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
TopicIntroductionList.defaultProps = {
|
|
82
|
-
twoColumns: false,
|
|
83
|
-
shortcutAlwaysExpanded: false,
|
|
84
|
-
showAdditionalCores: false,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
93
|
export default TopicIntroductionList;
|