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

#461 Adding verse number to tooltip #473

Merged
merged 1 commit into from
Sep 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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