43 | {resultType === 'documentation' &&
}
44 |
45 | {title && }
46 | {title === undefined && {rawTitle}}
47 |
48 |
49 | }
50 |
51 | const getResultContent = ({ result, className, onClickLink }) => {
52 | const {
53 | url: { raw: url },
54 | website_area: { raw: resultType },
55 | body: { snippet: body, raw: rawBody },
56 | author
57 | } = result
58 | return
59 |
60 |
61 |
{resultType === 'documentation' ? 'Documentation' : 'Discussion'}
62 |
63 | {
64 | {url}
65 |
}
66 |
67 |
68 | {body &&
}
69 | {body === undefined &&
70 | {rawBody}
71 |
}
72 | {resultType === 'discuss' &&
73 | Posted {author && author.raw && <>by {author.raw}>}
74 |
}
75 |
76 | }
77 |
78 | const ResultView = ({className, result, ...props}) =>
79 |
80 | {getResultTitle({ result, className, ...props })}
81 | {getResultContent({ result, className, ...props })}
82 |
83 |
84 |
85 | export default ResultView;
86 |
--------------------------------------------------------------------------------
/eas-kb-demo-frontend/src/Search/components/Result/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to Elasticsearch B.V. under one or more contributor
3 | * license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright
5 | * ownership. Elasticsearch B.V. licenses this file to you under
6 | * the Apache License, Version 2.0 (the "License"); you may
7 | * not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export { default as ResultView } from './ResultView';
21 |
--------------------------------------------------------------------------------
/eas-kb-demo-frontend/src/Search/components/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to Elasticsearch B.V. under one or more contributor
3 | * license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright
5 | * ownership. Elasticsearch B.V. licenses this file to you under
6 | * the Apache License, Version 2.0 (the "License"); you may
7 | * not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export { PageTypeFacet, ProductFacet } from './Facets';
21 | export { ResultView } from './Result';
22 |
--------------------------------------------------------------------------------
/eas-kb-demo-frontend/src/Search/images/arrow-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/app-search-kb-demo/aa32ccea1e5c2192aa60582e77379fb146bc5a09/eas-kb-demo-frontend/src/Search/images/arrow-icon.png
--------------------------------------------------------------------------------
/eas-kb-demo-frontend/src/Search/images/background-home.svg:
--------------------------------------------------------------------------------
1 |