From fd86dc15734f3b7126d88f0130897c597100e30a Mon Sep 17 00:00:00 2001 From: polwex Date: Thu, 15 May 2025 20:32:25 +0700 Subject: m --- src/zoom/Sentence.tsx | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/zoom/Sentence.tsx (limited to 'src/zoom/Sentence.tsx') diff --git a/src/zoom/Sentence.tsx b/src/zoom/Sentence.tsx new file mode 100644 index 0000000..35e00d6 --- /dev/null +++ b/src/zoom/Sentence.tsx @@ -0,0 +1,55 @@ +import React, { memo } from "react"; +import { motion } from "motion/react"; +import type { ViewProps, LoadingStatus } from "./logic/types"; +import { NLP } from "sortug-ai"; +import SpacyClause from "./SpacyClause"; +import { sentenceVariants, createHoverEffect } from "./animations"; +import { useZoom } from "./hooks/useZoom"; +import StanzaClause from "./StanzaClause"; + +interface Props extends ViewProps { + spacy: NLP.Spacy.Sentence; + stanzas?: NLP.Stanza.Sentence | undefined; +} + +function Sentence(props: Props) { + const { spacy, stanzas, context, idx } = props; + const { viewState, handleElementClick } = useZoom(); + const { level, sIndex } = viewState; + const selected = sIndex === idx; + const isFocused = level === "sentence" && selected; + + return ( + <> + handleElementClick(e, idx)} + whileHover={ + level === "paragraph" + ? createHoverEffect(level, "paragraph", "200, 220, 255") + : {} + } + > + {level === "paragraph" || !selected ? ( + {spacy.text} + ) : stanzas ? ( + + ) : ( + + )} + + + ); +} + +export default memo(Sentence); -- cgit v1.2.3