From 23b7b5d45a7755ace4ba26591a9897832bebc0b6 Mon Sep 17 00:00:00 2001
From: lingdocs <71590811+lingdocs@users.noreply.github.com>
Date: Thu, 24 Jun 2021 12:51:52 +0400
Subject: [PATCH] bug where we lost the rtl direction on JSX Pashto text
---
package.json | 2 +-
src/components/Pashto.tsx | 18 ++++++++++--------
src/components/Phonetics.tsx | 8 +++-----
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/package.json b/package.json
index 28f6769..d7f5c00 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
- "version": "0.4.5",
+ "version": "0.4.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/Pashto.tsx b/src/components/Pashto.tsx
index 7bad88a..b64388c 100644
--- a/src/components/Pashto.tsx
+++ b/src/components/Pashto.tsx
@@ -27,19 +27,21 @@ const Pashto = ({ opts, children: text }: {
? p
: convertAfToPkSpelling(p);
}
- if (typeof text.p !== "string" && typeof text.f !== "string") {
- return psJSXMap(
- text as T.PsJSX,
- "p",
- (ps: T.PsString) => convertText(ps, opts),
- );
- }
const style = opts.pTextSize === "normal"
? undefined
: { fontSize: opts.pTextSize === "larger" ? "large" : "larger" };
return (
- {convertText(text as T.PsString, opts)}
+ {(typeof text.p !== "string" && typeof text.f !== "string")
+ ?
+ psJSXMap(
+ text as T.PsJSX,
+ "p",
+ (ps: T.PsString) => convertText(ps, opts),
+ )
+ :
+ convertText(text as T.PsString, opts)
+ }
);
};
diff --git a/src/components/Phonetics.tsx b/src/components/Phonetics.tsx
index b6577d2..9d6d19d 100644
--- a/src/components/Phonetics.tsx
+++ b/src/components/Phonetics.tsx
@@ -28,12 +28,10 @@ const Phonetics = ({ opts, children: text }: {
system: opts.phonetics,
})
);
- if (typeof text !== "string" && typeof text.f !== "string") {
- return psJSXMap(text as T.PsJSX, "f", ({f}) => handleText(f));
- }
- const f = typeof text === "string" ? text : text.f as string;
return
- {handleText(f)}
+ {(typeof text !== "string" && typeof text.f !== "string")
+ ? psJSXMap(text as T.PsJSX, "f", ({f}) => handleText(f))
+ : handleText(typeof text === "string" ? text : text.f as string)}
};