pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 1 | import getEmojiByName from "./getEmojiByName.js"; |
| 2 | |
TheCodedProf | c2acbcc | 2023-01-20 17:23:51 -0500 | [diff] [blame^] | 3 | function pageIndicator(amount: number, selected: number, showDetails?: boolean, disabled?: boolean | string) { |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 4 | let out = ""; |
TheCodedProf | c2acbcc | 2023-01-20 17:23:51 -0500 | [diff] [blame^] | 5 | disabled = disabled ? "GREY." : "" |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 6 | if (amount === 1) { |
TheCodedProf | c2acbcc | 2023-01-20 17:23:51 -0500 | [diff] [blame^] | 7 | out += getEmojiByName("TRACKS.SINGLE." + (disabled) + (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++) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 10 | out += getEmojiByName( |
| 11 | "TRACKS.HORIZONTAL." + |
TheCodedProf | c2acbcc | 2023-01-20 17:23:51 -0500 | [diff] [blame^] | 12 | (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") + |
| 13 | "." + (disabled) + |
| 14 | (i === selected ? "ACTIVE" : "INACTIVE") |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 15 | ); |
| 16 | } |
| 17 | } |
| 18 | if (showDetails) { |
| 19 | out += " Page " + selected + " of " + amount; |
| 20 | } |
| 21 | return out; |
| 22 | } |
| 23 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 24 | export default pageIndicator; |