Skip to content

Commit

Permalink
[NTP Search]: UX tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
fallaciousreasoning committed Jul 9, 2024
1 parent cf7f2d8 commit 502027b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions components/brave_new_tab_ui/components/search/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ const IconContainer = styled.div`
flex-shrink: 0;
> span, > img {
> * { border-radius: ${radius.s}; }
> span {
width: 20px;
height: 20px;
}
> img {
width: 100%;
height: 100%;
}
`

const SearchIcon = styled.span<{ url: string }>`
Expand All @@ -67,7 +74,7 @@ const FavIcon = styled.span<{ url: string }>`
const Content = styled.span`
font: ${font.large.regular};
line-height: 24px;
color: ${color.text.secondary};
color: ${color.white};
`

const Description = styled.span`
Expand All @@ -76,12 +83,8 @@ const Description = styled.span`
color: rgba(255,255,255,0.7);
`

const Hint = styled.span`
color: ${color.text.interactive};
`

const LeoIcon = styled(Icon)`
--leo-icon-size: ${icon.m};
--leo-icon-size: ${icon.l};
color: ${color.white};
background: ${gradient.iconsActive};
Expand Down Expand Up @@ -125,10 +128,6 @@ export default function SearchResult({ match, selected, onClick }: Props) {
const description = mojoString16ToString(match.swapContentsAndDescription ? match.contents : match.description)
const isAskLeo = description === getLocale('searchAskLeo')

const hint = description && match.destinationUrl.url
? description
: ''

const result = <Container href={match.destinationUrl.url} aria-selected={selected} onClick={e => {
e.preventDefault()
onClick(e)
Expand All @@ -137,8 +136,8 @@ export default function SearchResult({ match, selected, onClick }: Props) {
<Image key={match.imageUrl ?? match.iconUrl} match={match} isAskLeo={isAskLeo} />
</IconContainer>
<Flex direction='column'>
<Content>{contents}<Hint>{hint ? ` - ${hint}` : ''}</Hint></Content>
{description && description !== hint && <Description>{description}</Description>}
<Content>{contents}</Content>
{description && <Description>{description}</Description>}
</Flex>
</Container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { handleOpenURLClick, validateScheme } from '$web-common/SecureLink';
import MaybePromptEnableSuggestions from './MaybePromptEnableSuggestions';

const Container = styled.div`
border-top: 1px solid ${color.divider.subtle};
border-top: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(255,255,255,0.1);
Expand Down

0 comments on commit 502027b

Please sign in to comment.