shortDefault option on VerbFormDisplay

This commit is contained in:
Bill D 2021-04-14 14:26:10 +03:00
parent 0d67166b33
commit 620fa26d62
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "0.3.5", "version": "0.3.6",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -39,15 +39,17 @@ function agreementInfo(info: T.NonComboVerbInfo, displayForm: T.DisplayForm): Re
return <><strong>Note:</strong> {beginning}<strong>{agreesWith}</strong>{extraExplanation}</> return <><strong>Note:</strong> {beginning}<strong>{agreesWith}</strong>{extraExplanation}</>
} }
function VerbFormDisplay({ displayForm, textOptions, info, showingFormInfo, english }: { function VerbFormDisplay({ displayForm, textOptions, info, showingFormInfo, english, shortDefault }: {
displayForm: T.DisplayForm | T.VerbForm, displayForm: T.DisplayForm | T.VerbForm,
english?: T.EnglishBlock | string, english?: T.EnglishBlock | string,
textOptions: T.TextOptions, textOptions: T.TextOptions,
showingFormInfo: boolean, showingFormInfo: boolean,
info?: T.NonComboVerbInfo, info?: T.NonComboVerbInfo,
shortDefault?: boolean,
}) { }) {
const defaultLength = shortDefault ? "short" : "long";
const [persInf, setPersInf] = useState<T.PersonInflectionsField>("mascSing"); const [persInf, setPersInf] = useState<T.PersonInflectionsField>("mascSing");
const [length, setLength] = useState<T.Length>("long"); const [length, setLength] = useState<T.Length>(defaultLength);
const [showingExplanation, setShowingExplanation] = useState<boolean>(false); const [showingExplanation, setShowingExplanation] = useState<boolean>(false);
const block = "label" in displayForm ? displayForm.form : displayForm; const block = "label" in displayForm ? displayForm.form : displayForm;
const chosenPersInf = "mascSing" in block const chosenPersInf = "mascSing" in block
@ -58,7 +60,7 @@ function VerbFormDisplay({ displayForm, textOptions, info, showingFormInfo, engl
: chosenPersInf; : chosenPersInf;
useEffect(() => { useEffect(() => {
if (length === "mini" && !("mini" in chosenPersInf)) { if (length === "mini" && !("mini" in chosenPersInf)) {
setLength("long"); setLength(defaultLength);
} }
// setPersInf("mascSing"); // setPersInf("mascSing");
// setShowingExplanation(false); // setShowingExplanation(false);