@ndla/ui 34.6.5 → 34.6.6

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 (70) hide show
  1. package/es/AudioPlayer/AudioPlayer.js +19 -19
  2. package/es/ErrorMessage/ErrorResourceAccessDenied.js +3 -3
  3. package/es/FactBox/FactBox.js +3 -3
  4. package/es/Figure/Figure.js +8 -10
  5. package/es/Filter/FilterButtons.js +20 -23
  6. package/es/Filter/FilterListPhone.js +7 -7
  7. package/es/Footer/FooterAuth.js +12 -11
  8. package/es/Frontpage/FrontpageProgramMenu.js +16 -16
  9. package/es/LearningPaths/LearningPathMenuModalWrapper.js +3 -3
  10. package/es/Navigation/NavigationTopicAbout.js +17 -17
  11. package/es/NoContentBox/NoContentBox.js +3 -3
  12. package/es/RelatedArticleList/RelatedArticleList.js +3 -3
  13. package/es/Search/ContentTypeResult.js +5 -4
  14. package/es/Search/ToggleSearchButton.js +4 -4
  15. package/es/SearchTypeResult/ActiveFilters.js +9 -10
  16. package/es/SearchTypeResult/PopupFilter.js +14 -14
  17. package/es/SearchTypeResult/ResultNavigation.js +9 -9
  18. package/es/SearchTypeResult/SearchHeader.js +11 -11
  19. package/es/SearchTypeResult/SearchNotionItem.js +18 -18
  20. package/es/SearchTypeResult/SearchTypeHeader.js +13 -13
  21. package/es/SearchTypeResult/SearchViewType.js +9 -8
  22. package/es/SearchTypeResult/components/SubjectFilters.js +5 -5
  23. package/es/User/AuthModal.js +9 -9
  24. package/lib/AudioPlayer/AudioPlayer.js +19 -19
  25. package/lib/ErrorMessage/ErrorResourceAccessDenied.js +3 -3
  26. package/lib/FactBox/FactBox.js +3 -3
  27. package/lib/Figure/Figure.js +8 -10
  28. package/lib/Filter/FilterButtons.js +20 -23
  29. package/lib/Filter/FilterListPhone.js +7 -7
  30. package/lib/Footer/FooterAuth.js +12 -11
  31. package/lib/Frontpage/FrontpageProgramMenu.js +16 -16
  32. package/lib/LearningPaths/LearningPathMenuModalWrapper.js +3 -3
  33. package/lib/Navigation/NavigationTopicAbout.js +17 -17
  34. package/lib/NoContentBox/NoContentBox.js +3 -3
  35. package/lib/RelatedArticleList/RelatedArticleList.js +3 -3
  36. package/lib/Search/ContentTypeResult.js +5 -4
  37. package/lib/Search/ToggleSearchButton.js +4 -4
  38. package/lib/SearchTypeResult/ActiveFilters.js +9 -10
  39. package/lib/SearchTypeResult/PopupFilter.js +14 -14
  40. package/lib/SearchTypeResult/ResultNavigation.js +9 -9
  41. package/lib/SearchTypeResult/SearchHeader.js +11 -11
  42. package/lib/SearchTypeResult/SearchNotionItem.js +18 -18
  43. package/lib/SearchTypeResult/SearchTypeHeader.js +13 -13
  44. package/lib/SearchTypeResult/SearchViewType.js +9 -8
  45. package/lib/SearchTypeResult/components/SubjectFilters.js +5 -5
  46. package/lib/User/AuthModal.js +9 -9
  47. package/package.json +2 -2
  48. package/src/AudioPlayer/AudioPlayer.tsx +9 -9
  49. package/src/ErrorMessage/ErrorResourceAccessDenied.tsx +3 -3
  50. package/src/FactBox/FactBox.tsx +3 -3
  51. package/src/Figure/Figure.tsx +7 -13
  52. package/src/Filter/FilterButtons.tsx +12 -14
  53. package/src/Filter/FilterListPhone.tsx +7 -7
  54. package/src/Footer/FooterAuth.tsx +4 -4
  55. package/src/Frontpage/FrontpageProgramMenu.tsx +13 -5
  56. package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +3 -3
  57. package/src/Navigation/NavigationTopicAbout.tsx +4 -4
  58. package/src/NoContentBox/NoContentBox.tsx +3 -3
  59. package/src/RelatedArticleList/RelatedArticleList.tsx +4 -4
  60. package/src/Search/ContentTypeResult.tsx +5 -4
  61. package/src/Search/ToggleSearchButton.tsx +2 -2
  62. package/src/SearchTypeResult/ActiveFilters.tsx +4 -5
  63. package/src/SearchTypeResult/PopupFilter.tsx +9 -9
  64. package/src/SearchTypeResult/ResultNavigation.tsx +5 -5
  65. package/src/SearchTypeResult/SearchHeader.tsx +3 -3
  66. package/src/SearchTypeResult/SearchNotionItem.tsx +5 -5
  67. package/src/SearchTypeResult/SearchTypeHeader.tsx +5 -5
  68. package/src/SearchTypeResult/SearchViewType.tsx +5 -4
  69. package/src/SearchTypeResult/components/SubjectFilters.tsx +3 -3
  70. package/src/User/AuthModal.tsx +3 -3
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import React from 'react';
10
- import Button from '@ndla/button';
10
+ import { ButtonV2 } from '@ndla/button';
11
11
 
