@ndla/ui 22.2.0 → 24.0.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 (166) hide show
  1. package/es/Animation/DisplayOnPageYOffset.js +1 -1
  2. package/es/Article/Article.js +3 -3
  3. package/es/Article/ArticleAuthorContent.js +2 -4
  4. package/es/Article/ArticleByline.js +5 -6
  5. package/es/AuthorInfo/AuthorInfo.js +29 -16
  6. package/es/Breadcrumb/ActionBreadcrumb.js +3 -3
  7. package/es/ContentCard/ContentCard.js +66 -25
  8. package/es/Figure/FigureOpenDialogButton.js +1 -2
  9. package/es/FileList/File.js +34 -8
  10. package/es/FileList/FileList.js +29 -3
  11. package/es/Filter/FilterListPhone.js +1 -1
  12. package/es/Frontpage/FrontpageProgramMenu.js +10 -11
  13. package/es/InfoBox/InfoBox.js +10 -3
  14. package/es/InfoWidget/InfoWidget.js +67 -22
  15. package/es/NDLAFilm/AllMoviesAlphabetically.js +12 -12
  16. package/es/Portrait/Portrait.js +19 -13
  17. package/es/ResourceBox/ResourceBox.js +7 -35
  18. package/es/ResourceGroup/ResourceItem.js +13 -13
  19. package/es/ResourceGroup/ResourceList.js +3 -3
  20. package/es/Search/ActiveFilterContent.js +4 -14
  21. package/es/Search/ActiveFilters.js +20 -31
  22. package/es/Search/SearchField.js +31 -52
  23. package/es/Search/SearchResult.js +113 -136
  24. package/es/Search/ToggleSearchButton.js +34 -43
  25. package/es/Search/index.js +2 -8
  26. package/es/SearchTypeResult/ActiveFilters.js +18 -18
  27. package/es/SearchTypeResult/SearchFieldHeader.js +5 -6
  28. package/es/TopicMenu/TopicMenu.js +1 -1
  29. package/es/all.css +1 -1
  30. package/es/index-javascript.js +0 -1
  31. package/es/index.js +2 -1
  32. package/es/locale/messages-en.js +2 -0
  33. package/es/locale/messages-nb.js +2 -0
  34. package/es/locale/messages-nn.js +2 -0
  35. package/es/locale/messages-se.js +2 -0
  36. package/es/locale/messages-sma.js +2 -0
  37. package/lib/Animation/DisplayOnPageYOffset.js +2 -2
  38. package/lib/Article/Article.js +4 -4
  39. package/lib/Article/ArticleAuthorContent.js +9 -4
  40. package/lib/Article/ArticleByline.js +4 -4
  41. package/lib/AuthorInfo/AuthorInfo.d.ts +1 -11
  42. package/lib/AuthorInfo/AuthorInfo.js +36 -20
  43. package/lib/Breadcrumb/ActionBreadcrumb.js +3 -3
  44. package/lib/ContentCard/ContentCard.d.ts +1 -15
  45. package/lib/ContentCard/ContentCard.js +60 -28
  46. package/lib/FileList/File.js +36 -12
  47. package/lib/FileList/FileList.js +28 -5
  48. package/lib/Filter/FilterListPhone.js +2 -2
  49. package/lib/Frontpage/FrontpageProgramMenu.js +9 -9
  50. package/lib/InfoBox/InfoBox.js +11 -4
  51. package/lib/InfoWidget/InfoWidget.js +61 -25
  52. package/lib/NDLAFilm/AllMoviesAlphabetically.js +13 -13
  53. package/lib/Portrait/Portrait.js +19 -14
  54. package/lib/ResourceBox/ResourceBox.d.ts +1 -4
  55. package/lib/ResourceBox/ResourceBox.js +15 -35
  56. package/lib/ResourceGroup/ResourceItem.js +12 -14
  57. package/lib/ResourceGroup/ResourceList.js +2 -4
  58. package/lib/Search/ActiveFilterContent.d.ts +13 -0
  59. package/lib/Search/ActiveFilterContent.js +4 -15
  60. package/lib/Search/ActiveFilters.d.ts +13 -0
  61. package/lib/Search/ActiveFilters.js +31 -45
  62. package/lib/Search/SearchField.d.ts +19 -0
  63. package/lib/Search/SearchField.js +32 -56
  64. package/lib/Search/SearchResult.d.ts +36 -0
  65. package/lib/Search/SearchResult.js +116 -159
  66. package/lib/Search/ToggleSearchButton.d.ts +16 -0
  67. package/lib/Search/ToggleSearchButton.js +36 -46
  68. package/lib/Search/index.d.ts +12 -0
  69. package/lib/Search/index.js +0 -54
  70. package/lib/SearchTypeResult/ActiveFilters.js +37 -39
  71. package/lib/SearchTypeResult/SearchFieldHeader.js +6 -6
  72. package/lib/SearchTypeResult/SearchTypeHeader.d.ts +1 -1
  73. package/lib/TopicMenu/TopicMenu.js +2 -2
  74. package/lib/all.css +1 -1
  75. package/lib/index-javascript.js +0 -74
  76. package/lib/index.d.ts +1 -0
  77. package/lib/index.js +38 -1
  78. package/lib/locale/messages-en.d.ts +2 -0
  79. package/lib/locale/messages-en.js +2 -0
  80. package/lib/locale/messages-nb.d.ts +2 -0
  81. package/lib/locale/messages-nb.js +2 -0
  82. package/lib/locale/messages-nn.d.ts +2 -0
  83. package/lib/locale/messages-nn.js +2 -0
  84. package/lib/locale/messages-se.d.ts +2 -0
  85. package/lib/locale/messages-se.js +2 -0
  86. package/lib/locale/messages-sma.d.ts +2 -0
  87. package/lib/locale/messages-sma.js +2 -0
  88. package/package.json +17 -16
  89. package/src/Animation/DisplayOnPageYOffset.tsx +1 -1
  90. package/src/Article/Article.tsx +1 -1
  91. package/src/Article/ArticleAuthorContent.tsx +1 -1
  92. package/src/Article/ArticleByline.tsx +1 -2
  93. package/src/AuthorInfo/AuthorInfo.tsx +53 -19
  94. package/src/Breadcrumb/ActionBreadcrumb.tsx +1 -2
  95. package/src/ContentCard/ContentCard.tsx +127 -35
  96. package/src/Figure/FigureOpenDialogButton.tsx +1 -2
  97. package/src/FileList/File.tsx +47 -17
  98. package/src/FileList/FileList.tsx +37 -8
  99. package/src/Filter/FilterListPhone.jsx +1 -1
  100. package/src/Frontpage/FrontpageProgramMenu.tsx +1 -2
  101. package/src/InfoBox/InfoBox.tsx +24 -4
  102. package/src/InfoWidget/InfoWidget.tsx +83 -34
  103. package/src/NDLAFilm/AllMoviesAlphabetically.tsx +1 -1
  104. package/src/Portrait/Portrait.tsx +25 -10
  105. package/src/ResourceBox/ResourceBox.tsx +1 -20
  106. package/src/ResourceGroup/ResourceItem.tsx +1 -1
  107. package/src/ResourceGroup/ResourceList.tsx +1 -1
  108. package/src/Search/{ActiveFilterContent.jsx → ActiveFilterContent.tsx} +11 -12
  109. package/src/Search/{ActiveFilters.jsx → ActiveFilters.tsx} +21 -18
  110. package/src/Search/{SearchField.jsx → SearchField.tsx} +58 -68
  111. package/src/Search/SearchResult.tsx +360 -0
  112. package/src/Search/ToggleSearchButton.tsx +73 -0
  113. package/src/Search/component.search.scss +0 -4
  114. package/src/Search/index.ts +16 -0
  115. package/src/SearchTypeResult/ActiveFilters.tsx +1 -1
  116. package/src/SearchTypeResult/SearchFieldHeader.tsx +1 -2
  117. package/src/TopicMenu/TopicMenu.jsx +1 -1
  118. package/src/all.scss +0 -1
  119. package/src/index-javascript.js +0 -15
  120. package/src/index.ts +2 -0
  121. package/src/locale/messages-en.ts +2 -0
  122. package/src/locale/messages-nb.ts +2 -0
  123. package/src/locale/messages-nn.ts +2 -0
  124. package/src/locale/messages-se.ts +2 -0
  125. package/src/locale/messages-sma.ts +2 -0
  126. package/src/main.scss +0 -7
  127. package/es/BackgroundImage/BackgroundImage.js +0 -27
  128. package/es/BackgroundImage/index.js +0 -2
  129. package/es/Search/SearchFilter.js +0 -72
  130. package/es/Search/SearchFilterList.js +0 -115
  131. package/es/Search/SearchOverlay.js +0 -39
  132. package/es/Search/SearchPage.js +0 -178
  133. package/es/Search/SearchPopoverFilter.js +0 -152
  134. package/es/Search/SearchResultAuthor.js +0 -51
  135. package/lib/BackgroundImage/BackgroundImage.d.ts +0 -12
  136. package/lib/BackgroundImage/BackgroundImage.js +0 -40
  137. package/lib/BackgroundImage/index.d.ts +0 -2
  138. package/lib/BackgroundImage/index.js +0 -13
  139. package/lib/Search/SearchFilter.js +0 -88
  140. package/lib/Search/SearchFilterList.js +0 -137
  141. package/lib/Search/SearchOverlay.js +0 -62
  142. package/lib/Search/SearchPage.js +0 -207
  143. package/lib/Search/SearchPopoverFilter.js +0 -172
  144. package/lib/Search/SearchResultAuthor.js +0 -60
  145. package/src/AuthorInfo/component.author-info.scss +0 -54
  146. package/src/BackgroundImage/BackgroundImage.tsx +0 -32
  147. package/src/BackgroundImage/component.background-image.scss +0 -52
  148. package/src/BackgroundImage/index.ts +0 -3
  149. package/src/ContentCard/component.content-card.scss +0 -109
  150. package/src/FileList/component.file-list.scss +0 -102
  151. package/src/InfoBox/component.info-box.scss +0 -21
  152. package/src/InfoWidget/component.info-widget.scss +0 -52
  153. package/src/Portrait/component.portrait.scss +0 -29
  154. package/src/Search/SearchFilter.jsx +0 -82
  155. package/src/Search/SearchFilterList.jsx +0 -110
  156. package/src/Search/SearchOverlay.jsx +0 -38
  157. package/src/Search/SearchPage.jsx +0 -178
  158. package/src/Search/SearchPopoverFilter.jsx +0 -109
  159. package/src/Search/SearchResult.jsx +0 -239
  160. package/src/Search/SearchResultAuthor.jsx +0 -54
  161. package/src/Search/ToggleSearchButton.jsx +0 -64
  162. package/src/Search/component.search-filter.scss +0 -67
  163. package/src/Search/component.search-overlay.scss +0 -103
  164. package/src/Search/component.search-page.scss +0 -125
  165. package/src/Search/component.search-result-author.scss +0 -65
  166. package/src/Search/index.js +0 -34
