Skip to content

Commit

Permalink
Add alternative forms list to entries
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
stscoundrel committed Nov 19, 2022
1 parent 10844e6 commit c8a0195
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ exports[`WordDefinition component -> full entry Matches snapshot 1`] = `
v.
</em>
</p>
<strong>
Alternative forms or notes:
</strong>
<ul
className="list"
>
<li>
-bortdrifva
</li>
</ul>
<p>
Possible runic inscription in
<em>
Expand Down
12 changes: 11 additions & 1 deletion src/components/WordDefinition/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface WordDefinitionProps{

export default function WordDefinition({ entry }: WordDefinitionProps) {
const {
headword, partOfSpeech, grammaticalAspect, definitions,
headword, partOfSpeech, grammaticalAspect, definitions, alternativeForms,
} = entry

return (
Expand Down Expand Up @@ -39,10 +39,20 @@ export default function WordDefinition({ entry }: WordDefinitionProps) {
&& <p><strong>Grammatical aspect:</strong> <em>{grammaticalAspect}</em></p>
}

{alternativeForms.length > 0
&& <>
<strong>Alternative forms or notes:</strong>
<ul className="list">
{alternativeForms.map((alternativeForm, index) => <li key={`alternativeForm-${index}`}>{alternativeForm}</li>)}
</ul>
</>
}

<p>Possible runic inscription in <em>Medieval Futhork</em>:
<span className={styles.rune}>{ lettersToRunes(headword) }</span><br />
<small>Medieval Runes were used in Sweden from 12th to 17th centuries.</small>
</p>

</article>
)
}
6 changes: 6 additions & 0 deletions src/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ html {

.blue {
color: $color-blue;
}

.list {
list-style: disc;
padding-left: 20px;
margin-bottom: 20px;
}
10 changes: 10 additions & 0 deletions tests/unit/pages/word/__snapshots__/word.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,16 @@ exports[`Word page: render & usage Matches snapshot 1`] = `
v.
</em>
</p>
<strong>
Alternative forms or notes:
</strong>
<ul
className="list"
>
<li>
-bortdrifva
</li>
</ul>
<p>
Possible runic inscription in
<em>
Expand Down

0 comments on commit c8a0195

Please sign in to comment.