@ndla/ui 33.3.1 → 33.3.3
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/Frontpage/FrontpageMultidisciplinarySubject.js +9 -9
- package/es/Frontpage/FrontpageToolbox.js +8 -8
- package/es/LearningPaths/LearningPathMenuAside.js +8 -8
- package/es/Navigation/NavigationBox.js +34 -30
- package/es/Programme/ProgrammeSubjects.js +4 -4
- package/es/ResourceBox/ResourceBox.js +8 -8
- package/es/ResourceGroup/ResourceGroup.js +12 -19
- package/es/ResourceGroup/ResourceItem.js +34 -36
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.js +9 -9
- package/lib/Frontpage/FrontpageToolbox.js +8 -8
- package/lib/LearningPaths/LearningPathMenuAside.js +8 -8
- package/lib/Navigation/NavigationBox.d.ts +1 -1
- package/lib/Navigation/NavigationBox.js +34 -30
- package/lib/Programme/ProgrammeSubjects.js +4 -4
- package/lib/ResourceBox/ResourceBox.js +8 -8
- package/lib/ResourceGroup/ResourceGroup.d.ts +3 -1
- package/lib/ResourceGroup/ResourceGroup.js +11 -18
- package/lib/ResourceGroup/ResourceItem.js +34 -36
- package/package.json +6 -6
- package/src/Frontpage/FrontpageMultidisciplinarySubject.tsx +1 -1
- package/src/Frontpage/FrontpageToolbox.tsx +2 -2
- package/src/LearningPaths/LearningPathMenuAside.tsx +2 -2
- package/src/Navigation/NavigationBox.tsx +13 -12
- package/src/Programme/ProgrammeSubjects.tsx +3 -3
- package/src/ResourceBox/ResourceBox.tsx +1 -2
- package/src/ResourceGroup/ResourceGroup.tsx +13 -18
- package/src/ResourceGroup/ResourceItem.tsx +31 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "33.3.
|
|
3
|
+
"version": "33.3.3",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ndla/article-scripts": "^3.0.14",
|
|
35
|
-
"@ndla/button": "^7.0.
|
|
35
|
+
"@ndla/button": "^7.0.5",
|
|
36
36
|
"@ndla/carousel": "^2.1.1",
|
|
37
37
|
"@ndla/core": "^3.0.3",
|
|
38
|
-
"@ndla/forms": "^4.1.
|
|
38
|
+
"@ndla/forms": "^4.1.9",
|
|
39
39
|
"@ndla/hooks": "^1.2.0",
|
|
40
40
|
"@ndla/icons": "^2.1.1",
|
|
41
41
|
"@ndla/licenses": "^6.1.5",
|
|
42
42
|
"@ndla/modal": "^2.2.2",
|
|
43
|
-
"@ndla/notion": "^4.1.
|
|
44
|
-
"@ndla/safelink": "^
|
|
43
|
+
"@ndla/notion": "^4.1.11",
|
|
44
|
+
"@ndla/safelink": "^4.0.0",
|
|
45
45
|
"@ndla/switch": "^1.0.3",
|
|
46
46
|
"@ndla/tabs": "^2.1.1",
|
|
47
47
|
"@ndla/tooltip": "^4.0.3",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "312f7ebe89fd733409c3d62723cd7209bef67ad6"
|
|
86
86
|
}
|
|
@@ -101,7 +101,7 @@ const FrontpageMultidisciplinarySubject = ({ url, topics, headingLevel }: Props)
|
|
|
101
101
|
</Content>
|
|
102
102
|
</Wrapper>
|
|
103
103
|
<TargetItem className="o-text-link__wrapper o-text-link__wrapper">
|
|
104
|
-
<SafeLinkButton to={url}
|
|
104
|
+
<SafeLinkButton to={url} size="medium" shape="pill">
|
|
105
105
|
{t('frontpageMultidisciplinarySubject.linkText')}
|
|
106
106
|
</SafeLinkButton>
|
|
107
107
|
</TargetItem>
|
|
@@ -59,10 +59,10 @@ const FrontpageToolbox = ({ urlStudents, urlTeachers, headingLevel }: Props) =>
|
|
|
59
59
|
<ToolboxWrapper>
|
|
60
60
|
<StyledText>{t('frontPageToolbox.text')}</StyledText>
|
|
61
61
|
</ToolboxWrapper>
|
|
62
|
-
<StyledStudentsButton to={urlStudents}
|
|
62
|
+
<StyledStudentsButton to={urlStudents} size="medium" shape="pill">
|
|
63
63
|
{t('frontPageToolbox.linkTextStudents')}
|
|
64
64
|
</StyledStudentsButton>
|
|
65
|
-
<SafeLinkButton to={urlTeachers}
|
|
65
|
+
<SafeLinkButton to={urlTeachers} size="medium" shape="pill">
|
|
66
66
|
{t('frontPageToolbox.linkTextTeachers')}
|
|
67
67
|
</SafeLinkButton>
|
|
68
68
|
<Illustration />
|
|
@@ -123,8 +123,8 @@ const LearningPathMenuAside = ({ lastUpdated, learningPathURL, copyright, isOpen
|
|
|
123
123
|
to={learningPathURL}
|
|
124
124
|
target="_blank"
|
|
125
125
|
rel="noopener noreferrer"
|
|
126
|
-
outline
|
|
127
|
-
|
|
126
|
+
variant="outline"
|
|
127
|
+
inverted={invertedStyle}>
|
|
128
128
|
{t('learningPath.createLearningPathButtonText')}
|
|
129
129
|
</StyledSafeLinkButton>
|
|
130
130
|
</StyledAside>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { MouseEvent, ChangeEventHandler } from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { SafeLinkButton } from '@ndla/safelink';
|
|
4
|
-
import
|
|
4
|
+
import { ButtonV2 } from '@ndla/button';
|
|
5
5
|
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
6
6
|
import { css } from '@emotion/react';
|
|
7
7
|
import { Switch } from '@ndla/switch';
|
|
@@ -172,6 +172,12 @@ const StyledButtonContentSelected = styled.span`
|
|
|
172
172
|
margin-left: ${spacing.small};
|
|
173
173
|
`;
|
|
174
174
|
|
|
175
|
+
const listElementStyle = css`
|
|
176
|
+
display: flex;
|
|
177
|
+
flex: 1;
|
|
178
|
+
text-align: left;
|
|
179
|
+
`;
|
|
180
|
+
|
|
175
181
|
export type ItemProps = {
|
|
176
182
|
url?: string;
|
|
177
183
|
label: string;
|
|
@@ -182,7 +188,7 @@ export type ItemProps = {
|
|
|
182
188
|
};
|
|
183
189
|
type Props = {
|
|
184
190
|
heading?: string;
|
|
185
|
-
colorMode?: '
|
|
191
|
+
colorMode?: 'primary' | 'darker' | 'light' | 'greyLightest' | 'greyLighter';
|
|
186
192
|
isButtonElements?: boolean;
|
|
187
193
|
items: ItemProps[];
|
|
188
194
|
onClick?: (event: MouseEvent<HTMLElement>, id?: string) => void;
|
|
@@ -195,7 +201,7 @@ type Props = {
|
|
|
195
201
|
|
|
196
202
|
export const NavigationBox = ({
|
|
197
203
|
heading,
|
|
198
|
-
colorMode = '
|
|
204
|
+
colorMode = 'primary',
|
|
199
205
|
items,
|
|
200
206
|
isButtonElements,
|
|
201
207
|
onClick,
|
|
@@ -206,7 +212,7 @@ export const NavigationBox = ({
|
|
|
206
212
|
onToggleAdditionalResources = () => {},
|
|
207
213
|
}: Props) => {
|
|
208
214
|
const { t } = useTranslation();
|
|
209
|
-
const ListElementType = isButtonElements ?
|
|
215
|
+
const ListElementType = isButtonElements ? ButtonV2 : SafeLinkButton;
|
|
210
216
|
return (
|
|
211
217
|
<StyledWrapper>
|
|
212
218
|
<StyledHeadingWrapper>
|
|
@@ -230,15 +236,10 @@ export const NavigationBox = ({
|
|
|
230
236
|
selected={item.selected}>
|
|
231
237
|
<ListElementType
|
|
232
238
|
to={item.url ?? ''}
|
|
233
|
-
|
|
234
|
-
greyLighter={!item.selected && colorMode === 'greyLighter'}
|
|
235
|
-
greyLightest={!item.selected && colorMode === 'greyLightest'}
|
|
236
|
-
darker={item.selected}
|
|
237
|
-
buttonSize="medium"
|
|
239
|
+
colorTheme={item.selected ? 'darker' : colorMode}
|
|
238
240
|
size="medium"
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
textAlign="left"
|
|
241
|
+
shape="sharp"
|
|
242
|
+
css={listElementStyle}
|
|
242
243
|
onClick={(e: MouseEvent<HTMLElement>) => {
|
|
243
244
|
if (onClick) {
|
|
244
245
|
onClick(e, item.id);
|
|
@@ -58,9 +58,9 @@ const ProgrammeSubjects = ({ grades, onNavigate, selectedGrade = 'vg1' }: Props)
|
|
|
58
58
|
<li key={item.name}>
|
|
59
59
|
<SafeLinkButton
|
|
60
60
|
to={current ? '' : item.name.toLowerCase()}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
colorTheme={item !== grade ? 'lighter' : undefined}
|
|
62
|
+
shape="pill"
|
|
63
|
+
size="normal"
|
|
64
64
|
aria-current={current}>
|
|
65
65
|
{item.name}
|
|
66
66
|
</SafeLinkButton>
|
|
@@ -99,8 +99,7 @@ export const ResourceBox = ({ image, title, caption, url, buttonText }: Props) =
|
|
|
99
99
|
<ContentWrapper>
|
|
100
100
|
<Title>{title}</Title>
|
|
101
101
|
<Caption>{caption}</Caption>
|
|
102
|
-
|
|
103
|
-
<StyledButton to={url} target="_blank" outline borderShape="rounded">
|
|
102
|
+
<StyledButton to={url} target="_blank" variant="outline" shape="pill">
|
|
104
103
|
{buttonText}
|
|
105
104
|
<Launch aria-hidden />
|
|
106
105
|
</StyledButton>
|
|
@@ -8,35 +8,33 @@
|
|
|
8
8
|
|
|
9
9
|
import React, { ReactNode } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
|
-
import {
|
|
11
|
+
import { css } from '@emotion/react';
|
|
12
|
+
import { colors, fonts, spacing } from '@ndla/core';
|
|
12
13
|
|
|
13
14
|
import ResourceList, { ResourceListProps } from './ResourceList';
|
|
15
|
+
import { HeadingLevel } from '../types';
|
|
14
16
|
|
|
15
17
|
const Wrapper = styled.section`
|
|
16
18
|
margin-bottom: ${spacing.large};
|
|
17
19
|
`;
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
invertedStyle?: boolean;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const StyledHeader = styled.header<StyledHeaderProps>`
|
|
24
|
-
margin: ${spacing.small} 0 ${spacing.xsmall};
|
|
25
|
-
${(props) => props.invertedStyle && `color: #fff`};
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
const StyledHeading = styled.h1`
|
|
21
|
+
const headingStyle = css`
|
|
29
22
|
${fonts.sizes('16px', '18px')};
|
|
30
23
|
font-weight: ${fonts.weight.bold};
|
|
31
24
|
text-transform: uppercase;
|
|
32
25
|
letter-spacing: 0.05em;
|
|
33
|
-
margin: 0;
|
|
26
|
+
margin: ${spacing.small} 0 ${spacing.xsmall};
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const invertedStyle = css`
|
|
30
|
+
color: ${colors.white};
|
|
34
31
|
`;
|
|
35
32
|
|
|
36
33
|
type Props = {
|
|
37
34
|
invertedStyle?: boolean;
|
|
38
35
|
toggleAdditionalResources: () => void;
|
|
39
36
|
heartButton?: (path: string) => ReactNode;
|
|
37
|
+
headingLevel?: HeadingLevel;
|
|
40
38
|
};
|
|
41
39
|
|
|
42
40
|
const ResourceGroup = ({
|
|
@@ -45,15 +43,12 @@ const ResourceGroup = ({
|
|
|
45
43
|
showAdditionalResources,
|
|
46
44
|
toggleAdditionalResources,
|
|
47
45
|
contentType,
|
|
48
|
-
invertedStyle,
|
|
46
|
+
invertedStyle: invertedStyleProp,
|
|
47
|
+
headingLevel: Heading = 'h1',
|
|
49
48
|
heartButton,
|
|
50
49
|
}: Props & ResourceListProps) => (
|
|
51
50
|
<Wrapper>
|
|
52
|
-
{title &&
|
|
53
|
-
<StyledHeader invertedStyle={invertedStyle}>
|
|
54
|
-
<StyledHeading>{title}</StyledHeading>
|
|
55
|
-
</StyledHeader>
|
|
56
|
-
)}
|
|
51
|
+
{title && <Heading css={[headingStyle, invertedStyleProp ? invertedStyle : undefined]}>{title}</Heading>}
|
|
57
52
|
{resources.length > 0 ? (
|
|
58
53
|
<ResourceList
|
|
59
54
|
title={title}
|
|
@@ -80,9 +80,9 @@ const ListElement = styled.li<ListElementProps>`
|
|
|
80
80
|
props.additional &&
|
|
81
81
|
css`
|
|
82
82
|
border-style: dashed;
|
|
83
|
-
animation-name: ${fadeInAdditionalsKeyframe};
|
|
84
83
|
animation-duration: 0.8s;
|
|
85
84
|
animation-fill-mode: forwards;
|
|
85
|
+
animation: ${fadeInAdditionalsKeyframe};
|
|
86
86
|
`}
|
|
87
87
|
${(props) => props.extraBottomMargin && `margin-bottom: ${spacing.large};`}
|
|
88
88
|
|
|
@@ -143,10 +143,7 @@ const ResourceLink = styled(SafeLink)`
|
|
|
143
143
|
}
|
|
144
144
|
`;
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
active?: boolean;
|
|
148
|
-
};
|
|
149
|
-
const Heading = styled.h2<ActiveProps>`
|
|
146
|
+
const headingStyle = css`
|
|
150
147
|
font-weight: ${fonts.weight.semibold};
|
|
151
148
|
transform: translateY(-1px);
|
|
152
149
|
text-transform: none;
|
|
@@ -161,28 +158,21 @@ const Heading = styled.h2<ActiveProps>`
|
|
|
161
158
|
${fonts.sizes('20px', '26px')};
|
|
162
159
|
}
|
|
163
160
|
|
|
164
|
-
|
|
165
|
-
box-shadow: ${colors.link};
|
|
166
|
-
}
|
|
161
|
+
box-shadow: ${colors.link};
|
|
167
162
|
|
|
168
163
|
${ResourceLink}:hover &,
|
|
169
164
|
${ResourceLink}:focus & {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
box-shadow: ${colors.linkHover};
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
|
|
169
|
+
const activeHeadingStyle = css`
|
|
170
|
+
color: ${colors.brand.greyDark};
|
|
171
|
+
box-shadow: none;
|
|
172
|
+
small {
|
|
173
|
+
padding-left: ${spacing.small};
|
|
174
|
+
font-weight: ${fonts.weight.normal};
|
|
173
175
|
}
|
|
174
|
-
${(props) =>
|
|
175
|
-
props.active &&
|
|
176
|
-
css`
|
|
177
|
-
color: ${colors.brand.greyDark};
|
|
178
|
-
span {
|
|
179
|
-
box-shadow: none;
|
|
180
|
-
}
|
|
181
|
-
small {
|
|
182
|
-
padding-left: ${spacing.small};
|
|
183
|
-
font-weight: ${fonts.weight.normal};
|
|
184
|
-
}
|
|
185
|
-
`}
|
|
186
176
|
`;
|
|
187
177
|
|
|
188
178
|
const IconWrapper = styled.div`
|
|
@@ -247,6 +237,7 @@ const ResourceItem = ({
|
|
|
247
237
|
const hidden = additional ? !showAdditionalResources : false;
|
|
248
238
|
return (
|
|
249
239
|
<ListElement
|
|
240
|
+
aria-current={active ? 'page' : undefined}
|
|
250
241
|
contentType={contentType}
|
|
251
242
|
hidden={hidden && !active}
|
|
252
243
|
active={active}
|
|
@@ -257,21 +248,17 @@ const ResourceItem = ({
|
|
|
257
248
|
<IconWrapper>
|
|
258
249
|
<ContentTypeBadge type={contentType ?? ''} background border={false} />
|
|
259
250
|
</IconWrapper>
|
|
260
|
-
<
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
</span>
|
|
265
|
-
</Heading>
|
|
251
|
+
<span css={[headingStyle, activeHeadingStyle]}>
|
|
252
|
+
{name}
|
|
253
|
+
<small>{t('resource.youAreHere')}</small>
|
|
254
|
+
</span>
|
|
266
255
|
</ActiveWrapper>
|
|
267
256
|
) : (
|
|
268
257
|
<ResourceLink to={path}>
|
|
269
258
|
<IconWrapper>
|
|
270
259
|
<ContentTypeBadge type={contentType ?? ''} background border={false} />
|
|
271
260
|
</IconWrapper>
|
|
272
|
-
<
|
|
273
|
-
<span>{name}</span>
|
|
274
|
-
</Heading>
|
|
261
|
+
<span css={headingStyle}>{name}</span>
|
|
275
262
|
</ResourceLink>
|
|
276
263
|
)}
|
|
277
264
|
<TypeWrapper>
|
|
@@ -288,18 +275,22 @@ const ResourceItem = ({
|
|
|
288
275
|
<>
|
|
289
276
|
{additional && (
|
|
290
277
|
<Tooltip tooltip={contentTypeDescription}>
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
278
|
+
<div>
|
|
279
|
+
<Additional
|
|
280
|
+
className="c-icon--20 u-margin-left-tiny c-topic-resource__list__additional-icons"
|
|
281
|
+
aria-label={contentTypeDescription}
|
|
282
|
+
/>
|
|
283
|
+
</div>
|
|
295
284
|
</Tooltip>
|
|
296
285
|
)}
|
|
297
286
|
{!additional && (
|
|
298
287
|
<Tooltip tooltip={contentTypeDescription}>
|
|
299
|
-
<
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
288
|
+
<div>
|
|
289
|
+
<Core
|
|
290
|
+
className="c-icon--20 u-margin-left-tiny c-topic-resource__list__additional-icons"
|
|
291
|
+
aria-label={contentTypeDescription}
|
|
292
|
+
/>
|
|
293
|
+
</div>
|
|
303
294
|
</Tooltip>
|
|
304
295
|
)}
|
|
305
296
|
</>
|