Skip to content

Commit

Permalink
pass more config information to caller
Browse files Browse the repository at this point in the history
  • Loading branch information
zfletch committed May 6, 2021
1 parent 96d5b77 commit 9ced70c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 9 additions & 4 deletions src/lib/components/PartOfSpeech/PartOfSpeech.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ const renderLemma = (lemma) => (
</div>
);

const renderPostag = ([name, value]) => (
<div key={name} className={styles.container}>
<dt className={styles.dt}>{name}</dt>
<dd className={styles.dd}>{value}</dd>
// eslint-disable-next-line react/prop-types
const renderValue = ({ long, short, key }) => (
<dd className={styles.dd}>{long || short || key}</dd>
);

const renderPostag = ([{ long, short, key }, value]) => (
<div key={key} className={styles.container}>
<dt className={styles.dt}>{long || short || key}</dt>
{renderValue(value)}
</div>
);

Expand Down
5 changes: 2 additions & 3 deletions src/lib/utils/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] },
]);
}
});
Expand Down

0 comments on commit 9ced70c

Please sign in to comment.