import { FC } from "react"; import styled, { useTheme } from "styled-components"; import { Li } from "../../Styled/List"; import Icon, { StyledIcon } from "../../Styled/Icon"; import highlightKeyword from "../ReactViewHelpers/highlightKeyword"; import Box, { BoxSpan } from "../../Styled/Box"; import { TextSpan } from "../../Styled/Text"; import Spacing, { SpacingSpan } from "../../Styled/Spacing"; import { RawButton } from "../../Styled/Button"; import Hr from "../../Styled/Hr"; // Not sure how to generalise this or if it should be kept in stlyed/Button.jsx // Initially had this as border bottom on the button, but need a HR given it's not a full width border // // ${p => !p.isLastResult && `border-bottom: 1px solid ${p.theme.greyLighter};`} const RawButtonAndHighlight = styled(RawButton)` ${(p) => ` &:hover, &:focus { background-color: ${p.theme.greyLighter}; ${StyledIcon} { fill-opacity: 1; } }`} `; interface SearchResultProps { name: string; clickAction(): void; isLastResult: boolean; locationSearchText: string; icon: keyof typeof Icon.GLYPHS; } const SearchResult: FC = (props: SearchResultProps) => { const theme = useTheme(); const highlightedResultName = highlightKeyword( props.name, props.locationSearchText ); const isLightTheme = true; const isDarkTheme = false; return (
  • {/* {!isLastResult && ( */}
    {/* )} */} {props.icon && ( )} {highlightedResultName}
  • ); }; export default SearchResult;