@ndla/ui 3.3.11 → 3.3.12
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/FrontpageAllSubjects.js +7 -7
- package/es/SearchTypeResult/SearchFieldHeader.js +5 -5
- package/es/SearchTypeResult/SearchHeader.js +9 -9
- package/es/SearchTypeResult/SearchItem.js +19 -19
- package/es/SearchTypeResult/SearchNotionItem.js +12 -12
- package/lib/Frontpage/FrontpageAllSubjects.d.ts +1 -1
- package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
- package/lib/SearchTypeResult/SearchFieldHeader.d.ts +3 -3
- package/lib/SearchTypeResult/SearchFieldHeader.js +5 -5
- package/lib/SearchTypeResult/SearchHeader.d.ts +3 -3
- package/lib/SearchTypeResult/SearchHeader.js +9 -9
- package/lib/SearchTypeResult/SearchItem.d.ts +2 -3
- package/lib/SearchTypeResult/SearchItem.js +19 -19
- package/lib/SearchTypeResult/SearchNotionItem.d.ts +1 -1
- package/lib/SearchTypeResult/SearchNotionItem.js +12 -12
- package/lib/SearchTypeResult/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/Frontpage/FrontpageAllSubjects.tsx +2 -2
- package/src/SearchTypeResult/SearchFieldHeader.tsx +3 -3
- package/src/SearchTypeResult/SearchHeader.tsx +3 -3
- package/src/SearchTypeResult/SearchItem.tsx +4 -5
- package/src/SearchTypeResult/SearchNotionItem.tsx +1 -1
- package/src/SearchTypeResult/index.ts +2 -0
|
@@ -73,7 +73,7 @@ const StyledLetterSpacing = styled.span`
|
|
|
73
73
|
type subjectProps = {
|
|
74
74
|
name: string;
|
|
75
75
|
url?: string;
|
|
76
|
-
path
|
|
76
|
+
path?: string;
|
|
77
77
|
id?: string;
|
|
78
78
|
};
|
|
79
79
|
type categoryProps = {
|
|
@@ -160,7 +160,7 @@ const renderList = (
|
|
|
160
160
|
onNavigate();
|
|
161
161
|
}
|
|
162
162
|
}}
|
|
163
|
-
to={subject.url || subject.path}>
|
|
163
|
+
to={subject.url || subject.path || ''}>
|
|
164
164
|
{subject.name}
|
|
165
165
|
</SafeLink>
|
|
166
166
|
<StyledSpacingElement />
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
9
|
+
import React, { FormEvent, useEffect, useRef, useState } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { colors, breakpoints, mq } from '@ndla/core';
|
|
12
12
|
// @ts-ignore
|
|
@@ -76,8 +76,8 @@ const SearchInput = styled.input`
|
|
|
76
76
|
`;
|
|
77
77
|
|
|
78
78
|
type Props = {
|
|
79
|
-
onSubmit: (event:
|
|
80
|
-
value
|
|
79
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
80
|
+
value?: string;
|
|
81
81
|
onChange: (value: string) => void;
|
|
82
82
|
filters?: PopupFilterProps;
|
|
83
83
|
activeFilters?: {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
9
|
+
import React, { FormEvent } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
12
12
|
|
|
@@ -75,7 +75,7 @@ type Props = {
|
|
|
75
75
|
searchPhrase?: string;
|
|
76
76
|
searchPhraseSuggestion?: string;
|
|
77
77
|
searchPhraseSuggestionOnClick?: () => void;
|
|
78
|
-
searchValue
|
|
78
|
+
searchValue?: string;
|
|
79
79
|
filters?: PopupFilterProps;
|
|
80
80
|
activeFilters?: {
|
|
81
81
|
filters: FilterProps[];
|
|
@@ -83,7 +83,7 @@ type Props = {
|
|
|
83
83
|
};
|
|
84
84
|
competenceGoals?: CompetenceGoalsItemType[];
|
|
85
85
|
onSearchValueChange: (value: string) => void;
|
|
86
|
-
onSubmit: () => void;
|
|
86
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
87
87
|
noResults?: boolean;
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -203,12 +203,11 @@ type context = {
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
export type SearchItemType = {
|
|
206
|
-
id: string;
|
|
206
|
+
id: string | number;
|
|
207
207
|
title: string;
|
|
208
208
|
url: string;
|
|
209
209
|
ingress: string;
|
|
210
|
-
contexts
|
|
211
|
-
image: React.ReactNode | null;
|
|
210
|
+
contexts?: context[];
|
|
212
211
|
img?: { url: string; alt: string };
|
|
213
212
|
labels?: string[];
|
|
214
213
|
children?: React.ReactNode;
|
|
@@ -220,7 +219,7 @@ type Props = {
|
|
|
220
219
|
const SearchItem = ({ item, type }: Props) => {
|
|
221
220
|
const { t } = useTranslation();
|
|
222
221
|
const { title, url, ingress, contexts, img = null, labels = [] } = item;
|
|
223
|
-
const mainContext = contexts[0];
|
|
222
|
+
const mainContext = contexts?.[0];
|
|
224
223
|
|
|
225
224
|
const Breadcrumb = ({ breadcrumb, children }: { breadcrumb: string[]; children?: React.ReactNode }) => (
|
|
226
225
|
<BreadcrumbPath>
|
|
@@ -268,7 +267,7 @@ const SearchItem = ({ item, type }: Props) => {
|
|
|
268
267
|
{item.children}
|
|
269
268
|
<ItemText>{parse(ingress)}</ItemText>
|
|
270
269
|
{mainContext && <Breadcrumb breadcrumb={mainContext.breadcrumb} />}
|
|
271
|
-
{contexts.length > 1 && (
|
|
270
|
+
{contexts && contexts.length > 1 && (
|
|
272
271
|
<ContextsWrapper>
|
|
273
272
|
<Modal
|
|
274
273
|
activateButton={
|
|
@@ -12,4 +12,6 @@ import SearchFieldHeader from './SearchFieldHeader';
|
|
|
12
12
|
import SearchNotionsResult from './SearchNotionsResult';
|
|
13
13
|
import SearchSubjectResult from './SearchSubjectResult';
|
|
14
14
|
|
|
15
|
+
export type { ContentType } from './SearchTypeResult';
|
|
16
|
+
|
|
15
17
|
export { SearchTypeResult, SearchHeader, SearchFieldHeader, SearchNotionsResult, SearchSubjectResult };
|