From 97364b284f0e85d7f1040fde9601f21a57aedde2 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Mon, 9 May 2022 17:23:55 -0500 Subject: [PATCH] better examples --- package.json | 2 +- src/components/Examples.tsx | 23 +++++++++++------------ src/lib/jsx-map.tsx | 2 +- src/lib/phrase-building/render-ep.ts | 1 + 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index b2ad3fa..27efa78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "2.5.0", + "version": "2.5.1", "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/Examples.tsx b/src/components/Examples.tsx index a2c8964..8faa5f0 100644 --- a/src/components/Examples.tsx +++ b/src/components/Examples.tsx @@ -23,25 +23,22 @@ function EnglishContent({ children }: { children: (string | JSX.Element)[] | (st ; } -function Examples({ - children, - ex, - opts, - lineHeight, -}: { - ex?: PsStringWSub | PsStringWSub[] | T.PsJSX | T.PsJSX[], - children: PsStringWSub | PsStringWSub[], +function Examples(props: ({ + ex: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[], +} | { + children: T.PsJSX | T.PsJSX[] | PsStringWSub | PsStringWSub[], +}) & { opts: T.TextOptions, lineHeight?: 0 | 1 | 2 | 3 | 4, }) { - const examples = children || ex; + const examples = "children" in props ? props.children : props.ex; const Example = ({ children: text }: { children: PsStringWSub }) => ( -
+
- {text} + {text}
- {text} + {text}
{text.e && {text.e} @@ -53,9 +50,11 @@ function Examples({ ); return Array.isArray(examples) ?
+ {/* @ts-ignore */} {examples.map((example, i) => {example})}
: + // @ts-ignore {examples}; } diff --git a/src/lib/jsx-map.tsx b/src/lib/jsx-map.tsx index 15572a9..2716be9 100644 --- a/src/lib/jsx-map.tsx +++ b/src/lib/jsx-map.tsx @@ -19,7 +19,7 @@ import * as T from "../types"; * @param dealWithString * @returns */ -export function psJSXMap(ps: T.PsJSX, target: "p" | "f", dealWithString: (ps: T.PsString) => string): JSX.Element { +export function psJSXMap(ps: T.PsJSX, target: "p" | "f", dealWithString: (ps: T.PsString) => string | JSX.Element): JSX.Element { const base = ps[target]; const sec = ps[target === "p" ? "f" : "p"]; try { diff --git a/src/lib/phrase-building/render-ep.ts b/src/lib/phrase-building/render-ep.ts index 0515a52..b36ca15 100644 --- a/src/lib/phrase-building/render-ep.ts +++ b/src/lib/phrase-building/render-ep.ts @@ -93,6 +93,7 @@ const equativeBuilders: Record str return [ `$SUBJ ${getEnglishConj(p, g.englishEquative.present)}${not(n)} $PRED`, `$SUBJ tend${isThirdPersonSing(p) ? "s" : ""}${not(n)} to be $PRED`, + `$SUBJ ${n ? "don't " : ""}be $PRED`, ]; }, subjunctive: (p, n) => {