blob: ccf18e280268248afe5b691fa6e89db2a987c1d0 [file] [log] [blame]
pineafan34369e62022-05-18 16:52:37 +01001import getEmojiByName from "./getEmojiByName.js";
2
Skyler Grey75ea9172022-08-06 10:22:23 +01003function pageIndicator(
4 amount: number,
5 selected: number,
6 showDetails?: boolean | true
7) {
pineafan34369e62022-05-18 16:52:37 +01008 let out = "";
9
pineafane23c4ec2022-07-27 21:56:27 +010010 if (amount === 1) {
Skyler Grey75ea9172022-08-06 10:22:23 +010011 out += getEmojiByName(
12 "TRACKS.SINGLE." + (selected === 0 ? "ACTIVE" : "INACTIVE")
13 );
pineafan34369e62022-05-18 16:52:37 +010014 } else {
15 for (let i = 0; i < amount; i++) {
Skyler Grey75ea9172022-08-06 10:22:23 +010016 out += getEmojiByName(
17 "TRACKS.HORIZONTAL." +
18 (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") +
19 "." +
20 (i === selected ? "ACTIVE" : "INACTIVE")
pineafan34369e62022-05-18 16:52:37 +010021 );
22 }
23 }
24 if (showDetails) {
25 out += " Page " + selected + " of " + amount;
26 }
27 return out;
28}
29
Skyler Grey75ea9172022-08-06 10:22:23 +010030export default pageIndicator;