import { Fragment, useMemo } from 'react' import type { Highlight } from '../../lib/networking/fragments/highlightFragment' 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: '$utilityTextDefault', cursor: 'pointer', }) return ( { if (props.scrollToHighlight) { props.scrollToHighlight(props.highlight.id) } }}> {props.highlight.prefix} {lines.map((line: string, index: number) => ( {line} {index !== lines.length - 1 && ( <>

)}
))}
{props.highlight.suffix}
{props.author && props.title &&( {props.title + props.author} )}
) } 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} ) }