@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.
Files changed (82) hide show
  1. package/es/Article/ArticleFavoritesButton.js +2 -1
  2. package/es/Frontpage/FrontpageHeader.js +7 -5
  3. package/es/Frontpage/FrontpageProgramMenu.js +12 -10
  4. package/es/Image/Image.js +5 -4
  5. package/es/LanguageSelector/LanguageSelector.js +31 -26
  6. package/es/Masthead/Masthead.js +8 -8
  7. package/es/Masthead/MastheadAuthModal.js +11 -11
  8. package/es/Masthead/MastheadSearchModal.js +9 -11
  9. package/es/NDLAFilm/AboutNdlaFilm.js +3 -3
  10. package/es/Navigation/NavigationHeading.js +9 -6
  11. package/es/Navigation/NavigationTopicAbout.js +15 -14
  12. package/es/Programme/Programme.js +10 -7
  13. package/es/Search/SearchField.js +4 -3
  14. package/es/Search/SearchFieldForm.js +4 -3
  15. package/es/Search/ToggleSearchButton.js +3 -3
  16. package/es/TagSelector/SuggestionInput.js +8 -8
  17. package/es/Topic/Topic.js +21 -20
  18. package/es/TopicMenu/TopicMenu.js +22 -13
  19. package/es/TopicMenu/TopicMenuButton.js +5 -5
  20. package/es/all.css +1 -1
  21. package/es/locale/messages-nb.js +2 -2
  22. package/es/locale/messages-nn.js +2 -2
  23. package/es/locale/messages-se.js +2 -2
  24. package/es/locale/messages-sma.js +2 -2
  25. package/lib/Article/ArticleFavoritesButton.js +2 -1
  26. package/lib/Frontpage/FrontpageHeader.js +7 -5
  27. package/lib/Frontpage/FrontpageProgramMenu.js +12 -10
  28. package/lib/Image/Image.d.ts +1 -1
  29. package/lib/Image/Image.js +5 -4
  30. package/lib/LanguageSelector/LanguageSelector.d.ts +1 -1
  31. package/lib/LanguageSelector/LanguageSelector.js +31 -26
  32. package/lib/Masthead/Masthead.js +8 -8
  33. package/lib/Masthead/MastheadAuthModal.js +11 -11
  34. package/lib/Masthead/MastheadSearchModal.js +9 -11
  35. package/lib/NDLAFilm/AboutNdlaFilm.js +4 -4
  36. package/lib/Navigation/NavigationHeading.d.ts +2 -1
  37. package/lib/Navigation/NavigationHeading.js +9 -6
  38. package/lib/Navigation/NavigationTopicAbout.js +15 -14
  39. package/lib/Programme/Programme.d.ts +2 -1
  40. package/lib/Programme/Programme.js +10 -7
  41. package/lib/Search/SearchField.js +4 -3
  42. package/lib/Search/SearchFieldForm.js +4 -3
  43. package/lib/Search/ToggleSearchButton.js +3 -3
  44. package/lib/TagSelector/SuggestionInput.js +8 -8
  45. package/lib/Topic/Topic.js +21 -20
  46. package/lib/TopicMenu/TopicMenu.js +47 -39
  47. package/lib/TopicMenu/TopicMenuButton.js +6 -6
  48. package/lib/all.css +1 -1
  49. package/lib/locale/messages-nb.js +2 -2
  50. package/lib/locale/messages-nn.js +2 -2
  51. package/lib/locale/messages-se.js +2 -2
  52. package/lib/locale/messages-sma.js +2 -2
  53. package/package.json +11 -11
  54. package/src/Article/ArticleFavoritesButton.tsx +2 -1
  55. package/src/Frontpage/FrontpageHeader.tsx +1 -1
  56. package/src/Frontpage/FrontpageProgramMenu.tsx +1 -1
  57. package/src/Image/Image.tsx +1 -1
  58. package/src/LanguageSelector/LanguageSelector.tsx +21 -23
  59. package/src/Masthead/Masthead.tsx +2 -0
  60. package/src/Masthead/MastheadAuthModal.tsx +16 -16
  61. package/src/Masthead/MastheadSearchModal.tsx +6 -23
  62. package/src/NDLAFilm/AboutNdlaFilm.tsx +2 -2
  63. package/src/Navigation/NavigationHeading.tsx +3 -2
  64. package/src/Navigation/NavigationTopicAbout.tsx +1 -0
  65. package/src/Programme/Programme.tsx +11 -2
  66. package/src/Search/SearchField.tsx +6 -1
  67. package/src/Search/SearchFieldForm.tsx +1 -1
  68. package/src/Search/ToggleSearchButton.tsx +2 -2
  69. package/src/TagSelector/SuggestionInput.tsx +1 -1
  70. package/src/Topic/Topic.tsx +1 -0
  71. package/src/TopicMenu/TopicMenu.jsx +23 -17
  72. package/src/TopicMenu/TopicMenuButton.jsx +6 -7
  73. package/src/locale/messages-nb.ts +1 -1
  74. package/src/locale/messages-nn.ts +1 -1
  75. package/src/locale/messages-se.ts +1 -1
  76. package/src/locale/messages-sma.ts +1 -1
  77. package/src/main.scss +0 -1
  78. package/es/Article/ArticleAuthorContent.js +0 -71
  79. package/lib/Article/ArticleAuthorContent.d.ts +0 -28
  80. package/lib/Article/ArticleAuthorContent.js +0 -88
  81. package/src/Article/ArticleAuthorContent.tsx +0 -107
  82. 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 våre',
