Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Fixes #461 (#473)
Browse files Browse the repository at this point in the history
#461 Adding verse number to tooltip
  • Loading branch information
mmahalwy authored Sep 3, 2016
1 parent 7094284 commit 9fe9417
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/Ayah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ export default class Ayah extends Component {

// position is important as it will differentiate between words and symbols, see 2:25:13
let position = -1;
let text = ayah.words.map(word => {
let text = ayah.words.map((word, index) => {
let id = null;
const isLast = ayah.words.length === index + 1;
const className = `${word.className} ${word.highlight ? word.highlight : ''}`;

if (word.charTypeId === CHAR_TYPE_WORD) {
Expand All @@ -119,14 +120,16 @@ export default class Ayah extends Component {
);
}

const label = isLast ? {'aria-label': `Verse ${ayah.ayahNum}`} : {}
return (
<b
id={id}
onClick={(event) => onWordClick(event.target.dataset.key)}
data-key={`${word.ayahKey}:${position}`}
className={`${className} pointer`}
className={`${className} ${isLast && styles.Tooltip} pointer`}
key={word.code}
dangerouslySetInnerHTML={{__html: word.code}}
{...label}
/>
);
});
Expand Down

0 comments on commit 9fe9417

Please sign in to comment.