@ndla/ui 8.2.2 → 8.2.5
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/ResourceBox/ResourceBox.js +34 -67
- package/es/locale/messages-en.js +5 -3
- package/es/locale/messages-nb.js +5 -3
- package/es/locale/messages-nn.js +5 -3
- package/es/locale/messages-se.js +876 -0
- package/es/locale/messages-sma.js +876 -0
- package/es/model/SubjectTypes.js +9 -0
- package/es/model/index.js +3 -1
- package/lib/ResourceBox/ResourceBox.js +34 -63
- package/lib/locale/messages-en.d.ts +5 -1
- package/lib/locale/messages-en.js +6 -3
- package/lib/locale/messages-nb.d.ts +5 -1
- package/lib/locale/messages-nb.js +6 -3
- package/lib/locale/messages-nn.d.ts +5 -1
- package/lib/locale/messages-nn.js +6 -3
- package/lib/locale/messages-se.d.ts +893 -0
- package/lib/locale/messages-se.js +883 -0
- package/lib/locale/messages-sma.d.ts +893 -0
- package/lib/locale/messages-sma.js +883 -0
- package/lib/model/SubjectTypes.d.ts +9 -0
- package/lib/model/SubjectTypes.js +18 -0
- package/lib/model/index.d.ts +2 -0
- package/lib/model/index.js +4 -1
- package/package.json +10 -10
- package/src/ResourceBox/ResourceBox.tsx +47 -102
- package/src/locale/messages-en.ts +5 -1
- package/src/locale/messages-nb.ts +5 -1
- package/src/locale/messages-nn.ts +5 -1
- package/src/locale/messages-se.ts +918 -0
- package/src/locale/messages-sma.ts +918 -0
- package/src/model/SubjectTypes.ts +10 -0
- package/src/model/index.ts +2 -0
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export declare const SUBJECT = "subject";
|
|
9
|
+
export declare const RESOURCE_COLLECTION = "resourceCollection";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RESOURCE_COLLECTION = exports.SUBJECT = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) 2022-present, NDLA.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
var SUBJECT = 'subject';
|
|
16
|
+
exports.SUBJECT = SUBJECT;
|
|
17
|
+
var RESOURCE_COLLECTION = 'resourceCollection';
|
|
18
|
+
exports.RESOURCE_COLLECTION = RESOURCE_COLLECTION;
|
package/lib/model/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as contentTypes from './ContentType';
|
|
9
9
|
import * as subjectCategories from './SubjectCategories';
|
|
10
|
+
import * as subjectTypes from './SubjectTypes';
|
|
10
11
|
declare const model: {
|
|
11
12
|
contentTypes: typeof contentTypes;
|
|
12
13
|
subjectCategories: typeof subjectCategories;
|
|
14
|
+
subjectTypes: typeof subjectTypes;
|
|
13
15
|
};
|
|
14
16
|
export default model;
|
package/lib/model/index.js
CHANGED
|
@@ -11,6 +11,8 @@ var contentTypes = _interopRequireWildcard(require("./ContentType"));
|
|
|
11
11
|
|
|
12
12
|
var subjectCategories = _interopRequireWildcard(require("./SubjectCategories"));
|
|
13
13
|
|
|
14
|
+
var subjectTypes = _interopRequireWildcard(require("./SubjectTypes"));
|
|
15
|
+
|
|
14
16
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
15
17
|
|
|
16
18
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -24,7 +26,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
24
26
|
*/
|
|
25
27
|
var model = {
|
|
26
28
|
contentTypes: contentTypes,
|
|
27
|
-
subjectCategories: subjectCategories
|
|
29
|
+
subjectCategories: subjectCategories,
|
|
30
|
+
subjectTypes: subjectTypes
|
|
28
31
|
};
|
|
29
32
|
var _default = model;
|
|
30
33
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.5",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"types"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/button": "^2.1.
|
|
35
|
-
"@ndla/carousel": "^1.2.
|
|
36
|
-
"@ndla/core": "^2.1.
|
|
34
|
+
"@ndla/button": "^2.1.5",
|
|
35
|
+
"@ndla/carousel": "^1.2.5",
|
|
36
|
+
"@ndla/core": "^2.1.1",
|
|
37
37
|
"@ndla/hooks": "^1.1.3",
|
|
38
38
|
"@ndla/icons": "^1.6.1",
|
|
39
|
-
"@ndla/licenses": "^4.0.
|
|
40
|
-
"@ndla/modal": "^1.2.
|
|
41
|
-
"@ndla/safelink": "^1.1.
|
|
42
|
-
"@ndla/switch": "^0.1.
|
|
39
|
+
"@ndla/licenses": "^4.0.5",
|
|
40
|
+
"@ndla/modal": "^1.2.5",
|
|
41
|
+
"@ndla/safelink": "^1.1.6",
|
|
42
|
+
"@ndla/switch": "^0.1.5",
|
|
43
43
|
"@ndla/tabs": "^1.1.3",
|
|
44
|
-
"@ndla/tooltip": "^0.3.
|
|
44
|
+
"@ndla/tooltip": "^0.3.5",
|
|
45
45
|
"@ndla/util": "^2.0.5",
|
|
46
46
|
"@reach/menu-button": "^0.16.2",
|
|
47
47
|
"@reach/slider": "^0.16.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "9277be43c1524139f9c1fb6282ed1525591e41c3"
|
|
84
84
|
}
|
|
@@ -15,124 +15,75 @@ import { SafeLinkButton } from '@ndla/safelink';
|
|
|
15
15
|
import styled from '@emotion/styled';
|
|
16
16
|
import Image from '../Image';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const ResourceBoxContainer = styled.div`
|
|
19
19
|
display: flex;
|
|
20
|
-
padding
|
|
21
|
-
padding-bottom: 20px;
|
|
20
|
+
padding: 20px;
|
|
22
21
|
border-radius: 5px;
|
|
23
22
|
border: 1px solid ${colors.brand.light};
|
|
24
23
|
position: relative;
|
|
25
|
-
left: -16.6666666667%;
|
|
26
|
-
width: 133.3333333333%;
|
|
27
|
-
align-items: stretch;
|
|
28
|
-
margin-bottom: 24px;
|
|
29
24
|
font-family: ${fonts.sans};
|
|
30
25
|
box-shadow: 0px 20px 35px -15px rgba(32, 88, 143, 0.15);
|
|
31
26
|
gap: 40px;
|
|
32
27
|
|
|
33
28
|
${mq.range({ until: breakpoints.desktop })} {
|
|
34
|
-
gap:
|
|
29
|
+
gap: 0;
|
|
35
30
|
flex-direction: column;
|
|
36
|
-
|
|
37
|
-
width: 80%;
|
|
38
|
-
left: 0;
|
|
39
|
-
padding-left: 24px;
|
|
40
|
-
padding-right: 24px;
|
|
41
|
-
padding-bottom: 0;
|
|
42
|
-
margin-bottom: 24px;
|
|
43
|
-
height: auto;
|
|
31
|
+
padding-top: 30px;
|
|
44
32
|
text-align: center;
|
|
45
33
|
}
|
|
46
34
|
`;
|
|
47
35
|
|
|
48
|
-
const
|
|
36
|
+
const Title = styled.h3`
|
|
49
37
|
font-weight: ${fonts.weight.bold};
|
|
50
38
|
font-size: ${fonts.sizes(18)};
|
|
51
39
|
margin-top: 0;
|
|
52
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
53
|
-
text-align: center;
|
|
54
|
-
width: 100%;
|
|
55
|
-
}
|
|
56
40
|
`;
|
|
57
41
|
|
|
58
|
-
const
|
|
42
|
+
const Caption = styled.p`
|
|
59
43
|
font-size: ${fonts.sizes(14)};
|
|
44
|
+
max-width: 600px;
|
|
60
45
|
|
|
61
46
|
${mq.range({ until: breakpoints.desktop })} {
|
|
62
47
|
line-height: 22px;
|
|
63
48
|
}
|
|
64
49
|
`;
|
|
65
50
|
|
|
66
|
-
const
|
|
51
|
+
const TextWrapper = styled.div`
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
67
54
|
align-items: flex-start;
|
|
68
55
|
${mq.range({ until: breakpoints.desktop })} {
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
align-items: center;
|
|
57
|
+
padding-top: 10px;
|
|
71
58
|
}
|
|
72
59
|
`;
|
|
73
|
-
|
|
60
|
+
|
|
61
|
+
const StyledButton = styled(SafeLinkButton)`
|
|
74
62
|
border: 1px solid ${colors.brand.tertiary};
|
|
75
63
|
:hover {
|
|
76
64
|
background-color: ${colors.brand.primary};
|
|
65
|
+
border: 1px solid ${colors.brand.primary};
|
|
77
66
|
color: white;
|
|
78
67
|
}
|
|
79
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
80
|
-
width: 210px;
|
|
81
|
-
}
|
|
82
68
|
`;
|
|
83
|
-
|
|
69
|
+
|
|
70
|
+
const StyledLaunchIcon = styled(Launch)`
|
|
84
71
|
margin-left: 8px;
|
|
85
72
|
height: 15px;
|
|
86
73
|
width: 15px;
|
|
87
74
|
`;
|
|
88
75
|
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
96
|
-
width: 200px;
|
|
97
|
-
height: 200px;
|
|
98
|
-
}
|
|
99
|
-
`;
|
|
100
|
-
const ImageSectionWrapper = styled.div`
|
|
101
|
-
align-items: flex-start;
|
|
102
|
-
display: flex;
|
|
103
|
-
justify-content: center;
|
|
104
|
-
margin-left: 20px;
|
|
105
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
106
|
-
margin: 0 auto;
|
|
107
|
-
padding-top: 10px;
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
|
|
111
|
-
const CaptionSectionWrapper = styled.div`
|
|
112
|
-
max-width: 600px;
|
|
113
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
114
|
-
margin: 0 auto;
|
|
115
|
-
}
|
|
116
|
-
`;
|
|
117
|
-
|
|
118
|
-
const CenterItems = styled.div`
|
|
119
|
-
display: flex;
|
|
120
|
-
justify-content: center;
|
|
121
|
-
align-items: flex-start;
|
|
122
|
-
flex-flow: column;
|
|
123
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
124
|
-
width: 100%;
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
76
|
+
const ImageWrapper = styled.div`
|
|
77
|
+
img {
|
|
78
|
+
object-fit: cover;
|
|
79
|
+
width: 134px;
|
|
80
|
+
height: 134px;
|
|
81
|
+
border-radius: 5px;
|
|
127
82
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
text-align: center;
|
|
133
|
-
padding-top: 10px;
|
|
134
|
-
max-width: 200px;
|
|
135
|
-
margin: 0 auto;
|
|
83
|
+
${mq.range({ until: breakpoints.desktop })} {
|
|
84
|
+
width: 200px;
|
|
85
|
+
height: 200px;
|
|
86
|
+
}
|
|
136
87
|
}
|
|
137
88
|
`;
|
|
138
89
|
|
|
@@ -157,33 +108,27 @@ type Props = {
|
|
|
157
108
|
export const ResourceBox = ({ image, title, caption, licenseRights, locale, authors, url }: Props) => {
|
|
158
109
|
const { t } = useTranslation();
|
|
159
110
|
return (
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
</LincenseWrapper>
|
|
175
|
-
</TitleAndLicence>
|
|
176
|
-
<Boxcaption>{caption}</Boxcaption>
|
|
177
|
-
</CaptionSectionWrapper>
|
|
111
|
+
<ResourceBoxContainer>
|
|
112
|
+
<LincenseWrapper>
|
|
113
|
+
<LicenseByline licenseRights={licenseRights} locale={locale} marginRight color={colors.brand.tertiary}>
|
|
114
|
+
<div className="c-figure__byline-author-buttons">
|
|
115
|
+
<span className="c-figure__byline-authors">{authors?.map((author) => author.name).join(' ')}</span>
|
|
116
|
+
</div>
|
|
117
|
+
</LicenseByline>
|
|
118
|
+
</LincenseWrapper>
|
|
119
|
+
<ImageWrapper>
|
|
120
|
+
<Image alt={title} src={image} />
|
|
121
|
+
</ImageWrapper>
|
|
122
|
+
<TextWrapper>
|
|
123
|
+
<Title>{title}</Title>
|
|
124
|
+
<Caption>{caption}</Caption>
|
|
178
125
|
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
</CenterItems>
|
|
186
|
-
</BoxWrapper>
|
|
126
|
+
<StyledButton to={url} target="_blank" outline borderShape="rounded">
|
|
127
|
+
{t('license.other.itemImage.ariaLabel')}
|
|
128
|
+
<StyledLaunchIcon aria-hidden />
|
|
129
|
+
</StyledButton>
|
|
130
|
+
</TextWrapper>
|
|
131
|
+
</ResourceBoxContainer>
|
|
187
132
|
);
|
|
188
133
|
};
|
|
189
134
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { contributorTypes } from '@ndla/licenses';
|
|
10
10
|
import constants from '../model';
|
|
11
11
|
|
|
12
|
-
export const { contentTypes, subjectCategories } = constants;
|
|
12
|
+
export const { contentTypes, subjectCategories, subjectTypes } = constants;
|
|
13
13
|
|
|
14
14
|
const titleTemplate = ' - NDLA';
|
|
15
15
|
|
|
@@ -53,6 +53,10 @@ const messages = {
|
|
|
53
53
|
[subjectCategories.PROGRAMME_SUBJECTS]: 'Programme subj. SF',
|
|
54
54
|
[subjectCategories.SPECIALIZED_SUBJECTS]: 'Programme subj. YF',
|
|
55
55
|
},
|
|
56
|
+
subjectTypes: {
|
|
57
|
+
[subjectTypes.SUBJECT]: 'Subject',
|
|
58
|
+
[subjectTypes.RESOURCE_COLLECTION]: 'Resource collection',
|
|
59
|
+
},
|
|
56
60
|
searchPage: {
|
|
57
61
|
noHits: 'Your search - {{query}} - did not match any articles. ',
|
|
58
62
|
noHitsShort: 'No results for search: {{query}}',
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { contributorTypes } from '@ndla/licenses';
|
|
10
10
|
import constants from '../model';
|
|
11
11
|
|
|
12
|
-
export const { contentTypes, subjectCategories } = constants;
|
|
12
|
+
export const { contentTypes, subjectCategories, subjectTypes } = constants;
|
|
13
13
|
|
|
14
14
|
const titleTemplate = ' - NDLA';
|
|
15
15
|
|
|
@@ -53,6 +53,10 @@ const messages = {
|
|
|
53
53
|
[subjectCategories.PROGRAMME_SUBJECTS]: 'Programfag SF',
|
|
54
54
|
[subjectCategories.SPECIALIZED_SUBJECTS]: 'Yrkesfag',
|
|
55
55
|
},
|
|
56
|
+
subjectTypes: {
|
|
57
|
+
[subjectTypes.SUBJECT]: 'Fag',
|
|
58
|
+
[subjectTypes.RESOURCE_COLLECTION]: 'Ressurssamling',
|
|
59
|
+
},
|
|
56
60
|
searchPage: {
|
|
57
61
|
noHits: 'Ingen artikler samsvarte med søket ditt på: {{query}}',
|
|
58
62
|
noHitsShort: 'Ingen treff på søk: {{query}}',
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { contributorTypes } from '@ndla/licenses';
|
|
10
10
|
import constants from '../model';
|
|
11
11
|
|
|
12
|
-
export const { contentTypes, subjectCategories } = constants;
|
|
12
|
+
export const { contentTypes, subjectCategories, subjectTypes } = constants;
|
|
13
13
|
|
|
14
14
|
const titleTemplate = ' - NDLA';
|
|
15
15
|
|
|
@@ -53,6 +53,10 @@ const messages = {
|
|
|
53
53
|
[subjectCategories.PROGRAMME_SUBJECTS]: 'Programfag SF',
|
|
54
54
|
[subjectCategories.SPECIALIZED_SUBJECTS]: 'Yrkesfag',
|
|
55
55
|
},
|
|
56
|
+
subjectTypes: {
|
|
57
|
+
[subjectTypes.SUBJECT]: 'Fag',
|
|
58
|
+
[subjectTypes.RESOURCE_COLLECTION]: 'Ressurssamling',
|
|
59
|
+
},
|
|
56
60
|
searchPage: {
|
|
57
61
|
noHits: 'Ingen artiklar samsvarte med søket ditt på: {{query}}',
|
|
58
62
|
noHitsShort: 'Ingen treff på søk: {{query}}',
|