@ndla/ui 25.1.0 → 25.2.0
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/ArticleFavoritesButton.js +2 -1
- package/es/Frontpage/FrontpageHeader.js +7 -5
- package/es/Frontpage/FrontpageProgramMenu.js +12 -10
- package/es/Image/Image.js +5 -4
- package/es/LanguageSelector/LanguageSelector.js +31 -26
- package/es/Masthead/Masthead.js +8 -8
- package/es/Masthead/MastheadAuthModal.js +11 -11
- package/es/Masthead/MastheadSearchModal.js +9 -11
- package/es/NDLAFilm/AboutNdlaFilm.js +3 -3
- package/es/Navigation/NavigationHeading.js +9 -6
- package/es/Navigation/NavigationTopicAbout.js +15 -14
- package/es/Programme/Programme.js +10 -7
- package/es/Search/SearchField.js +4 -3
- package/es/Search/SearchFieldForm.js +4 -3
- package/es/Search/ToggleSearchButton.js +3 -3
- package/es/TagSelector/SuggestionInput.js +8 -8
- package/es/Topic/Topic.js +21 -20
- package/es/TopicMenu/TopicMenu.js +22 -13
- package/es/TopicMenu/TopicMenuButton.js +5 -5
- package/es/all.css +1 -1
- package/es/locale/messages-nb.js +2 -2
- package/es/locale/messages-nn.js +2 -2
- package/es/locale/messages-se.js +2 -2
- package/es/locale/messages-sma.js +2 -2
- package/lib/Article/ArticleFavoritesButton.js +2 -1
- package/lib/Frontpage/FrontpageHeader.js +7 -5
- package/lib/Frontpage/FrontpageProgramMenu.js +12 -10
- package/lib/Image/Image.d.ts +1 -1
- package/lib/Image/Image.js +5 -4
- package/lib/LanguageSelector/LanguageSelector.d.ts +1 -1
- package/lib/LanguageSelector/LanguageSelector.js +31 -26
- package/lib/Masthead/Masthead.js +8 -8
- package/lib/Masthead/MastheadAuthModal.js +11 -11
- package/lib/Masthead/MastheadSearchModal.js +9 -11
- package/lib/NDLAFilm/AboutNdlaFilm.js +4 -4
- package/lib/Navigation/NavigationHeading.d.ts +2 -1
- package/lib/Navigation/NavigationHeading.js +9 -6
- package/lib/Navigation/NavigationTopicAbout.js +15 -14
- package/lib/Programme/Programme.d.ts +2 -1
- package/lib/Programme/Programme.js +10 -7
- package/lib/Search/SearchField.js +4 -3
- package/lib/Search/SearchFieldForm.js +4 -3
- package/lib/Search/ToggleSearchButton.js +3 -3
- package/lib/TagSelector/SuggestionInput.js +8 -8
- package/lib/Topic/Topic.js +21 -20
- package/lib/TopicMenu/TopicMenu.js +47 -39
- package/lib/TopicMenu/TopicMenuButton.js +6 -6
- package/lib/all.css +1 -1
- package/lib/locale/messages-nb.js +2 -2
- package/lib/locale/messages-nn.js +2 -2
- package/lib/locale/messages-se.js +2 -2
- package/lib/locale/messages-sma.js +2 -2
- package/package.json +11 -11
- package/src/Article/ArticleFavoritesButton.tsx +2 -1
- package/src/Frontpage/FrontpageHeader.tsx +1 -1
- package/src/Frontpage/FrontpageProgramMenu.tsx +1 -1
- package/src/Image/Image.tsx +1 -1
- package/src/LanguageSelector/LanguageSelector.tsx +21 -23
- package/src/Masthead/Masthead.tsx +2 -0
- package/src/Masthead/MastheadAuthModal.tsx +16 -16
- package/src/Masthead/MastheadSearchModal.tsx +6 -23
- package/src/NDLAFilm/AboutNdlaFilm.tsx +2 -2
- package/src/Navigation/NavigationHeading.tsx +3 -2
- package/src/Navigation/NavigationTopicAbout.tsx +1 -0
- package/src/Programme/Programme.tsx +11 -2
- package/src/Search/SearchField.tsx +6 -1
- package/src/Search/SearchFieldForm.tsx +1 -1
- package/src/Search/ToggleSearchButton.tsx +2 -2
- package/src/TagSelector/SuggestionInput.tsx +1 -1
- package/src/Topic/Topic.tsx +1 -0
- package/src/TopicMenu/TopicMenu.jsx +23 -17
- package/src/TopicMenu/TopicMenuButton.jsx +6 -7
- package/src/locale/messages-nb.ts +1 -1
- package/src/locale/messages-nn.ts +1 -1
- package/src/locale/messages-se.ts +1 -1
- package/src/locale/messages-sma.ts +1 -1
- package/src/main.scss +0 -1
- package/es/Article/ArticleAuthorContent.js +0 -71
- package/lib/Article/ArticleAuthorContent.d.ts +0 -28
- package/lib/Article/ArticleAuthorContent.js +0 -88
- package/src/Article/ArticleAuthorContent.tsx +0 -107
- package/src/Article/component.article-author-popup.scss +0 -90
|
@@ -1004,8 +1004,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1004
1004
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1005
1005
|
welcome: 'Velkommen til Min NDLA! Nå kan du lagre dine favorittressurser fra NDLA og organisere dem slik du ønsker i mapper og med emneknagger.',
|
|
1006
1006
|
read: {
|
|
1007
|
-
our: 'Les
|
|
1008
|
-
ours: 'Les
|
|
1007
|
+
our: 'Les vår',
|
|
1008
|
+
ours: 'Les våre'
|
|
1009
1009
|
},
|
|
1010
1010
|
privacy: 'personvernerklæring her',
|
|
1011
1011
|
questions: {
|
|
@@ -1004,8 +1004,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1004
1004
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1005
1005
|
welcome: 'Velkommen til Min NDLA! Nå kan du lagre dine favorittressurser fra NDLA og organisere dem slik du ønsker i mapper og med tags.',
|
|
1006
1006
|
read: {
|
|
1007
|
-
our: 'Les
|
|
1008
|
-
ours: 'Les
|
|
1007
|
+
our: 'Les vår',
|
|
1008
|
+
ours: 'Les våre'
|
|
1009
1009
|
},
|
|
1010
1010
|
privacy: 'personvernerklæring her',
|
|
1011
1011
|
questions: {
|
|
@@ -1004,8 +1004,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1004
1004
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1005
1005
|
welcome: 'Velkommen til Min NDLA! Nå kan du lagre dine favorittressurser fra NDLA og organisere dem slik du ønsker i mapper og med emneknagger.',
|
|
1006
1006
|
read: {
|
|
1007
|
-
our: 'Les
|
|
1008
|
-
ours: 'Les
|
|
1007
|
+
our: 'Les vår',
|
|
1008
|
+
ours: 'Les våre'
|
|
1009
1009
|
},
|
|
1010
1010
|
privacy: 'personvernerklæring her',
|
|
1011
1011
|
questions: {
|
|
@@ -1004,8 +1004,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1004
1004
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1005
1005
|
welcome: 'Velkommen til Min NDLA! Nå kan du lagre dine favorittressurser fra NDLA og organisere dem slik du ønsker i mapper og med emneknagger.',
|
|
1006
1006
|
read: {
|
|
1007
|
-
our: 'Les
|
|
1008
|
-
ours: 'Les
|
|
1007
|
+
our: 'Les vår',
|
|
1008
|
+
ours: 'Les våre'
|
|
1009
1009
|
},
|
|
1010
1010
|
privacy: 'personvernerklæring her',
|
|
1011
1011
|
questions: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.2.0",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ndla/article-scripts": "^3.0.1",
|
|
35
|
-
"@ndla/button": "^3.
|
|
36
|
-
"@ndla/carousel": "^1.2.
|
|
35
|
+
"@ndla/button": "^3.4.0",
|
|
36
|
+
"@ndla/carousel": "^1.2.20",
|
|
37
37
|
"@ndla/core": "^2.3.5",
|
|
38
|
-
"@ndla/forms": "^3.1.
|
|
38
|
+
"@ndla/forms": "^3.1.9",
|
|
39
39
|
"@ndla/hooks": "^1.1.5",
|
|
40
|
-
"@ndla/icons": "^1.11.
|
|
41
|
-
"@ndla/licenses": "^5.0.
|
|
42
|
-
"@ndla/modal": "^1.3.
|
|
43
|
-
"@ndla/notion": "^3.1.
|
|
44
|
-
"@ndla/safelink": "^2.2.
|
|
40
|
+
"@ndla/icons": "^1.11.8",
|
|
41
|
+
"@ndla/licenses": "^5.0.13",
|
|
42
|
+
"@ndla/modal": "^1.3.4",
|
|
43
|
+
"@ndla/notion": "^3.1.37",
|
|
44
|
+
"@ndla/safelink": "^2.2.12",
|
|
45
45
|
"@ndla/switch": "^0.1.13",
|
|
46
|
-
"@ndla/tabs": "^1.1.
|
|
46
|
+
"@ndla/tabs": "^1.1.19",
|
|
47
47
|
"@ndla/tooltip": "^2.2.1",
|
|
48
48
|
"@ndla/types-learningpath-api": "^0.0.13",
|
|
49
49
|
"@ndla/util": "^3.0.1",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "77c572e47d6e8438fe2fa7683696963375244a82"
|
|
89
89
|
}
|
|
@@ -31,7 +31,8 @@ export const ArticleFavoritesButton = ({ isFavorite, onToggleAddToFavorites, art
|
|
|
31
31
|
inactiveIcon={<HeartOutline />}
|
|
32
32
|
active={isFavorite}
|
|
33
33
|
size="small"
|
|
34
|
-
|
|
34
|
+
variant="ghost"
|
|
35
|
+
shape="pill"
|
|
35
36
|
onClick={() => onToggleAddToFavorites(articleId, !isFavorite)}
|
|
36
37
|
/>
|
|
37
38
|
</Tooltip>
|
|
@@ -61,7 +61,7 @@ const FrontpageHeader = ({ locale, showHeader = true, children, t }: FrontPageHe
|
|
|
61
61
|
<SvgLogo locale={locale} />
|
|
62
62
|
</StyledLogo>
|
|
63
63
|
{showHeader && (
|
|
64
|
-
<HeaderIllustrationWrapper>
|
|
64
|
+
<HeaderIllustrationWrapper aria-hidden="true">
|
|
65
65
|
<FrontpageHeaderIllustration />
|
|
66
66
|
</HeaderIllustrationWrapper>
|
|
67
67
|
)}
|
|
@@ -119,7 +119,7 @@ const FrontpageProgramMenu = ({ programItems, subjectCategories, showBetaCursor
|
|
|
119
119
|
<StyledMenuItem>{t('frontpageMenu.allsubjects')}</StyledMenuItem>
|
|
120
120
|
</Button>
|
|
121
121
|
{showBetaCursor && (
|
|
122
|
-
<CursorPlaceholder>
|
|
122
|
+
<CursorPlaceholder aria-hidden="true">
|
|
123
123
|
<CursorWrapper>
|
|
124
124
|
<LeftCursor hide={showSubjects} />
|
|
125
125
|
<CursorTextWrapper>
|
package/src/Image/Image.tsx
CHANGED
|
@@ -64,10 +64,10 @@ const Image = ({
|
|
|
64
64
|
contentType,
|
|
65
65
|
sizes = '(min-width: 1024px) 1024px, 100vw',
|
|
66
66
|
expandButton,
|
|
67
|
+
fallbackWidth = 1024,
|
|
67
68
|
...rest
|
|
68
69
|
}: Props) => {
|
|
69
70
|
const srcSet = rest.srcSet ?? getSrcSet(src, crop, focalPoint);
|
|
70
|
-
const fallbackWidth = rest.fallbackWidth ?? 1024;
|
|
71
71
|
const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
|
|
72
72
|
|
|
73
73
|
if (contentType && contentType === 'image/gif') {
|
|
@@ -10,7 +10,7 @@ import React, { useState } from 'react';
|
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { css } from '@emotion/core';
|
|
12
12
|
import FocusTrapReact from 'focus-trap-react';
|
|
13
|
-
import
|
|
13
|
+
import { ButtonV2 as Button } from '@ndla/button';
|
|
14
14
|
import { spacing, misc, colors, mq, breakpoints, animations, fonts, spacingUnit } from '@ndla/core';
|
|
15
15
|
import { ChevronDown } from '@ndla/icons/common';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
@@ -95,12 +95,6 @@ const StyledSpan = styled.span`
|
|
|
95
95
|
font-weight: ${fonts.weight.semibold};
|
|
96
96
|
`;
|
|
97
97
|
|
|
98
|
-
const styledInvertedOutlineLargeScreensOnly = css`
|
|
99
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
100
|
-
${appearances.ghostPillOutlineInverted}
|
|
101
|
-
}
|
|
102
|
-
`;
|
|
103
|
-
|
|
104
98
|
type Props = {
|
|
105
99
|
options: {
|
|
106
100
|
[key: string]: {
|
|
@@ -116,31 +110,35 @@ type Props = {
|
|
|
116
110
|
alwaysVisible?: boolean;
|
|
117
111
|
};
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
113
|
+
interface StyledButtonProps {
|
|
114
|
+
outline?: boolean;
|
|
115
|
+
inverted?: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const StyledButton = styled(Button)<StyledButtonProps>`
|
|
119
|
+
border-color: ${({ inverted, outline }) =>
|
|
120
|
+
outline ? (inverted ? colors.white : colors.brand.primary) : 'transparent'};
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
const LanguageSelector = ({ currentLanguage, outline, center, inverted, alwaysVisible }: Props) => {
|
|
127
124
|
const { t, i18n } = useTranslation();
|
|
128
125
|
const [infoLocale, setInfoLocale] = useState(i18n.language);
|
|
129
126
|
const [isOpen, setIsOpen] = useState(false);
|
|
130
127
|
return (
|
|
131
128
|
<StyledWrapper alwaysVisible={alwaysVisible}>
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
<StyledButton
|
|
130
|
+
outline={outline}
|
|
131
|
+
inverted={inverted}
|
|
132
|
+
shape="pill"
|
|
133
|
+
size="medium"
|
|
134
|
+
colorTheme="lighter"
|
|
135
|
+
variant="ghost"
|
|
138
136
|
onClick={() => setIsOpen(true)}>
|
|
139
137
|
<StyledSpan>
|
|
140
138
|
{t(`languages.prefixChangeLanguage`)}: {t(`languages.${infoLocale}`)}
|
|
141
139
|
</StyledSpan>
|
|
142
140
|
<ChevronDown />
|
|
143
|
-
</
|
|
141
|
+
</StyledButton>
|
|
144
142
|
{isOpen && (
|
|
145
143
|
<FocusTrapReact
|
|
146
144
|
active
|
|
@@ -153,7 +151,7 @@ const LanguageSelector = ({
|
|
|
153
151
|
}}>
|
|
154
152
|
<StyledModal animateIn={isOpen} centered={center}>
|
|
155
153
|
<Button
|
|
156
|
-
link
|
|
154
|
+
variant="link"
|
|
157
155
|
onClick={() => {
|
|
158
156
|
setIsOpen(false);
|
|
159
157
|
}}>
|
|
@@ -21,6 +21,7 @@ interface MastheadItemProps {
|
|
|
21
21
|
|
|
22
22
|
const LeftMastheadItem = styled.div`
|
|
23
23
|
display: flex;
|
|
24
|
+
align-items: center;
|
|
24
25
|
button {
|
|
25
26
|
white-space: nowrap;
|
|
26
27
|
}
|
|
@@ -35,6 +36,7 @@ const LeftMastheadItem = styled.div`
|
|
|
35
36
|
|
|
36
37
|
const RightMastheadItem = styled.div`
|
|
37
38
|
display: flex;
|
|
39
|
+
gap: ${spacing.small};
|
|
38
40
|
align-items: center;
|
|
39
41
|
justify-content: flex-end;
|
|
40
42
|
${mq.range({ from: breakpoints.tablet })} {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
|
-
import Button from '@ndla/button';
|
|
11
|
+
import { ButtonV2 as Button } from '@ndla/button';
|
|
12
12
|
import { Feide } from '@ndla/icons/common';
|
|
13
|
-
import { colors,
|
|
13
|
+
import { colors, spacing } from '@ndla/core';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
|
|
16
16
|
import AuthModal, { AuthModalProps } from '../User/AuthModal';
|
|
@@ -20,20 +20,15 @@ type FeideWrapperProps = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const StyledButton = styled(Button)<FeideWrapperProps>`
|
|
23
|
-
|
|
24
|
-
display: flex;
|
|
25
|
-
align-items: center;
|
|
26
|
-
.feide-icon svg {
|
|
23
|
+
svg {
|
|
27
24
|
margin-left: ${spacing.xsmall};
|
|
28
|
-
|
|
29
|
-
color: ${(props) => (props.inverted ? `#ffffff` : `#000000`)};
|
|
25
|
+
color: ${(props) => (props.inverted ? colors.white : colors.brand.primary)};
|
|
30
26
|
width: 22px;
|
|
31
27
|
height: 22px;
|
|
32
28
|
}
|
|
33
|
-
&:hover
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
29
|
+
&:hover svg,
|
|
30
|
+
&:focus svg {
|
|
31
|
+
color: ${colors.brand.primary};
|
|
37
32
|
}
|
|
38
33
|
`;
|
|
39
34
|
|
|
@@ -43,15 +38,20 @@ interface Props extends AuthModalProps {
|
|
|
43
38
|
|
|
44
39
|
const MastheadAuthModal = ({ inverted, ...rest }: Props) => {
|
|
45
40
|
const { t } = useTranslation();
|
|
41
|
+
|
|
46
42
|
return (
|
|
47
43
|
<AuthModal
|
|
48
44
|
{...rest}
|
|
49
45
|
activateButton={
|
|
50
|
-
<StyledButton
|
|
46
|
+
<StyledButton
|
|
47
|
+
inverted={inverted}
|
|
48
|
+
shape="pill"
|
|
49
|
+
size="medium"
|
|
50
|
+
colorTheme="lighter"
|
|
51
|
+
variant="ghost"
|
|
52
|
+
aria-label={t('user.buttonLogIn')}>
|
|
51
53
|
{t('myNdla.myNDLA')}
|
|
52
|
-
<
|
|
53
|
-
<Feide />
|
|
54
|
-
</span>
|
|
54
|
+
<Feide />
|
|
55
55
|
</StyledButton>
|
|
56
56
|
}
|
|
57
57
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactChild, ReactChildren, ReactNode } from 'react';
|
|
2
2
|
import Modal from '@ndla/modal';
|
|
3
|
-
import
|
|
3
|
+
import { IconButtonV2 as IconButton } from '@ndla/button';
|
|
4
4
|
import { Cross } from '@ndla/icons/action';
|
|
5
5
|
import { isFunction } from '@ndla/util';
|
|
6
6
|
import styled from '@emotion/styled';
|
|
@@ -17,6 +17,9 @@ interface Props {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const StyledHeader = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
gap: ${spacing.small};
|
|
22
|
+
align-items: center;
|
|
20
23
|
${mq.range({ from: breakpoints.tablet })} {
|
|
21
24
|
width: 1024px;
|
|
22
25
|
max-width: calc(100vw - 100px);
|
|
@@ -50,26 +53,6 @@ const StyledHeader = styled.div`
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
|
-
> button {
|
|
54
|
-
width: ${spacing.large};
|
|
55
|
-
height: 48px;
|
|
56
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
57
|
-
transform: translate(${spacing.large}, 0);
|
|
58
|
-
width: ${spacing.large};
|
|
59
|
-
height: 56px;
|
|
60
|
-
&:hover,
|
|
61
|
-
&:focus {
|
|
62
|
-
transform: translate(calc(${spacing.large} + 1px), 1px);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
${mq.range({ from: breakpoints.wide })} {
|
|
66
|
-
transform: translate(${spacing.large}, 0);
|
|
67
|
-
&:hover,
|
|
68
|
-
&:focus {
|
|
69
|
-
transform: translate(calc(${spacing.large} + 1px), 1px);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
56
|
`;
|
|
74
57
|
|
|
75
58
|
const modalStyles = css`
|
|
@@ -133,9 +116,9 @@ const MastheadSearchModal = ({
|
|
|
133
116
|
<div css={extraBackdrop} />
|
|
134
117
|
<StyledHeader>
|
|
135
118
|
{isFunction(children) ? children(closeModal) : children}
|
|
136
|
-
<
|
|
119
|
+
<IconButton aria-label={t('welcomePage.closeSearch')} variant="ghost" colorTheme="light" onClick={closeModal}>
|
|
137
120
|
<Cross className="c-icon--medium" />
|
|
138
|
-
</
|
|
121
|
+
</IconButton>
|
|
139
122
|
</StyledHeader>
|
|
140
123
|
</>
|
|
141
124
|
)}
|
|
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
|
|
5
5
|
import { colors, spacing, fonts, mq, breakpoints } from '@ndla/core';
|
|
6
|
-
import Button from '@ndla/button';
|
|
6
|
+
import { ButtonV2 as Button } from '@ndla/button';
|
|
7
7
|
import { OneColumn } from '..';
|
|
8
8
|
import VisualElement from './VisualElement';
|
|
9
9
|
|
|
@@ -67,7 +67,7 @@ const AboutNdlaFilm = ({ aboutNDLAVideo, moreAboutNdlaFilm }: Props) => {
|
|
|
67
67
|
<div>
|
|
68
68
|
<h1>{aboutNDLAVideo.title}</h1>
|
|
69
69
|
<p>{aboutNDLAVideo.description}</p>
|
|
70
|
-
<Modal size="fullscreen" activateButton={<Button link>{t('ndlaFilm.about.more')}</Button>}>
|
|
70
|
+
<Modal size="fullscreen" activateButton={<Button variant="link">{t('ndlaFilm.about.more')}</Button>}>
|
|
71
71
|
{(onClose) => (
|
|
72
72
|
<OneColumn cssModifier="medium">
|
|
73
73
|
<ModalHeader>
|
|
@@ -45,10 +45,11 @@ type Props = {
|
|
|
45
45
|
subHeading?: string;
|
|
46
46
|
children: ReactNode;
|
|
47
47
|
invertedStyle?: boolean;
|
|
48
|
+
headingId?: string;
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
export const NavigationHeading = ({ subHeading, children, invertedStyle }: Props) => (
|
|
51
|
-
<StyledH1 invertedStyle={invertedStyle}>
|
|
51
|
+
export const NavigationHeading = ({ subHeading, children, invertedStyle, headingId }: Props) => (
|
|
52
|
+
<StyledH1 invertedStyle={invertedStyle} id={headingId} tabIndex={-1}>
|
|
52
53
|
{subHeading && <StyledSubText>{subHeading}</StyledSubText>}
|
|
53
54
|
<StyledMainText>{children}</StyledMainText>
|
|
54
55
|
</StyledH1>
|
|
@@ -65,9 +65,18 @@ type Props = GradesProps & {
|
|
|
65
65
|
heading?: string;
|
|
66
66
|
image?: string;
|
|
67
67
|
messageBoxText?: string;
|
|
68
|
+
headingId?: string;
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
export const Programme = ({
|
|
71
|
+
export const Programme = ({
|
|
72
|
+
heading,
|
|
73
|
+
image,
|
|
74
|
+
grades,
|
|
75
|
+
selectedGrade,
|
|
76
|
+
onChangeGrade,
|
|
77
|
+
messageBoxText,
|
|
78
|
+
headingId,
|
|
79
|
+
}: Props) => {
|
|
71
80
|
const { t } = useTranslation();
|
|
72
81
|
return (
|
|
73
82
|
<StyledWrapper>
|
|
@@ -76,7 +85,7 @@ export const Programme = ({ heading, image, grades, selectedGrade, onChangeGrade
|
|
|
76
85
|
<StyledLayoutWrapper>
|
|
77
86
|
<LayoutItem layout="extend">
|
|
78
87
|
<StyledContentWrapper>
|
|
79
|
-
<NavigationHeading>{heading}</NavigationHeading>
|
|
88
|
+
<NavigationHeading headingId={headingId}>{heading}</NavigationHeading>
|
|
80
89
|
{messageBoxText && <MessageBox>{t(messageBoxText)}</MessageBox>}
|
|
81
90
|
<SubjectsWrapper>
|
|
82
91
|
<ProgrammeSubjects grades={grades} selectedGrade={selectedGrade} onChangeGrade={onChangeGrade} />
|
|
@@ -139,7 +139,12 @@ const SearchField = ({
|
|
|
139
139
|
{t('welcomePage.resetSearch')}
|
|
140
140
|
</button>
|
|
141
141
|
)}
|
|
142
|
-
<button
|
|
142
|
+
<button
|
|
143
|
+
tabIndex={-1}
|
|
144
|
+
{...classes('button', 'searchIcon')}
|
|
145
|
+
type="submit"
|
|
146
|
+
value="Search"
|
|
147
|
+
aria-label={t('siteNav.search')}>
|
|
143
148
|
<SearchIcon />
|
|
144
149
|
</button>
|
|
145
150
|
</div>
|
|
@@ -58,7 +58,7 @@ const StyledForm = styled.form<StyledProps>`
|
|
|
58
58
|
|
|
59
59
|
export const SearchFieldForm = ({ children, inputHasFocus, onSubmit }: Props) => {
|
|
60
60
|
return (
|
|
61
|
-
<StyledForm action="/search/" inputHasFocus={inputHasFocus} onSubmit={onSubmit}>
|
|
61
|
+
<StyledForm role="search" action="/search/" inputHasFocus={inputHasFocus} onSubmit={onSubmit}>
|
|
62
62
|
{children}
|
|
63
63
|
</StyledForm>
|
|
64
64
|
);
|
|
@@ -32,7 +32,7 @@ const StyledButton = styled(Button)<StyledButtonProps>`
|
|
|
32
32
|
color: ${(p) => (p.ndlaFilm ? '#fff' : colors.brand.primary)};
|
|
33
33
|
padding: ${spacing.small} ${spacingUnit * 0.75}px ${spacing.small} ${spacing.normal};
|
|
34
34
|
align-items: center;
|
|
35
|
-
margin-left: ${spacing.
|
|
35
|
+
margin-left: ${spacing.medium};
|
|
36
36
|
|
|
37
37
|
.c-icon {
|
|
38
38
|
height: 24px;
|
|
@@ -43,7 +43,7 @@ const StyledButton = styled(Button)<StyledButtonProps>`
|
|
|
43
43
|
|
|
44
44
|
${mq.range({ from: breakpoints.desktop })} {
|
|
45
45
|
display: ${(p) => (p.hideOnWideScreen ? 'none' : 'flex')};
|
|
46
|
-
margin-right: ${spacing.
|
|
46
|
+
margin-right: ${spacing.nsmall};
|
|
47
47
|
padding: ${spacing.small} ${spacing.normal};
|
|
48
48
|
}
|
|
49
49
|
&:hover,
|
|
@@ -254,7 +254,7 @@ const SuggestionInput = ({
|
|
|
254
254
|
ariaLabelActive={t('tagSelector.showAllTags')}
|
|
255
255
|
ariaLabelInActive={t('tagSelector.hideAllTags')}
|
|
256
256
|
active={expanded}
|
|
257
|
-
|
|
257
|
+
colorTheme="lighter"
|
|
258
258
|
inactiveIcon={<ChevronDown />}
|
|
259
259
|
activeIcon={<ChevronUp />}
|
|
260
260
|
size="small"
|
package/src/Topic/Topic.tsx
CHANGED
|
@@ -13,11 +13,13 @@ import React, { Fragment, useEffect, useState } from 'react';
|
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import BEMHelper from 'react-bem-helper';
|
|
15
15
|
import { debounce } from 'lodash';
|
|
16
|
+
import { spacing } from '@ndla/core';
|
|
17
|
+
import styled from '@emotion/styled';
|
|
16
18
|
|
|
17
19
|
import { Home, Back, Additional, ChevronRight } from '@ndla/icons/common';
|
|
18
20
|
import { Cross } from '@ndla/icons/action';
|
|
19
21
|
import { ModalHeader } from '@ndla/modal';
|
|
20
|
-
import Button from '@ndla/button';
|
|
22
|
+
import { ButtonV2 as Button } from '@ndla/button';
|
|
21
23
|
import SafeLink from '@ndla/safelink';
|
|
22
24
|
import Tooltip from '@ndla/tooltip';
|
|
23
25
|
import { useTranslation } from 'react-i18next';
|
|
@@ -35,6 +37,10 @@ const classes = new BEMHelper({
|
|
|
35
37
|
prefix: 'c-',
|
|
36
38
|
});
|
|
37
39
|
|
|
40
|
+
const StyledButton = styled(Button)`
|
|
41
|
+
padding: ${spacing.xsmall} ${spacing.small};
|
|
42
|
+
`;
|
|
43
|
+
|
|
38
44
|
export const renderAdditionalIcon = (isAdditional, label) => {
|
|
39
45
|
if (isAdditional && label) {
|
|
40
46
|
return (
|
|
@@ -192,40 +198,40 @@ export const TopicMenu = ({
|
|
|
192
198
|
<div {...classes('subject__header')}>
|
|
193
199
|
<div {...classes('subject__header__menu-filter')}>
|
|
194
200
|
{subjectTitle && (
|
|
195
|
-
<
|
|
201
|
+
<StyledButton
|
|
196
202
|
onClick={() => setSelectedMenu(MENU_CURRENT_SUBJECT)}
|
|
197
|
-
|
|
203
|
+
colorTheme={selectedMenu !== MENU_CURRENT_SUBJECT ? 'lighter' : 'primary'}
|
|
198
204
|
size="small"
|
|
199
|
-
|
|
205
|
+
shape="pill">
|
|
200
206
|
{subjectTitle}
|
|
201
|
-
</
|
|
207
|
+
</StyledButton>
|
|
202
208
|
)}
|
|
203
209
|
{currentProgramme && (
|
|
204
|
-
<
|
|
210
|
+
<StyledButton
|
|
205
211
|
onClick={() => setSelectedMenu(MENU_CURRENT_PROGRAMME)}
|
|
206
|
-
|
|
212
|
+
colorTheme={selectedMenu !== MENU_CURRENT_PROGRAMME ? 'lighter' : 'primary'}
|
|
207
213
|
size="small"
|
|
208
|
-
|
|
214
|
+
shape="pill">
|
|
209
215
|
{currentProgramme.name}
|
|
210
|
-
</
|
|
216
|
+
</StyledButton>
|
|
211
217
|
)}
|
|
212
218
|
{programmes && (
|
|
213
|
-
<
|
|
219
|
+
<StyledButton
|
|
214
220
|
onClick={() => setSelectedMenu(MENU_PROGRAMMES)}
|
|
215
|
-
|
|
221
|
+
colorTheme={selectedMenu !== MENU_PROGRAMMES ? 'lighter' : 'primary'}
|
|
216
222
|
size="small"
|
|
217
|
-
|
|
223
|
+
shape="pill">
|
|
218
224
|
{t('frontpageMenu.program')}
|
|
219
|
-
</
|
|
225
|
+
</StyledButton>
|
|
220
226
|
)}
|
|
221
227
|
{subjectCategories && (
|
|
222
|
-
<
|
|
228
|
+
<StyledButton
|
|
223
229
|
onClick={() => setSelectedMenu(MENU_ALL_SUBJECTS)}
|
|
224
|
-
|
|
230
|
+
colorTheme={selectedMenu !== MENU_ALL_SUBJECTS ? 'lighter' : 'primary'}
|
|
225
231
|
size="small"
|
|
226
|
-
|
|
232
|
+
shape="pill">
|
|
227
233
|
{t('frontpageMenu.allsubjects')}
|
|
228
|
-
</
|
|
234
|
+
</StyledButton>
|
|
229
235
|
)}
|
|
230
236
|
</div>
|
|
231
237
|
</div>
|
|
@@ -11,14 +11,13 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import { css } from '@emotion/core';
|
|
12
12
|
import { spacing, fonts, colors, mq, breakpoints } from '@ndla/core';
|
|
13
13
|
import { Menu } from '@ndla/icons/common';
|
|
14
|
-
import Button from '@ndla/button';
|
|
14
|
+
import { ButtonV2 as Button } from '@ndla/button';
|
|
15
15
|
|
|
16
16
|
const style = css`
|
|
17
|
+
display: block;
|
|
17
18
|
position: relative;
|
|
18
19
|
background: transparent;
|
|
19
|
-
padding: ${spacing.small};
|
|
20
|
-
padding-right: ${spacing.normal};
|
|
21
|
-
padding-left: ${spacing.normal};
|
|
20
|
+
padding: ${spacing.small} ${spacing.normal};
|
|
22
21
|
font-weight: ${fonts.weight.normal};
|
|
23
22
|
|
|
24
23
|
svg {
|
|
@@ -28,13 +27,13 @@ const style = css`
|
|
|
28
27
|
margin-right: ${spacing.xsmall};
|
|
29
28
|
}
|
|
30
29
|
&:hover {
|
|
31
|
-
border:
|
|
30
|
+
border-color: transparent;
|
|
32
31
|
background: ${colors.brand.primary};
|
|
33
32
|
color: ${colors.white};
|
|
34
33
|
}
|
|
35
34
|
&:active,
|
|
36
35
|
&:focus {
|
|
37
|
-
border:
|
|
36
|
+
border-color: ${colors.brand.lighter};
|
|
38
37
|
background: ${colors.white};
|
|
39
38
|
color: ${colors.brand.primary};
|
|
40
39
|
}
|
|
@@ -45,7 +44,7 @@ const style = css`
|
|
|
45
44
|
`;
|
|
46
45
|
|
|
47
46
|
const TopicMenuButton = ({ ndlaFilm, children, ...rest }) => (
|
|
48
|
-
<Button
|
|
47
|
+
<Button inverted={ndlaFilm} variant="outline" css={style} {...rest}>
|
|
49
48
|
<Menu /> {children}
|
|
50
49
|
</Button>
|
|
51
50
|
);
|
|
@@ -1040,7 +1040,7 @@ const messages = {
|
|
|
1040
1040
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1041
1041
|
welcome:
|
|
1042
1042
|
'Velkommen til Min NDLA! Nå kan du lagre dine favorittressurser fra NDLA og organisere dem slik du ønsker i mapper og med emneknagger.',
|
|
1043
|
-
read: { our: 'Les
|
|
1043
|
+
read: { our: 'Les vår', ours: 'Les våre' },
|
|
1044
1044
|
privacy: 'personvernerklæring her',
|
|
1045
1045
|
questions: { question: 'Lurer du på noe?', ask: 'Spør oss i chatten' },
|
|
1046
1046
|
wishToDelete: 'Vil du ikke ha brukerprofil hos oss lenger?',
|
|
@@ -1041,7 +1041,7 @@ const messages = {
|
|
|
1041
1041
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1042
1042
|
welcome:
|
|
1043
1043
|
'Velkommen til Min NDLA! Nå kan du lagre dine favorittressurser fra NDLA og organisere dem slik du ønsker i mapper og med tags.',
|
|
1044
|
-
read: { our: 'Les
|
|
1044
|
+
read: { our: 'Les vår', ours: 'Les våre' },
|
|
1045
1045
|
privacy: 'personvernerklæring her',
|
|
1046
1046
|
questions: { question: 'Lurer du på noko?', ask: 'Spør oss i chatten' },
|
|
1047
1047
|
wishToDelete: 'Vil du ikkje ha brukerprofil hos oss lenger?',
|
|
@@ -1040,7 +1040,7 @@ const messages = {
|
|
|
1040
1040
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1041
1041
|
welcome:
|
|
1042
1042
|
'Velkommen til Min NDLA! Nå kan du lagre dine favorittressurser fra NDLA og organisere dem slik du ønsker i mapper og med emneknagger.',
|
|
1043
|
-
read: { our: 'Les
|
|
1043
|
+
read: { our: 'Les vår', ours: 'Les våre' },
|
|
1044
1044
|
privacy: 'personvernerklæring her',
|
|
1045
1045
|
questions: { question: 'Lurer du på noe?', ask: 'Spør oss i chatten' },
|
|
1046
1046
|
wishToDelete: 'Vil du ikke ha brukerprofil hos oss lenger?',
|