@@ -1,109 +0,0 @@
1
- .c-content-card {
2
- position: relative;
3
- display: block;
4
- width: 100%;
5
-
6
- &__image-wrapper {
7
- width: 100%;
8
- height: 72px;
9
- border-radius: 5px;
10
- position: relative;
11
- overflow: hidden;
12
- background: $background-color--gray-dark;
13
-
14
- @include mq(tablet) {
15
- height: $spacing--large * 2.5;
16
- }
17
- }
18
-
19
- &__link {
20
- color: $primary-color;
21
- &:hover,
22
- &:focus {
23
- .c-content-card__heading {
24
- text-decoration: underline;
25
- }
26
- }
27
- }
28
-
29
- &__type {
30
- @include inuit-font-size(12px, 20px);
31
- position: absolute;
32
- left: $spacing--small;
33
- bottom: $spacing--small;
34
- display: inline-block;
35
- background: $brand-grey--lightest;
36
- border-radius: 2px;
37
- font-weight: 600;
38
- margin: 0;
39
- padding: 0 $spacing--small/3;
40
-
41
- display: none;
42
-
43
- @include mq(tablet) {
44
- display: inline-block;
45
- }
46
- }
47
-
48
- &__heading {
49
- font-weight: $font-weight-semibold;
50
- @include font-size(14px, 16px);
51
- margin: $spacing--small / 2 0;
52
- color: $brand-color;
53
-
54
- @include mq(tablet) {
55
- margin: $spacing--small 0 $spacing--small / 2;
56
- @include font-size(20px, 22px);
57
- }
58
- }
59
-
60
- &__description {
61
- @include inuit-font-size(16px);
62
- line-height: 1.25rem;
63
- // font-family: $font-serif;
64
- margin: 0;
65
- display: none;
66
-
67
- @include mq(tablet) {
68
- display: block;
69
- }
70
- }
71
-
72
- &__play-background {
73
- position: absolute;
74
- left: 50%;
75
- top: 50%;
76
- transform: translate3d(-50%, -50%, 0);
77
- height: 35px;
78
- width: 35px;
79
- background-color: rgba(0, 0, 0, 0.48);
80
- border-radius: 100%;
81
- display: flex;
82
- align-items: center;
83
- justify-content: center;
84
-
85
- @include mq(tablet) {
86
- height: 42px;
87
- width: 42px;
88
- }
89
-
90
- .c-icon {
91
- color: $white;
92
- height: 20px;
93
- width: 20px;
94
- margin-right: -1px;
95
-
96
- @include mq(tablet) {
97
- height: 25px;
98
- width: 25px;
99
- }
100
- }
101
- }
102
- &__background-image {
103
- display: flex;
104
- height: 100%;
105
- width: 100%;
106
- background-position: center center;
107
- background-size: cover;
108
- }
109
- }
@@ -1,102 +0,0 @@
1
- .c-file-list {
2
- margin: $spacing--large 0;
3
- padding: $spacing--small 0 $spacing $spacing;
4
- border-left: 2px solid $brand-grey--lightest;
5
- font-family: $font;
6
-
7
- &__heading {
8
- @include font-size(16px, 18px);
9
- letter-spacing: 0.05em;
10
- margin: 0 0 $spacing--small / 2 0;
11
- padding-bottom: $spacing--small / 2;
12
-
13
- border-bottom: 2px solid $brand-grey--light;
14
- font-weight: $font-weight-bold;
15
- text-transform: uppercase;
16
- }
17
-
18
- &__files {
19
- margin: 0;
20
- padding: 0;
21
- }
22
-
23
- &__item {
24
- @include font-size(18px, 26px);
25
- font-weight: $font-weight-semibold;
26
- min-height: 60px;
27
- background: $brand-grey--lighter;
28
- display: flex;
29
- align-items: center;
30
- flex-wrap: wrap;
31
- margin-bottom: $spacing--small / 2;
32
- padding: $spacing--small;
33
-
34
- @include mq(tablet) {
35
- padding: $spacing--small $spacing;
36
- }
37
- }
38
-
39
- &__link {
40
- box-shadow: none;
41
- position: relative;
42
- color: $brand-color;
43
- margin-right: $spacing;
44
- display: flex;
45
- align-items: center;
46
-
47
- &:last-child {
48
- margin-right: 0;
49
- }
50
-
51
- &:hover,
52
- &:focus,
53
- &:active {
54
- .c-file-list__link-text {
55
- & > span {
56
- box-shadow: $link--hover;
57
- }
58
- }
59
- }
60
- }
61
-
62
- &__link-text {
63
- & > span {
64
- box-shadow: $link;
65
- }
66
- }
67
-
68
- &__tooltip {
69
- position: absolute;
70
- display: none;
71
- left: 50%;
72
- top: -$spacing--small;
73
- transform: translate3d(-50%, -100%, 0);
74
- width: 300px;
75
- text-align: center;
76
- z-index: 1;
77
-
78
- &[aria-hidden='false'] {
79
- display: block;
80
- animation-name: fadeIn;
81
- animation-duration: 0.3s;
82
- }
83
- }
84
-
85
- &__tooltip-text {
86
- display: inline-block;
87
- text-align: left;
88
- background: $brand-color;
89
- padding: $spacing--small;
90
- @include font-size(14px, 18px);
91
- font-weight: $font-weight-normal;
92
- color: $white;
93
- }
94
-
95
- .c-icon {
96
- margin-top: 3px;
97
- flex-shrink: 0;
98
- margin-right: $spacing--small;
99
- height: 18px;
100
- width: 18px;
101
- }
102
- }
@@ -1,21 +0,0 @@
1
- .c-info-box {
2
- background: $yellow-light;
3
- padding: $spacing--small $spacing;
4
- font-family: $font;
5
- @include font-size(14px, 18px);
6
-
7
- margin-bottom: $spacing--medium;
8
-
9
- @include mq(tablet) {
10
- @include font-size(16px, 20px);
11
- padding: $spacing;
12
- }
13
-
14
- & > *:first-child {
15
- margin-top: 0;
16
- }
17
-
18
- & > *:last-child {
19
- margin-bottom: 0;
20
- }
21
- }
@@ -1,52 +0,0 @@
1
- .c-info-widget {
2
- max-width: 600px;
3
-
4
- &--center {
5
- margin: 0 auto;
6
- }
7
-
8
- &__description {
9
- padding: $spacing;
10
- background: $brand-color--lighter;
11
- color: $brand-color--dark;
12
- @include font-size(18px, 26px);
13
-
14
- p {
15
- margin-top: 0;
16
-
17
- &:last-child {
18
- margin-bottom: 0;
19
- }
20
- }
21
- }
22
-
23
- &__links {
24
- display: flex;
25
- align-items: center;
26
- justify-content: flex-end;
27
- }
28
-
29
- &__main-link {
30
- color: $brand-color--dark;
31
- @include font-size(16px, 24px);
32
- }
33
-
34
- &__icon-link {
35
- width: 47px;
36
- height: 47px;
37
- border-radius: 100%;
38
- background: $brand-color--lighter;
39
- color: $brand-color--dark;
40
- box-shadow: none;
41
- display: flex;
42
- justify-content: center;
43
- align-items: center;
44
-
45
- .c-icon {
46
- width: 20px;
47
- height: 20px;
48
- }
49
-
50
- margin-right: $spacing--small;
51
- }
52
- }
@@ -1,29 +0,0 @@
1
- .c-portrait {
2
- width: 7rem;
3
- height: 7rem;
4
- span {
5
- display: block;
6
- border-radius: 50%;
7
- background-color: rgba(0,0,0,0.16);
8
- background-size: cover;
9
- background-position: center center;
10
- width: 7rem;
11
- height: 7rem;
12
- }
13
- &--small {
14
- width: 4rem;
15
- height: 4rem;
16
- span {
17
- width: 4rem;
18
- height: 4rem;
19
- }
20
- }
21
- &--large {
22
- width: 10rem;
23
- height: 10rem;
24
- span {
25
- width: 10rem;
26
- height: 10rem;
27
- }
28
- }
29
- }
@@ -1,82 +0,0 @@
1
- import React from 'react';
2
- import BEMHelper from 'react-bem-helper';
3
- import PropTypes from 'prop-types';
4
-
5
- import { FilterList } from '../Filter';
6
-
7
- const searchFilterClasses = BEMHelper({
8
- prefix: 'c-',
9
- name: 'search-filter',
10
- outputIsString: true,
11
- });
12
-
13
- const valueShape = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
14
-
15
- const SearchFilter = ({
16
- label,
17
- options,
18
- values,
19
- defaultVisibleCount,
20
- showLabel,
21
- hideLabel,
22
- narrowScreenOnly,
23
- contextFilter,
24
- onChange,
25
- noFilterSelectedLabel,
26
- children,
27
- }) => {
28
- const modifiers = [];
29
-
30
- if (narrowScreenOnly) {
31
- modifiers.push('narrow-screen-only');
32
- }
33
-
34
- if (contextFilter) {
35
- modifiers.push('context-filter');
36
- }
37
-
38
- return (
39
- <div className={searchFilterClasses('', modifiers)}>
40
- <FilterList
41
- options={options}
42
- label={label}
43
- labelNotVisible={contextFilter}
44
- values={values}
45
- defaultVisibleCount={defaultVisibleCount}
46
- modifiers={!contextFilter ? 'search' : null}
47
- showLabel={showLabel}
48
- hideLabel={hideLabel}
49
- onChange={onChange}
50
- alignedGroup
51
- noFilterSelectedLabel={noFilterSelectedLabel}
52
- />
53
- {children}
54
- </div>
55
- );
56
- };
57
-
58
- SearchFilter.propTypes = {
59
- label: PropTypes.string.isRequired,
60
- options: PropTypes.arrayOf(
61
- PropTypes.shape({
62
- value: valueShape.isRequired,
63
- title: PropTypes.string.isRequired,
64
- noResults: PropTypes.bool,
65
- }),
66
- ).isRequired,
67
- values: PropTypes.arrayOf(valueShape),
68
- defaultVisibleCount: PropTypes.number,
69
- onChange: PropTypes.func,
70
- showLabel: PropTypes.string,
71
- hideLabel: PropTypes.string,
72
- narrowScreenOnly: PropTypes.bool,
73
- noFilterSelectedLabel: PropTypes.string,
74
- contextFilter: PropTypes.bool,
75
- children: PropTypes.node,
76
- };
77
-
78
- SearchFilter.defaultProps = {
79
- values: [],
80
- };
81
-
82
- export default SearchFilter;
@@ -1,110 +0,0 @@
1
- import React, { Fragment } from 'react';
2
- import BEMHelper from 'react-bem-helper';
3
- import PropTypes from 'prop-types';
4
-
5
- import { FilterList, ToggleItem } from '../Filter';
6
-
7
- const searchFilterClasses = BEMHelper({
8
- prefix: 'c-',
9
- name: 'search-filter',
10
- outputIsString: true,
11
- });
12
-
13
- const valueShape = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
14
-
15
- const SearchFilterList = ({
16
- label,
17
- options,
18
- values,
19
- narrowScreenOnly,
20
- onChange,
21
- onSubfilterChange,
22
- preid,
23
- noFilterSelectedLabel,
24
- subjectValues,
25
- children,
26
- }) => {
27
- return (
28
- <div className={searchFilterClasses('')}>
29
- <div>
30
- {options.map((option, index) => {
31
- const itemModifiers = [];
32
- const checked = values.some((value) => value === option.value);
33
-
34
- if (!checked && index + 1 > this.state.visibleCount) {
35
- itemModifiers.push('hidden');
36
- }
37
-
38
- const disabled = option.noResults || option.hits === 0;
39
-
40
- if (disabled) {
41
- itemModifiers.push('no-results');
42
- }
43
-
44
- return (
45
- <Fragment key={option.value}>
46
- <ToggleItem
47
- modifiers={itemModifiers}
48
- id={preid + option.value}
49
- value={option.value}
50
- disabled={disabled}
51
- tabIndex={disabled ? -1 : 0}
52
- checked={checked}
53
- icon={option.icon}
54
- label={option.title}
55
- component="div"
56
- onChange={(event) => {
57
- let newValues = null;
58
- if (event.currentTarget.checked) {
59
- newValues = [...values, option.value];
60
- } else {
61
- newValues = values.filter((value) => value !== option.value);
62
- }
63
- if (onChange) {
64
- onChange(newValues, option.value);
65
- }
66
- }}
67
- />
68
- <div className={searchFilterClasses()}>
69
- <FilterList
70
- options={option.subjectFilters}
71
- label={label}
72
- labelNotVisible
73
- values={subjectValues[option.value]}
74
- onChange={(subjectFilters, subjectFilter) =>
75
- onSubfilterChange(option.value, subjectFilters, subjectFilter)
76
- }
77
- alignedGroup
78
- noFilterSelectedLabel={noFilterSelectedLabel}
79
- />
80
- </div>
81
- </Fragment>
82
- );
83
- })}
84
- </div>
85
- {children}
86
- </div>
87
- );
88
- };
89
-
90
- SearchFilterList.propTypes = {
91
- label: PropTypes.string.isRequired,
92
- options: PropTypes.arrayOf(
93
- PropTypes.shape({
94
- value: valueShape.isRequired,
95
- title: PropTypes.string.isRequired,
96
- noResults: PropTypes.bool,
97
- }),
98
- ).isRequired,
99
- values: PropTypes.arrayOf(valueShape),
100
- onChange: PropTypes.func,
101
- onSubfilterChange: PropTypes.func,
102
- noFilterSelectedLabel: PropTypes.string,
103
- children: PropTypes.node,
104
- };
105
-
106
- SearchFilterList.defaultProps = {
107
- values: [],
108
- };
109
-
110
- export default SearchFilterList;
@@ -1,38 +0,0 @@
1
- import React, { Fragment } from 'react';
2
- import PropTypes from 'prop-types';
3
- import BEMHelper from 'react-bem-helper';
4
- import { Cross } from '@ndla/icons/action';
5
- import { CSSTransition } from 'react-transition-group';
6
-
7
- import Fade from '../Animation/Fade';
8
-
9
- const classes = BEMHelper({
10
- prefix: 'c-',
11
- name: 'search-overlay',
12
- });
13
-
14
- const SearchOverlay = ({ close, isOpen, children }) => (
15
- <Fragment>
16
- <Fade in={isOpen}>
17
- <div className="o-backdrop" />
18
- </Fade>
19
- <CSSTransition timeout={300} classNames={classes().className} unmountOnExit in={isOpen}>
20
- <div {...classes()}>
21
- <div {...classes('container o-wrapper')}>
22
- {children}
23
- <button {...classes('close-button')} type="button" onClick={close}>
24
- <Cross />
25
- </button>
26
- </div>
27
- </div>
28
- </CSSTransition>
29
- </Fragment>
30
- );
31
-
32
- SearchOverlay.propTypes = {
33
- isOpen: PropTypes.bool.isRequired,
34
- close: PropTypes.func,
35
- children: PropTypes.node.isRequired,
36
- };
37
-
38
- export default SearchOverlay;