From 620fa26d6257eb861201431eee3b0d68c96e82b3 Mon Sep 17 00:00:00 2001 From: Bill D Date: Wed, 14 Apr 2021 14:26:10 +0300 Subject: [PATCH] shortDefault option on VerbFormDisplay --- package.json | 2 +- src/components/VerbFormDisplay.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2e08525..d4fcb3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "0.3.5", + "version": "0.3.6", "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/VerbFormDisplay.tsx b/src/components/VerbFormDisplay.tsx index dfd908b..1b1e90b 100644 --- a/src/components/VerbFormDisplay.tsx +++ b/src/components/VerbFormDisplay.tsx @@ -39,15 +39,17 @@ function agreementInfo(info: T.NonComboVerbInfo, displayForm: T.DisplayForm): Re return <>Note: {beginning}{agreesWith}{extraExplanation} } -function VerbFormDisplay({ displayForm, textOptions, info, showingFormInfo, english }: { +function VerbFormDisplay({ displayForm, textOptions, info, showingFormInfo, english, shortDefault }: { displayForm: T.DisplayForm | T.VerbForm, english?: T.EnglishBlock | string, textOptions: T.TextOptions, showingFormInfo: boolean, info?: T.NonComboVerbInfo, + shortDefault?: boolean, }) { + const defaultLength = shortDefault ? "short" : "long"; const [persInf, setPersInf] = useState("mascSing"); - const [length, setLength] = useState("long"); + const [length, setLength] = useState(defaultLength); const [showingExplanation, setShowingExplanation] = useState(false); const block = "label" in displayForm ? displayForm.form : displayForm; const chosenPersInf = "mascSing" in block @@ -58,7 +60,7 @@ function VerbFormDisplay({ displayForm, textOptions, info, showingFormInfo, engl : chosenPersInf; useEffect(() => { if (length === "mini" && !("mini" in chosenPersInf)) { - setLength("long"); + setLength(defaultLength); } // setPersInf("mascSing"); // setShowingExplanation(false);