move link outside of ternary

Signed-off-by: Jonathan Sundquist <jonathan.sundquist@factset.com>
This commit is contained in:
Jonathan Sundquist
2022-11-15 09:24:28 -06:00
parent a19cffbeed
commit 81e945d052
4 changed files with 41 additions and 44 deletions
@@ -70,19 +70,17 @@ export function AdrSearchResultListItem(props: {
className={classes.itemText}
primaryTypographyProps={{ variant: 'h6' }}
primary={
highlight?.fields.title ? (
<Link noTrack to={result.location} onClick={handleClick}>
<Link noTrack to={result.location} onClick={handleClick}>
{highlight?.fields.title ? (
<HighlightedSearchResultText
text={highlight.fields.title}
preTag={highlight.preTag}
postTag={highlight.postTag}
text={highlight?.fields.title || ''}
preTag={highlight?.preTag || ''}
postTag={highlight?.postTag || ''}
/>
</Link>
) : (
<Link noTrack to={result.location} onClick={handleClick}>
{result.title}
</Link>
)
) : (
result.title
)}
</Link>
}
secondary={
<span
@@ -60,6 +60,7 @@ export function CatalogSearchResultListItem(
props: CatalogSearchResultListItemProps,
) {
const result = props.result as any;
const highlight = props.highlight as ResultHighlight;
const classes = useStyles();
const analytics = useAnalytics();
@@ -79,26 +80,24 @@ export function CatalogSearchResultListItem(
className={classes.itemText}
primaryTypographyProps={{ variant: 'h6' }}
primary={
props.highlight?.fields.title ? (
<Link noTrack to={result.location} onClick={handleClick}>
<Link noTrack to={result.location} onClick={handleClick}>
{highlight?.fields.title ? (
<HighlightedSearchResultText
text={props.highlight.fields.title}
preTag={props.highlight.preTag}
postTag={props.highlight.postTag}
text={highlight.fields.title}
preTag={highlight.preTag}
postTag={highlight.postTag}
/>
</Link>
) : (
<Link noTrack to={result.location} onClick={handleClick}>
{result.title}
</Link>
)
) : (
result.title
)}
</Link>
}
secondary={
props.highlight?.fields.text ? (
highlight?.fields.text ? (
<HighlightedSearchResultText
text={props.highlight.fields.text}
preTag={props.highlight.preTag}
postTag={props.highlight.postTag}
text={highlight.fields.text}
preTag={highlight.preTag}
postTag={highlight.postTag}
/>
) : (
result.text
@@ -72,19 +72,17 @@ export const DefaultResultListItemComponent = ({
<ListItemText
primaryTypographyProps={{ variant: 'h6' }}
primary={
highlight?.fields.title ? (
<Link noTrack to={result.location} onClick={handleClick}>
<Link noTrack to={result.location} onClick={handleClick}>
{highlight?.fields.title ? (
<HighlightedSearchResultText
text={highlight.fields.title}
preTag={highlight.preTag}
postTag={highlight.postTag}
text={highlight?.fields.title || ''}
preTag={highlight?.preTag || ''}
postTag={highlight?.postTag || ''}
/>
</Link>
) : (
<Link noTrack to={result.location} onClick={handleClick}>
{result.title}
</Link>
)
) : (
result.title
)}
</Link>
}
secondary={
<span
@@ -126,13 +126,15 @@ export const TechDocsSearchResultListItem = (
className={classes.itemText}
primaryTypographyProps={{ variant: 'h6' }}
primary={
title ? (
<LinkWrapper>{title}</LinkWrapper>
) : (
<LinkWrapper>
{resultTitle} | {entityTitle ?? resultName} docs
</LinkWrapper>
)
<LinkWrapper>
{title ? (
title
) : (
<>
{resultTitle} | {entityTitle ?? resultName} docs
</>
)}
</LinkWrapper>
}
secondary={
<span