fix(search): update to only link title in search results

Signed-off-by: Jonathan Sundquist <jonathan.sundquist@factset.com>
This commit is contained in:
Jonathan Sundquist
2022-11-14 08:51:14 -06:00
parent 50b941cf6b
commit a19cffbeed
6 changed files with 67 additions and 44 deletions
@@ -81,6 +81,15 @@ export const TechDocsSearchResultListItem = (
});
};
const LinkWrapper = ({ children }: PropsWithChildren<{}>) =>
asLink ? (
<Link noTrack to={result.location} onClick={handleClick}>
{children}
</Link>
) : (
<>{children}</>
);
const TextItem = () => {
const resultTitle = highlight?.fields.title ? (
<HighlightedSearchResultText
@@ -118,11 +127,11 @@ export const TechDocsSearchResultListItem = (
primaryTypographyProps={{ variant: 'h6' }}
primary={
title ? (
title
<LinkWrapper>{title}</LinkWrapper>
) : (
<>
<LinkWrapper>
{resultTitle} | {entityTitle ?? resultName} docs
</>
</LinkWrapper>
)
}
secondary={
@@ -149,15 +158,6 @@ export const TechDocsSearchResultListItem = (
);
};
const LinkWrapper = ({ children }: PropsWithChildren<{}>) =>
asLink ? (
<Link noTrack to={result.location} onClick={handleClick}>
{children}
</Link>
) : (
<>{children}</>
);
const ListItemWrapper = ({ children }: PropsWithChildren<{}>) =>
asListItem ? (
<>
@@ -172,10 +172,8 @@ export const TechDocsSearchResultListItem = (
);
return (
<LinkWrapper>
<ListItemWrapper>
<TextItem />
</ListItemWrapper>
</LinkWrapper>
<ListItemWrapper>
<TextItem />
</ListItemWrapper>
);
};