import { Fragment, useMemo } from 'react' import type { Highlight } from '../../lib/networking/fragments/highlightFragment' import { LabelChip } from '../elements/LabelChip' import { Box, VStack, Blockquote, SpanBox } from '../elements/LayoutPrimitives' import { StyledText } from '../elements/StyledText' import { styled } from '../tokens/stitches.config' type HighlightViewProps = { highlight: Highlight author?: string title?: string scrollToHighlight?: (arg: string) => void } export function HighlightView(props: HighlightViewProps): JSX.Element { const lines = useMemo( () => props.highlight.quote.split('\n'), [props.highlight.quote] ) const StyledQuote = styled(Blockquote, { margin: '0px 0px 0px 0px', fontSize: '18px', lineHeight: '27px', color: '$grayText', padding: '0px 16px', borderLeft: '2px solid $omnivoreCtaYellow', }) return ( { if (props.scrollToHighlight) { props.scrollToHighlight(props.highlight.id) } }} > {lines.map((line: string, index: number) => ( {line} {index !== lines.length - 1 && ( <>

)}
))}
{props.highlight.labels?.map(({ name, color }, index) => ( ))}
) } export function PublicHighlightView(props: HighlightViewProps): JSX.Element { const lines = useMemo( () => props.highlight.quote.split('\n'), [props.highlight.quote] ) const StyledQuote = styled(Blockquote, { margin: '16px 0px 0px 0px', fontSize: '18px', lineHeight: '1.5', fontFamily: 'Inter', color: '$readerFont', }) return ( {props.highlight.prefix} {lines.map((line: string, index: number) => ( {line} {index !== lines.length - 1 && ( <>

)}
))}
{props.highlight.suffix}
) } type HighlightFooterProps = { site: string author?: string title?: string fontSize?: string } export function HighlightFooter(props: HighlightFooterProps): JSX.Element { const fontSize = props.fontSize || '12px' return ( From{' '} {props.title} {props.author ? ` — ${props.author}` : null} {props.site} ) }