@ndla/ui 3.3.12 → 3.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Frontpage/FrontpageSearch.js +2 -4
- package/es/Search/SearchResultSleeve.js +12 -15
- package/lib/Frontpage/FrontpageSearch.d.ts +3 -5
- package/lib/Frontpage/FrontpageSearch.js +2 -4
- package/lib/Search/SearchResultSleeve.d.ts +4 -6
- package/lib/Search/SearchResultSleeve.js +10 -11
- package/lib/types.d.ts +2 -2
- package/package.json +2 -2
- package/src/Frontpage/FrontpageSearch.tsx +3 -7
- package/src/Search/SearchResultSleeve.tsx +7 -19
- package/src/types.ts +2 -2
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.13",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "15388cbdbe3dae57fef57a86f58380437b8264fc"
|
|
96
96
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { isIE, browserVersion, isMobileSafari } from 'react-device-detect';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import { History } from 'history';
|
|
5
4
|
import { colors, spacing, mq, breakpoints, animations } from '@ndla/core';
|
|
6
5
|
// @ts-ignore
|
|
7
6
|
import { noScroll } from '@ndla/util';
|
|
@@ -54,11 +53,10 @@ type Props = {
|
|
|
54
53
|
};
|
|
55
54
|
onSearch: (event: React.FormEvent) => void;
|
|
56
55
|
allResultUrl: string;
|
|
57
|
-
searchResult
|
|
56
|
+
searchResult?: Array<ContentTypeResultType>;
|
|
58
57
|
loading: boolean;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
suggestionUrl: string;
|
|
58
|
+
suggestion?: string;
|
|
59
|
+
suggestionUrl?: string;
|
|
62
60
|
};
|
|
63
61
|
|
|
64
62
|
const FrontpageSearch: React.FunctionComponent<Props> = ({
|
|
@@ -73,7 +71,6 @@ const FrontpageSearch: React.FunctionComponent<Props> = ({
|
|
|
73
71
|
allResultUrl,
|
|
74
72
|
searchResult,
|
|
75
73
|
loading,
|
|
76
|
-
history,
|
|
77
74
|
suggestion,
|
|
78
75
|
suggestionUrl,
|
|
79
76
|
}) => {
|
|
@@ -190,7 +187,6 @@ const FrontpageSearch: React.FunctionComponent<Props> = ({
|
|
|
190
187
|
allResultUrl={allResultUrl}
|
|
191
188
|
resourceToLinkProps={resourceToLinkProps}
|
|
192
189
|
infoText={t('welcomePage.searchDisclaimer')}
|
|
193
|
-
history={history}
|
|
194
190
|
suggestion={suggestion}
|
|
195
191
|
suggestionUrl={suggestionUrl}
|
|
196
192
|
/>
|
|
@@ -7,20 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React, { useEffect, useRef, useState } from 'react';
|
|
10
|
-
import { History } from 'history';
|
|
11
10
|
import styled from '@emotion/styled';
|
|
12
11
|
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
13
|
-
import {
|
|
14
|
-
ChevronDown,
|
|
15
|
-
ChevronUp,
|
|
16
|
-
Esc,
|
|
17
|
-
KeyboardReturn,
|
|
18
|
-
Search as SearchIcon,
|
|
19
|
-
Wrench,
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
} from '@ndla/icons/common';
|
|
12
|
+
import { ChevronDown, ChevronUp, Esc, KeyboardReturn, Search as SearchIcon, Wrench } from '@ndla/icons/common';
|
|
22
13
|
import SafeLink from '@ndla/safelink';
|
|
23
|
-
// @ts-ignore
|
|
24
14
|
import { useTranslation } from 'react-i18next';
|
|
25
15
|
import ContentTypeResult from './ContentTypeResult';
|
|
26
16
|
import { highlightStyle } from './ContentTypeResultStyles';
|
|
@@ -218,14 +208,13 @@ type Props = {
|
|
|
218
208
|
to: string;
|
|
219
209
|
};
|
|
220
210
|
onNavigate?: VoidFunction;
|
|
221
|
-
infoText
|
|
222
|
-
ignoreContentTypeBadge
|
|
211
|
+
infoText?: string;
|
|
212
|
+
ignoreContentTypeBadge?: boolean;
|
|
223
213
|
searchString: string;
|
|
224
214
|
loading: boolean;
|
|
225
215
|
frontpage?: boolean;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
suggestionUrl: string;
|
|
216
|
+
suggestion?: string;
|
|
217
|
+
suggestionUrl?: string;
|
|
229
218
|
};
|
|
230
219
|
|
|
231
220
|
const SearchResultSleeve: React.FC<Props> = ({
|
|
@@ -238,7 +227,6 @@ const SearchResultSleeve: React.FC<Props> = ({
|
|
|
238
227
|
searchString,
|
|
239
228
|
loading,
|
|
240
229
|
frontpage,
|
|
241
|
-
history,
|
|
242
230
|
suggestion,
|
|
243
231
|
suggestionUrl,
|
|
244
232
|
}) => {
|
|
@@ -332,7 +320,7 @@ const SearchResultSleeve: React.FC<Props> = ({
|
|
|
332
320
|
<strong ref={searchAllRef}>{searchString}</strong>
|
|
333
321
|
<small>{t('welcomePage.searchAllInfo')}</small>
|
|
334
322
|
</StyledSearchLink>
|
|
335
|
-
{suggestion && (
|
|
323
|
+
{suggestion && suggestionUrl && (
|
|
336
324
|
<StyledSearchLink css={keyboardPathNavigation === GO_TO_SUGGESTION && highlightStyle} to={suggestionUrl}>
|
|
337
325
|
<SearchIcon className="c-icon--22" />
|
|
338
326
|
<small>{t('searchPage.resultType.searchPhraseSuggestion')}</small>
|
|
@@ -342,7 +330,7 @@ const SearchResultSleeve: React.FC<Props> = ({
|
|
|
342
330
|
</SearchLinkContainer>
|
|
343
331
|
{result.map((contentTypeResult: ContentTypeResultType) => (
|
|
344
332
|
<ContentTypeResult
|
|
345
|
-
ignoreContentTypeBadge={ignoreContentTypeBadge}
|
|
333
|
+
ignoreContentTypeBadge={!!ignoreContentTypeBadge}
|
|
346
334
|
onNavigate={onNavigate}
|
|
347
335
|
contentTypeResult={contentTypeResult}
|
|
348
336
|
resourceToLinkProps={resourceToLinkProps}
|