From 9ced70cce263d0c4d757c5c6eed44074a2fdcd49 Mon Sep 17 00:00:00 2001 From: zfletch Date: Thu, 6 May 2021 15:14:01 -0400 Subject: [PATCH] pass more config information to caller --- src/lib/components/PartOfSpeech/PartOfSpeech.js | 13 +++++++++---- src/lib/utils/config/config.js | 5 ++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/components/PartOfSpeech/PartOfSpeech.js b/src/lib/components/PartOfSpeech/PartOfSpeech.js index 63c629e..897e956 100644 --- a/src/lib/components/PartOfSpeech/PartOfSpeech.js +++ b/src/lib/components/PartOfSpeech/PartOfSpeech.js @@ -14,10 +14,15 @@ const renderLemma = (lemma) => ( ); -const renderPostag = ([name, value]) => ( -
-
{name}
-
{value}
+// eslint-disable-next-line react/prop-types +const renderValue = ({ long, short, key }) => ( +
{long || short || key}
+); + +const renderPostag = ([{ long, short, key }, value]) => ( +
+
{long || short || key}
+ {renderValue(value)}
); diff --git a/src/lib/utils/config/config.js b/src/lib/utils/config/config.js index ada397d..4614c09 100644 --- a/src/lib/utils/config/config.js +++ b/src/lib/utils/config/config.js @@ -30,14 +30,13 @@ class Configuration { postagSchema.forEach((type, index) => { const attribute = attributes[type]; - const name = attribute.long || attribute.short || type; const values = Object.entries(attribute.values); const match = values.find(([, { postag: abbreviation }]) => abbreviation === postag[index]); if (match) { deconstructedPostag.push([ - name, - match[1].long || match[1].short || match[0], + { long: attribute.long, short: attribute.short, key: type }, + { long: match[1].long, short: match[1].short, key: match[0] }, ]); } });