12
12
  interface Props {
13
13
  onClick?: () => void;
@@ -21,9 +21,9 @@ export const NoContentBox = ({ buttonText, text, onClick }: Props) => (
21
21
  <div>
22
22
  <p>{text}</p>
23
23
  {onClick && (
24
- <Button outline onClick={onClick}>
24
+ <ButtonV2 variant="outline" onClick={onClick}>
25
25
  {buttonText}
26
- </Button>
26
+ </ButtonV2>
27
27
  )}
28
28
  </div>
29
29
  </span>
@@ -1,6 +1,6 @@
1
1
  import React, { Children, cloneElement, ReactElement } from 'react';
2
2
  import BEMHelper from 'react-bem-helper';
3
- import Button from '@ndla/button';
3
+ import { ButtonV2 } from '@ndla/button';
4
4
  import SafeLink from '@ndla/safelink';
5
5
  import SectionHeading from '../SectionHeading';
6
6
  import { HeadingLevel } from '../types';
@@ -79,13 +79,13 @@ const RelatedArticleList = ({ messages, children, articleCount, dangerouslySetIn
79
79
  {clonedChildren}
80
80
  </div>
81
81
  {childrenCount > 2 && (
82
- <Button
82
+ <ButtonV2
83
83
  data-type="related-article-button"
84
84
  data-showmore={messages.showMore}
85
85
  data-showless={messages.showLess}
86
- outline>
86
+ variant="outline">
87
87
  {messages.showMore}
88
- </Button>
88
+ </ButtonV2>
89
89
  )}
90
90
  </section>
91
91
  );
@@ -1,4 +1,4 @@
1
- import Button from '@ndla/button';
1
+ import { ButtonV2 } from '@ndla/button';
2
2
  import { Additional, ChevronDown, ChevronUp } from '@ndla/icons/common';
3
3
  import SafeLink from '@ndla/safelink';
4
4
  import Tooltip from '@ndla/tooltip';
@@ -150,15 +150,16 @@ const ContentTypeResult = ({
150
150
  })}
151
151
  {displayShowAllButton && (
152
152
  <StyledListItem ref={showAllRef}>
153
- <Button
154
- ghostPill
153
+ <ButtonV2
154
+ variant="ghost"
155
+ shape="pill"
155
156
  css={[showAllButtonStyle, shouldHighlightShowAllButton && noWidthhighlightStyle]}
156
157
  data-highlighted={shouldHighlightShowAllButton}
157
158
  onClick={() => toggleShowAll(!showAll)}
158
159
  tabIndex={-1}>
159
160
  {showAll ? messages.showLessResultLabel : messages.allResultLabel}
160
161
  {showAll ? <ChevronUp /> : <ChevronDown />}
161
- </Button>
162
+ </ButtonV2>
162
163
  </StyledListItem>
163
164
  )}
164
165
  </StyledList>
@@ -9,7 +9,7 @@
9
9
  import React from 'react';
10
10
  import { spacing, spacingUnit, breakpoints, mq, misc, fonts, colors } from '@ndla/core';
11
11
  import { Search } from '@ndla/icons/common';
12
- import Button, { ButtonProps } from '@ndla/button';
12
+ import { ButtonProps, ButtonV2 } from '@ndla/button';
13
13
  import styled from '@emotion/styled';
14
14
 
15
15
  interface Props extends ButtonProps {
@@ -24,7 +24,7 @@ interface StyledButtonProps {
24
24
  ndlaFilm?: boolean;
25
25
  }
26
26
 
27
- const StyledButton = styled(Button)<StyledButtonProps>`
27
+ const StyledButton = styled(ButtonV2)<StyledButtonProps>`
28
28
  background: ${(p) => (p.ndlaFilm ? colors.ndlaFilm.filmColorBright : colors.brand.greyLighter)};
29
29
  border-radius: ${misc.borderRadius};
30
30
  border: 0;
@@ -12,7 +12,7 @@ import styled from '@emotion/styled';
12
12
  import { css } from '@emotion/react';
13
13
  import { spacing, mq, breakpoints } from '@ndla/core';
14
14
  import Tooltip from '@ndla/tooltip';
15
- import Button from '@ndla/button';
15
+ import { ButtonV2 } from '@ndla/button';
16
16
  import ActiveFilterContent, { FilterProps, StyledActiveFilterTitle } from './ActiveFilterContent';
17
17
 
18
18
  type StyledActiveFiltersProps = {
@@ -138,20 +138,19 @@ const ActiveFilters = ({
138
138
  {filterLength > showFilterCount && (
139
139
  <StyledActiveFilterWrapper>
140
140
  <Tooltip tooltip={t('searchPage.searchFilterMessages.noValuesButtonText')}>
141
- <Button
141
+ <ButtonV2
142
142
  aria-label={t('searchPage.searchFilterMessages.additionalSubjectFilters', {
143
143
  count: filterLength - showFilterCount + 1,
144
144
  })}
145
- type="button"
146
145
  size="normal"
147
- borderShape="rounded"
146
+ shape="pill"
148
147
  onClick={onClickShowHiddenSubjects}>
149
148
  <StyledActiveFilterTitle>
150
149
  {t('searchPage.searchFilterMessages.additionalSubjectFilters', {
151
150
  count: filterLength - showFilterCount + 1,
152
151
  })}
153
152
  </StyledActiveFilterTitle>
154
- </Button>
153
+ </ButtonV2>
155
154
  </Tooltip>
156
155
  </StyledActiveFilterWrapper>
157
156
  )}
@@ -10,7 +10,7 @@ import React, { useState } from 'react';
10
10
  import styled from '@emotion/styled';
11
11
  import Modal, { ModalCloseButton, ModalBody } from '@ndla/modal';
12
12
  import { breakpoints, fonts, mq, spacing } from '@ndla/core';
13
- import Button from '@ndla/button';
13
+ import { ButtonV2 } from '@ndla/button';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { ToggleItem } from '../Filter';
16
16
 
@@ -113,23 +113,23 @@ const PopupFilter = ({
113
113
  </ModalHeaderWrapper>
114
114
  {subjectCategories && programmes && (
115
115
  <MainFilterButtonWrapper>
116
- <Button
116
+ <ButtonV2
117
117
  onClick={() => setSelectedMenu(MENU_ALL_SUBJECTS)}
118
- lighter={selectedMenu !== MENU_ALL_SUBJECTS}
118
+ colorTheme={selectedMenu !== MENU_ALL_SUBJECTS ? 'lighter' : undefined}
119
119
  size="normal"
120
- borderShape="rounded">
120
+ shape="pill">
121
121
  {t('frontpageMenu.allsubjects')}
122
- </Button>
122
+ </ButtonV2>
123
123
  </MainFilterButtonWrapper>
124
124
  )}
125
125
  {programmes && (
126
- <Button
126
+ <ButtonV2
127
127
  onClick={() => setSelectedMenu(MENU_PROGRAMMES)}
128
- lighter={selectedMenu !== MENU_PROGRAMMES}
128
+ colorTheme={selectedMenu !== MENU_PROGRAMMES ? 'lighter' : undefined}
129
129
  size="normal"
130
- borderShape="rounded">
130
+ shape="pill">
131
131
  {t('frontpageMenu.program')}
132
- </Button>
132
+ </ButtonV2>
133
133
  )}
134
134
  {selectedMenu === MENU_ALL_SUBJECTS && subjectCategories && (
135
135
  <FrontpageAllSubjects
@@ -8,7 +8,7 @@
8
8
 
9
9
  import React from 'react';
10
10
  import styled from '@emotion/styled';
11
- import Button from '@ndla/button';
11
+ import { ButtonV2 } from '@ndla/button';
12
12
  import { fonts, spacing, colors } from '@ndla/core';
13
13
  import { useTranslation } from 'react-i18next';
14
14
 
@@ -91,13 +91,13 @@ const ResultNavigation = ({ onShowMore, totalCount, toCount, contentType = '', t
91
91
  <Progress width={progress} />
92
92
  </ProgressBar>
93
93
  {isMore ? (
94
- <Button className="nav" outline onClick={onShowMore} aria-describedby={`searchitem-header-${type}`}>
94
+ <ButtonV2 className="nav" variant="outline" onClick={onShowMore} aria-describedby={`searchitem-header-${type}`}>
95
95
  {t('searchPage.resultType.showMore')}
96
- </Button>
96
+ </ButtonV2>
97
97
  ) : (
98
- <Button className="nav" outline onClick={onToTopHandler}>
98
+ <ButtonV2 className="nav" variant="outline" onClick={onToTopHandler}>
99
99
  {t('searchPage.resultType.toTopOfPage')}
100
- </Button>
100
+ </ButtonV2>
101
101
  )}
102
102
  </ResultNav>
103
103
  );
@@ -9,7 +9,7 @@ import React, { FormEvent, useEffect, useState } from 'react';
9
9
  import { useTranslation } from 'react-i18next';
10
10
  import styled from '@emotion/styled';
11
11
  import { breakpoints, fonts, mq, spacing } from '@ndla/core';
12
- import Button from '@ndla/button';
12
+ import { ButtonV2 } from '@ndla/button';
13
13
 
14
14
  import SearchFieldHeader from './SearchFieldHeader';
15
15
  import { CompetenceGoalsItemType } from '../types';
@@ -131,9 +131,9 @@ const SearchHeader = ({
131
131
  {searchPhraseSuggestion && (
132
132
  <PhraseSuggestionText>
133
133
  {t('searchPage.resultType.searchPhraseSuggestion')}{' '}
134
- <Button link onClick={searchPhraseSuggestionOnClick}>
134
+ <ButtonV2 variant="link" onClick={searchPhraseSuggestionOnClick}>
135
135
  [{searchPhraseSuggestion}]
136
- </Button>
136
+ </ButtonV2>
137
137
  </PhraseSuggestionText>
138
138
  )}
139
139
  {!!competenceGoals?.length && (
@@ -12,7 +12,7 @@ import parse from 'html-react-parser';
12
12
 
13
13
  import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
14
14
  import { getLicenseByAbbreviation } from '@ndla/licenses';
15
- import Button from '@ndla/button';
15
+ import { ButtonV2 } from '@ndla/button';
16
16
  import { Play } from '@ndla/icons/common';
17
17
  import { ArrowExpand } from '@ndla/icons/editor';
18
18
  import Modal, { ModalCloseButton, ModalHeader, ModalBody } from '@ndla/modal';
@@ -147,13 +147,13 @@ const SearchNotionItem = ({
147
147
  <ShowMediaButtonWrapper>
148
148
  <Modal
149
149
  activateButton={
150
- <Button lighter size="xsmall" borderShape="rounded">
150
+ <ButtonV2 colorTheme="lighter" size="xsmall" shape="pill">
151
151
  <>
152
152
  {type === 'video' && <Play />}
153
153
  {type === 'other' && <ArrowExpand />}
154
154
  <ShowMediaButtonText>{t('searchPage.resultType.showVideo')}</ShowMediaButtonText>
155
155
  </>
156
- </Button>
156
+ </ButtonV2>
157
157
  }
158
158
  animation="subtle"
159
159
  animationDuration={50}
@@ -193,9 +193,9 @@ const SearchNotionItem = ({
193
193
  {authors.length > 0 && license && ' '}
194
194
  {license && `(${getLicenseByAbbreviation(license, locale).abbreviation})`}
195
195
  {onReferenceClick && (
196
- <Button link onClick={onReferenceClick}>
196
+ <ButtonV2 variant="link" onClick={onReferenceClick}>
197
197
  {t('article.cite')}
198
- </Button>
198
+ </ButtonV2>
199
199
  )}
200
200
  </p>
201
201
  }
@@ -8,7 +8,7 @@
8
8
 
9
9
  import React, { MouseEvent, memo } from 'react';
10
10
  import styled from '@emotion/styled';
11
- import Button from '@ndla/button';
11
+ import { ButtonV2 } from '@ndla/button';
12
12
  import { breakpoints, fonts, mq, spacing } from '@ndla/core';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { Cross } from '@ndla/icons/action';
@@ -111,11 +111,11 @@ const SearchTypeHeader = ({ filters = [], onFilterClick, totalCount, type }: Pro
111
111
  <CategoryItems>
112
112
  {filters.map((option: FilterOptionsType) => (
113
113
  <CategoryTypeButtonWrapper key={option.id}>
114
- <Button
114
+ <ButtonV2
115
115
  aria-current={option.active}
116
116
  size="xsmall"
117
- borderShape="rounded"
118
- greyLighter={!option.active}
117
+ shape="pill"
118
+ colorTheme={!option.active ? 'greyLighter' : undefined}
119
119
  onClick={(e: MouseEvent<HTMLButtonElement>) => {
120
120
  if (e.currentTarget && option.active) {
121
121
  e.currentTarget.blur();
@@ -128,7 +128,7 @@ const SearchTypeHeader = ({ filters = [], onFilterClick, totalCount, type }: Pro
128
128
  <Cross />
129
129
  </CategoryTypeCrossWrapper>
130
130
  )}
131
- </Button>
131
+ </ButtonV2>
132
132
  </CategoryTypeButtonWrapper>
133
133
  ))}
134
134
  </CategoryItems>
@@ -8,7 +8,7 @@
8
8
 
9
9
  import React from 'react';
10
10
  import styled from '@emotion/styled';
11
- import Button from '@ndla/button';
11
+ import { ButtonV2 } from '@ndla/button';
12
12
  import { Grid } from '@ndla/icons/common';
13
13
  import { ListCircle } from '@ndla/icons/editor';
14
14
  import { animations, breakpoints, colors, mq } from '@ndla/core';
@@ -32,7 +32,7 @@ const ButtonContainer = styled.div`
32
32
  width: 44px;
33
33
  height: 44px;
34
34
  `;
35
- const ButtonElement = styled(Button)`
35
+ const ButtonElement = styled(ButtonV2)`
36
36
  border-radius: 50%;
37
37
  padding: 2px;
38
38
  width: 100%;
@@ -81,7 +81,8 @@ const SearchViewType = ({ viewType, onChangeViewType }: SearchViewTypeProps) =>
81
81
  <Wrapper>
82
82
  <ButtonContainer>
83
83
  <ButtonElement
84
- stripped
84
+ variant="stripped"
85
+ colorTheme="greyLighter"
85
86
  type="button"
86
87
  size="normal"
87
88
  title={t('searchPage.resultType.gridView')}
@@ -93,7 +94,7 @@ const SearchViewType = ({ viewType, onChangeViewType }: SearchViewTypeProps) =>
93
94
  </ButtonContainer>
94
95
  <ButtonContainer>
95
96
  <ButtonElement
96
- stripped
97
+ variant="stripped"
97
98
  size="normal"
98
99
  title={t('searchPage.resultType.listView')}
99
100
  onClick={() => onClickHandler('list')}>
@@ -9,7 +9,7 @@
9
9
  import React, { useEffect, useRef, useState } from 'react';
10
10
  import { useTranslation } from 'react-i18next';
11
11
  import styled from '@emotion/styled';
12
- import Button from '@ndla/button';
12
+ import { ButtonV2 } from '@ndla/button';
13
13
  import { Plus as PlusIcon } from '@ndla/icons/action';
14
14
 
15
15
  import PopupFilter, { PopupFilterProps } from '../PopupFilter';
@@ -106,10 +106,10 @@ const SubjectFilters = ({ filters, activeFilters, isNarrowScreen }: SubjectFilte
106
106
  };
107
107
 
108
108
  const OpenModalButton = () => (
109
- <Button type="button" size="normal" greyLighter borderShape="rounded" onClick={handlePopupOpen}>
109
+ <ButtonV2 type="button" size="normal" colorTheme="greyLighter" shape="pill" onClick={handlePopupOpen}>
110
110
  <FilterButtonText>{t('searchPage.searchFilterMessages.noValuesButtonText')}</FilterButtonText>
111
111
  <PlusIcon />
112
- </Button>
112
+ </ButtonV2>
113
113
  );
114
114
 
115
115
  const ActiveFiltersElement = ({ showModalButton }: { showModalButton?: boolean }) => {
@@ -10,7 +10,7 @@ import React, { ReactElement, ReactNode } from 'react';
10
10
  import styled from '@emotion/styled';
11
11
  import { useTranslation } from 'react-i18next';
12
12
  import Modal, { ModalCloseButton } from '@ndla/modal';
13
- import Button from '@ndla/button';
13
+ import { ButtonV2 } from '@ndla/button';
14
14
  import { FeideText, LogIn, LogOut, HumanMaleBoard } from '@ndla/icons/common';
15
15
  import { fonts, spacing } from '@ndla/core';
16
16
  import { UserInfo } from './UserInfo';
@@ -105,12 +105,12 @@ const AuthModal = ({
105
105
  </p>
106
106
  )}
107
107
  <StyledButtonWrapper>
108
- <Button size="medium" onClick={onAuthenticateClick}>
108
+ <ButtonV2 size="medium" onClick={onAuthenticateClick}>
109
109
  {isAuthenticated ? t('user.buttonLogOut') : t('user.buttonLogIn')}
110
110
  <StyledLogInIconWrapper aria-hidden>
111
111
  {isAuthenticated ? <LogOut className="c-icon--medium" /> : <LogIn className="c-icon--medium" />}
112
112
  </StyledLogInIconWrapper>
113
- </Button>
113
+ </ButtonV2>
114
114
  </StyledButtonWrapper>
115
115
  </StyledModalContent>
116
116
  </StyledModalBody>