/* eslint-disable react/no-children-prop */ import { BookOpen, PencilLine } from 'phosphor-react' import { useState } from 'react' import type { Highlight } from '../../lib/networking/fragments/highlightFragment' import { LabelChip } from '../elements/LabelChip' import { Box, VStack, Blockquote, SpanBox, HStack, } from '../elements/LayoutPrimitives' import { styled } from '../tokens/stitches.config' import { HighlightViewNote } from './HighlightNotes' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' type HighlightViewProps = { highlight: Highlight author?: string title?: string updateHighlight: (highlight: Highlight) => void } const StyledQuote = styled(Blockquote, { margin: '0px 0px 0px 0px', fontSize: '18px', lineHeight: '27px', }) export function HighlightView(props: HighlightViewProps): JSX.Element { const [noteMode, setNoteMode] = useState<'preview' | 'edit'>('preview') return ( *': { m: '0px', }, fontSize: '15px', lineHeight: 1.5, color: '$grayText', img: { display: 'block', margin: '0.5em auto !important', maxWidth: '100% !important', height: 'auto', }, }} > {props.highlight.labels?.map(({ name, color }, index) => ( ))} { setNoteMode(noteMode == 'preview' ? 'edit' : 'preview') event.preventDefault() }} > {noteMode === 'edit' ? ( ) : ( )} ) }