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