diff --git a/src/assistant/ResultMenu/ResultMenuContent.jsx b/src/assistant/ResultMenu/ResultMenuContent.jsx index 350c3e356..e2b1856dc 100644 --- a/src/assistant/ResultMenu/ResultMenuContent.jsx +++ b/src/assistant/ResultMenu/ResultMenuContent.jsx @@ -30,8 +30,10 @@ const SearchResult = () => { + ) : ( secondaryText ) diff --git a/src/assistant/ResultMenu/SuggestionItemTextSecondary.jsx b/src/assistant/ResultMenu/SuggestionItemTextSecondary.jsx new file mode 100644 index 000000000..9a9e13afc --- /dev/null +++ b/src/assistant/ResultMenu/SuggestionItemTextSecondary.jsx @@ -0,0 +1,46 @@ +/** + * Code copied and adapted from cozy-drive + * + * See source: https://github.com/cozy/cozy-drive/blob/fbe2df67199683b23a40f476ccdacb00ee027459/src/modules/search/components/SuggestionItemTextSecondary.jsx + */ +import React from 'react' + +import AppLinker from 'cozy-ui/transpiled/react/AppLinker' +import SuggestionItemTextHighlighted from './SuggestionItemTextHighlighted' +import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints' + +import styles from './styles.styl' + +const SuggestionItemTextSecondary = ({ text, query, url, slug }) => { + const { isMobile } = useBreakpoints() + + if (isMobile || !url) { + return + } + + const app = { slug } + return ( + + {({ href, onClick }) => ( + { + e.stopPropagation() + if (typeof onClick == 'function') { + onClick(e) + } + }} + > + + + )} + + ) +} + +export default SuggestionItemTextSecondary diff --git a/src/assistant/ResultMenu/styles.styl b/src/assistant/ResultMenu/styles.styl index 4c79c311e..08f4afede 100644 --- a/src/assistant/ResultMenu/styles.styl +++ b/src/assistant/ResultMenu/styles.styl @@ -8,3 +8,10 @@ &-inner max-height 16.5rem overflow auto + +.suggestion-item-parent-link + color var(--primaryTextColor) + text-decoration none + + &:hover + text-decoration underline \ No newline at end of file diff --git a/src/assistant/Search/useFetchResult.jsx b/src/assistant/Search/useFetchResult.jsx index 5955f8ed7..9a8832579 100644 --- a/src/assistant/Search/useFetchResult.jsx +++ b/src/assistant/Search/useFetchResult.jsx @@ -36,6 +36,8 @@ export const useFetchResult = searchValue => { return { id: r.doc._id, icon: icon, + slug: r.slug, + secondaryUrl: r.secondaryUrl, primary: r.title, secondary: r.subTitle, onClick: () => {