@jetbrains/kotlin-web-site-ui 4.14.6-alpha.2 → 4.14.6-alpha.4
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/out/components/header/full-search/chapters/chapters.js +3 -2
- package/out/components/header/full-search/hit-list/hit-list.js +8 -3
- package/out/components/header/index.css +5 -0
- package/out/components/header/quick-search/result/result.js +6 -2
- package/out/components/header/search-wrapper/search-context.js +2 -1
- package/out/components/header/search-wrapper/search-wrapper.js +5 -1
- package/package.json +1 -1
|
@@ -7,7 +7,8 @@ const MAX_INIT_CHAPTERS_NUMBER = 3;
|
|
|
7
7
|
|
|
8
8
|
const Chapters = ({
|
|
9
9
|
chapters,
|
|
10
|
-
hitIndex
|
|
10
|
+
hitIndex,
|
|
11
|
+
baseUrl
|
|
11
12
|
}) => {
|
|
12
13
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
13
14
|
|
|
@@ -36,7 +37,7 @@ const Chapters = ({
|
|
|
36
37
|
mode: 'clear',
|
|
37
38
|
hardness: 'hard'
|
|
38
39
|
})),
|
|
39
|
-
href: url,
|
|
40
|
+
href: baseUrl + url,
|
|
40
41
|
id: chapterId,
|
|
41
42
|
dangerouslySetInnerHTML: {
|
|
42
43
|
__html: title
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
1
|
+
import React__default, { useContext } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { useTextStyles } from '@rescui/typography';
|
|
4
4
|
import getExtendedHits from './get-extended-hits.js';
|
|
5
5
|
import { Chapters } from '../chapters/chapters.js';
|
|
6
|
+
import SearchContext from '../../search-wrapper/search-context.js';
|
|
6
7
|
import styles from './hit-list.module.pcss.js';
|
|
7
8
|
|
|
8
9
|
const HitList = ({
|
|
9
10
|
hits
|
|
10
11
|
}) => {
|
|
11
12
|
const textCn = useTextStyles();
|
|
13
|
+
const {
|
|
14
|
+
baseUrl
|
|
15
|
+
} = useContext(SearchContext);
|
|
12
16
|
const extendedHits = getExtendedHits(hits);
|
|
13
17
|
return React__default.createElement("div", {
|
|
14
18
|
"data-test": 'full-search-results'
|
|
@@ -30,13 +34,14 @@ const HitList = ({
|
|
|
30
34
|
mode: 'clear',
|
|
31
35
|
hardness: 'hard'
|
|
32
36
|
})),
|
|
33
|
-
href: url,
|
|
37
|
+
href: baseUrl + url,
|
|
34
38
|
dangerouslySetInnerHTML: {
|
|
35
39
|
__html: title
|
|
36
40
|
}
|
|
37
41
|
})), isHitWithChapters ? React__default.createElement(Chapters, {
|
|
38
42
|
chapters: chapters,
|
|
39
|
-
hitIndex: pageIndex
|
|
43
|
+
hitIndex: pageIndex,
|
|
44
|
+
baseUrl: baseUrl
|
|
40
45
|
}) : React__default.createElement("div", {
|
|
41
46
|
className: classNames(textCn('rs-text-2'), styles.snippet),
|
|
42
47
|
dangerouslySetInnerHTML: {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
1
|
+
import React__default, { useContext } from 'react';
|
|
2
2
|
import { useTextStyles } from '@rescui/typography';
|
|
3
3
|
import styles from './result.module.pcss.js';
|
|
4
|
+
import SearchContext from '../../search-wrapper/search-context.js';
|
|
4
5
|
|
|
5
6
|
const Result = ({
|
|
6
7
|
hit
|
|
7
8
|
}) => {
|
|
8
9
|
const textCn = useTextStyles();
|
|
10
|
+
const {
|
|
11
|
+
baseUrl
|
|
12
|
+
} = useContext(SearchContext);
|
|
9
13
|
const hitTitle = !hit.mainTitle || hit.title === hit.mainTitle ? hit.highlightedTitle : `${hit.mainTitle}: ${hit.highlightedTitle}`;
|
|
10
14
|
return React__default.createElement("a", {
|
|
11
15
|
className: styles.result,
|
|
12
|
-
href: hit.url
|
|
16
|
+
href: baseUrl + hit.url
|
|
13
17
|
}, React__default.createElement("div", {
|
|
14
18
|
className: styles.resultTitle
|
|
15
19
|
}, React__default.createElement("div", {
|
|
@@ -12,7 +12,8 @@ const searchParamsInitValue = {
|
|
|
12
12
|
setMatching: () => null,
|
|
13
13
|
updateQueryString: () => null,
|
|
14
14
|
searchQueryState: '',
|
|
15
|
-
setSearchQueryState: () => null
|
|
15
|
+
setSearchQueryState: () => null,
|
|
16
|
+
baseUrl: ''
|
|
16
17
|
};
|
|
17
18
|
const SearchContext = React__default.createContext(searchParamsInitValue);
|
|
18
19
|
export { SearchContext as default };
|
|
@@ -17,6 +17,9 @@ const SearchWrapper = ({
|
|
|
17
17
|
const {
|
|
18
18
|
search
|
|
19
19
|
} = initSearch(searchConfig);
|
|
20
|
+
const {
|
|
21
|
+
baseUrl = ''
|
|
22
|
+
} = searchConfig;
|
|
20
23
|
const [type, setType] = useState(QUICK_SEARCH);
|
|
21
24
|
const [matching, setMatching] = useState(matchingOptions[0].value);
|
|
22
25
|
const [searchQueryState, setSearchQueryState] = useState(''); // router
|
|
@@ -32,7 +35,8 @@ const SearchWrapper = ({
|
|
|
32
35
|
setMatching,
|
|
33
36
|
updateQueryString: () => {},
|
|
34
37
|
searchQueryState,
|
|
35
|
-
setSearchQueryState
|
|
38
|
+
setSearchQueryState,
|
|
39
|
+
baseUrl
|
|
36
40
|
}
|
|
37
41
|
}, children);
|
|
38
42
|
};
|
package/package.json
CHANGED