diff --git a/package.json b/package.json index d6c0fa1..d691f2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "2.8.8", + "version": "2.8.9", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", diff --git a/src/components/ep-explorer/EPBlocksDisplay.tsx b/src/components/ep-explorer/EPBlocksDisplay.tsx index 5233fe7..88d08ba 100644 --- a/src/components/ep-explorer/EPBlocksDisplay.tsx +++ b/src/components/ep-explorer/EPBlocksDisplay.tsx @@ -2,15 +2,16 @@ import * as T from "../../types"; import Block from "../blocks/Block"; import KidDisplay from "../blocks/KidDisplay"; -function EPBlocksDisplay({ opts, rendered }: { +function EPBlocksDisplay({ opts, rendered, justify }: { opts: T.TextOptions, rendered: T.EPRendered, + justify?: "left" | "right" | "center", }) { const blocks = rendered.omitSubject ? rendered.blocks.filter(b => b.type !== "subjectSelection") : rendered.blocks; - return
-
+ return
+
diff --git a/src/components/ep-explorer/EPDisplay.tsx b/src/components/ep-explorer/EPDisplay.tsx index ad149dc..b22970f 100644 --- a/src/components/ep-explorer/EPDisplay.tsx +++ b/src/components/ep-explorer/EPDisplay.tsx @@ -8,10 +8,12 @@ import EPTextDisplay from "./EPTextDisplay"; import EPBlocksDisplay from "./EPBlocksDisplay"; type Mode = "text" | "blocks"; -function EPDisplay({ eps, opts, setOmitSubject }: { +function EPDisplay({ eps, opts, setOmitSubject, justify, onlyOne }: { eps: T.EPSelectionState, opts: T.TextOptions, setOmitSubject: ((value: "true" | "false") => void) | false + justify?: "left" | "right" | "center", + onlyOne?: boolean, }) { const [mode, setMode] = useState("text"); const EP = completeEPSelection(eps); @@ -47,10 +49,10 @@ function EPDisplay({ eps, opts, setOmitSubject }: {
{mode === "text" - ? - : } - {result.e &&
- {result.e.map((e, i) =>
{e}
)} + ? + : } + {result.e &&
+ {(onlyOne ? [result.e[0]] : result.e).map((e, i) =>
{e}
)}
} {EP.predicate.selection.selection.type === "participle" &&

⚠️ NOTE: This means that the subject {renderedSubject.selection.e ? `(${renderedSubject.selection.e})` : ""} is the action/idea of diff --git a/src/components/ep-explorer/EPTextDisplay.tsx b/src/components/ep-explorer/EPTextDisplay.tsx index 14ecff8..61cc458 100644 --- a/src/components/ep-explorer/EPTextDisplay.tsx +++ b/src/components/ep-explorer/EPTextDisplay.tsx @@ -1,23 +1,31 @@ +import { getShort } from "../../lib/p-text-helpers"; import * as T from "../../types"; import Examples from "../Examples"; -function EPTextDisplay({ compiled, opts }: { compiled: { - ps: T.SingleOrLengthOpts; - e?: string[] | undefined; -}, opts: T.TextOptions }) { +function EPTextDisplay({ compiled, opts, justify, onlyOne }: { + compiled: { + ps: T.SingleOrLengthOpts; + e?: string[] | undefined; + }, + opts: T.TextOptions, + justify?: "left" | "right" | "center", + onlyOne?: boolean, +}) { function VariationLayer({ vs }: { vs: T.PsString[] }) { return

{vs}
; } - return
- {"long" in compiled.ps ? -
- - - {compiled.ps.mini && } -
- : + return
+ {onlyOne + ? + : "long" in compiled.ps ? +
+ + + {compiled.ps.mini && } +
+ : }
; }