1008
- ours: 'Les vår'
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 våre',
1008
- ours: 'Les vår'
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 våre',
1008
- ours: 'Les vår'
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 våre',
1008
- ours: 'Les vår'
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.1.0",
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.3.5",
36
- "@ndla/carousel": "^1.2.19",
35
+ "@ndla/button": "^3.4.0",
36
+ "@ndla/carousel": "^1.2.20",
37
37
  "@ndla/core": "^2.3.5",
38
- "@ndla/forms": "^3.1.8",
38
+ "@ndla/forms": "^3.1.9",
39
39
  "@ndla/hooks": "^1.1.5",
40
- "@ndla/icons": "^1.11.7",
41
- "@ndla/licenses": "^5.0.12",
42
- "@ndla/modal": "^1.3.3",
43
- "@ndla/notion": "^3.1.36",
44
- "@ndla/safelink": "^2.2.11",
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.18",
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": "baebd3de72d4161213f0592ce05bc771f99d52d7"
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
- ghostPill
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>
@@ -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 Button, { appearances } from '@ndla/button';
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
- const LanguageSelector = ({
120
- currentLanguage,
121
- outline,
122
- center,
123
- inverted,
124
- invertedOutlineLargeScreensOnly,
125
- alwaysVisible,
126
- }: Props) => {
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
- <Button
133
- ghostPillOutline={outline && !inverted}
134
- ghostPill={!outline && !inverted}
135
- ghostPillOutlineInverted={outline && inverted}
136
- ghostPillInverted={!outline && inverted}
137
- css={invertedOutlineLargeScreensOnly && styledInvertedOutlineLargeScreensOnly}
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
- </Button>
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, fonts, spacing } from '@ndla/core';
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
- font-weight: ${fonts.weight.semibold};
24
- display: flex;
25
- align-items: center;
26
- .feide-icon svg {
23
+ svg {
27
24
  margin-left: ${spacing.xsmall};
28
- fill: ${colors.brand.primary};
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
- .feide-icon svg {
35
- color: #000000;
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 inverted={inverted} ghostPill={!inverted} ghostPillInverted={inverted} aria-label="Feide">
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
- <span className="feide-icon">
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 Button from '@ndla/button';
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
- <Button stripped onClick={closeModal}>
119
+ <IconButton aria-label={t('welcomePage.closeSearch')} variant="ghost" colorTheme="light" onClick={closeModal}>
137
120
  <Cross className="c-icon--medium" />
138
- </Button>
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>
@@ -146,6 +146,7 @@ export const NavigationTopicAbout = ({
146
146
  {parse(renderMarkdown(introduction))}
147
147
  <StyledButtonWrapper invertedStyle={invertedStyle}>
148
148
  <Button
149
+ aria-expanded={!!showContent}
149
150
  link
150
151
  onClick={() => {
151
152
  onToggleShowContent();
@@ -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 = ({ heading, image, grades, selectedGrade, onChangeGrade, messageBoxText }: Props) => {
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 tabIndex={-1} {...classes('button', 'searchIcon')} type="submit" value="Search">
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.normal};
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.medium};
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
- greyLighter
257
+ colorTheme="lighter"
258
258
  inactiveIcon={<ChevronDown />}
259
259
  activeIcon={<ChevronUp />}
260
260
  size="small"
@@ -339,6 +339,7 @@ const Topic = ({
339
339
  {onToggleShowContent && (
340
340
  <StyledButtonWrapper invertedStyle={invertedStyle}>
341
341
  <Button
342
+ aria-expanded={!!showContent}
342
343
  link
343
344
  onClick={() => {
344
345
  onToggleShowContent();
@@ -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
- <Button
201
+ <StyledButton
196
202
  onClick={() => setSelectedMenu(MENU_CURRENT_SUBJECT)}
197
- lighter={selectedMenu !== MENU_CURRENT_SUBJECT}
203
+ colorTheme={selectedMenu !== MENU_CURRENT_SUBJECT ? 'lighter' : 'primary'}
198
204
  size="small"
199
- borderShape="rounded">
205
+ shape="pill">
200
206
  {subjectTitle}
201
- </Button>
207
+ </StyledButton>
202
208
  )}
203
209
  {currentProgramme && (
204
- <Button
210
+ <StyledButton
205
211
  onClick={() => setSelectedMenu(MENU_CURRENT_PROGRAMME)}
206
- lighter={selectedMenu !== MENU_CURRENT_PROGRAMME}
212
+ colorTheme={selectedMenu !== MENU_CURRENT_PROGRAMME ? 'lighter' : 'primary'}
207
213
  size="small"
208
- borderShape="rounded">
214
+ shape="pill">
209
215
  {currentProgramme.name}
210
- </Button>
216
+ </StyledButton>
211
217
  )}
212
218
  {programmes && (
213
- <Button
219
+ <StyledButton
214
220
  onClick={() => setSelectedMenu(MENU_PROGRAMMES)}
215
- lighter={selectedMenu !== MENU_PROGRAMMES}
221
+ colorTheme={selectedMenu !== MENU_PROGRAMMES ? 'lighter' : 'primary'}
216
222
  size="small"
217
- borderShape="rounded">
223
+ shape="pill">
218
224
  {t('frontpageMenu.program')}
219
- </Button>
225
+ </StyledButton>
220
226
  )}
221
227
  {subjectCategories && (
222
- <Button
228
+ <StyledButton
223
229
  onClick={() => setSelectedMenu(MENU_ALL_SUBJECTS)}
224
- lighter={selectedMenu !== MENU_ALL_SUBJECTS}
230
+ colorTheme={selectedMenu !== MENU_ALL_SUBJECTS ? 'lighter' : 'primary'}
225
231
  size="small"
226
- borderShape="rounded">
232
+ shape="pill">
227
233
  {t('frontpageMenu.allsubjects')}
228
- </Button>
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: 3px solid transparent;
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: 2px solid ${colors.brand.lighter};
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 invertedOutline={ndlaFilm} outline={!ndlaFilm} css={style} {...rest}>
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 våre', ours: 'Les vår' },
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 våre', ours: 'Les vår' },
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 våre', ours: 'Les vår' },
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?',