|
1 | 1 | import React from 'react' |
2 | 2 | import R from 'ramda' |
3 | 3 | import Highlighter from 'react-highlight-words' |
| 4 | +import { OverlayScrollbarsComponent } from 'overlayscrollbars-react' |
4 | 5 |
|
| 6 | +// eslint-disable-next-line import/named |
5 | 7 | import { ICON_CMD } from '@config' |
6 | 8 | import { THREAD } from '@constant' |
7 | 9 |
|
@@ -30,43 +32,47 @@ const HintIcon = ({ index, active, cur, length }) => { |
30 | 32 | } |
31 | 33 |
|
32 | 34 | const ResultsList = ({ searchValue, searchThread, suggestions, activeRaw }) => ( |
33 | | - <Wrapper id="suggestion-scroller"> |
34 | | - <SuggestionWrapper empty={suggestions.length === 0}> |
35 | | - {suggestions.map((suggestion, i) => ( |
36 | | - <InfoBar |
37 | | - active={activeRaw === suggestion.raw} |
38 | | - key={suggestion.raw} |
39 | | - id={suggestion.raw} |
40 | | - onMouseEnter={navToSuggestion.bind(this, suggestion)} |
41 | | - onClick={suggestionOnSelect} |
42 | | - > |
43 | | - <SuggestIcon |
44 | | - raw={suggestion.raw} |
45 | | - suggestion={suggestion} |
46 | | - round={R.contains(searchThread, [THREAD.POST, THREAD.USER])} |
47 | | - searchThread={searchThread} |
48 | | - /> |
49 | | - <ContentWraper> |
50 | | - <Title> |
51 | | - <Highlighter |
52 | | - highlightClassName="doramon-search-highlighter" |
53 | | - searchWords={[searchValue]} |
54 | | - autoEscape |
55 | | - textToHighlight={suggestion.title} |
56 | | - /> |
57 | | - </Title> |
58 | | - <Desc>{suggestion.desc}</Desc> |
59 | | - </ContentWraper> |
60 | | - <HintIcon |
61 | | - index={i} |
62 | | - active={activeRaw} |
63 | | - cur={suggestion.raw} |
64 | | - length={suggestions.length} |
65 | | - /> |
66 | | - </InfoBar> |
67 | | - ))} |
68 | | - </SuggestionWrapper> |
69 | | - </Wrapper> |
| 35 | + <OverlayScrollbarsComponent |
| 36 | + options={{ scrollbars: { autoHide: 'scroll', autoHideDelay: 200 } }} |
| 37 | + > |
| 38 | + <Wrapper> |
| 39 | + <SuggestionWrapper empty={suggestions.length === 0}> |
| 40 | + {suggestions.map((suggestion, i) => ( |
| 41 | + <InfoBar |
| 42 | + active={activeRaw === suggestion.raw} |
| 43 | + key={suggestion.raw} |
| 44 | + id={suggestion.raw} |
| 45 | + onMouseEnter={navToSuggestion.bind(this, suggestion)} |
| 46 | + onClick={suggestionOnSelect} |
| 47 | + > |
| 48 | + <SuggestIcon |
| 49 | + raw={suggestion.raw} |
| 50 | + suggestion={suggestion} |
| 51 | + round={R.contains(searchThread, [THREAD.POST, THREAD.USER])} |
| 52 | + searchThread={searchThread} |
| 53 | + /> |
| 54 | + <ContentWraper> |
| 55 | + <Title> |
| 56 | + <Highlighter |
| 57 | + highlightClassName="doramon-search-highlighter" |
| 58 | + searchWords={[searchValue]} |
| 59 | + autoEscape |
| 60 | + textToHighlight={suggestion.title} |
| 61 | + /> |
| 62 | + </Title> |
| 63 | + <Desc>{suggestion.desc}</Desc> |
| 64 | + </ContentWraper> |
| 65 | + <HintIcon |
| 66 | + index={i} |
| 67 | + active={activeRaw} |
| 68 | + cur={suggestion.raw} |
| 69 | + length={suggestions.length} |
| 70 | + /> |
| 71 | + </InfoBar> |
| 72 | + ))} |
| 73 | + </SuggestionWrapper> |
| 74 | + </Wrapper> |
| 75 | + </OverlayScrollbarsComponent> |
70 | 76 | ) |
71 | 77 |
|
72 | 78 | export default ResultsList |
0 commit comments