pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 1 | import getEmojiByName from "./getEmojiByName.js"; |
| 2 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 3 | function pageIndicator( |
| 4 | amount: number, |
| 5 | selected: number, |
| 6 | showDetails?: boolean | true |
| 7 | ) { |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 8 | let out = ""; |
| 9 | |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 10 | if (amount === 1) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 11 | out += getEmojiByName( |
| 12 | "TRACKS.SINGLE." + (selected === 0 ? "ACTIVE" : "INACTIVE") |
| 13 | ); |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 14 | } else { |
| 15 | for (let i = 0; i < amount; i++) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 16 | out += getEmojiByName( |
| 17 | "TRACKS.HORIZONTAL." + |
| 18 | (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") + |
| 19 | "." + |
| 20 | (i === selected ? "ACTIVE" : "INACTIVE") |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 21 | ); |
| 22 | } |
| 23 | } |
| 24 | if (showDetails) { |
| 25 | out += " Page " + selected + " of " + amount; |
| 26 | } |
| 27 | return out; |
| 28 | } |
| 29 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 30 | export default pageIndicator; |