| 11 | * Generate random data for use in examples. |
| 12 | */ |
| 13 | export function generateRandomList(count = 1000): ListItem[] { |
| 14 | const list: ListItem[] = []; |
| 15 | |
| 16 | for (let i = 0; i < count; i++) { |
| 17 | const random = LOREM_IPSUM[i % LOREM_IPSUM.length]; |
| 18 | const randoms = [random]; |
| 19 | |
| 20 | for (let j = Math.round(Math.random() * 10); j--; ) { |
| 21 | randoms.push(LOREM_IPSUM[(i * j) % LOREM_IPSUM.length]); |
| 22 | } |
| 23 | |
| 24 | list.push({ |
| 25 | color: BADGE_COLORS[i % BADGE_COLORS.length], |
| 26 | index: i, |
| 27 | name: NAMES[i % NAMES.length], |
| 28 | random, |
| 29 | randomLong: randoms.join(" "), |
| 30 | size: ROW_HEIGHTS[Math.floor(Math.random() * ROW_HEIGHTS.length)] |
| 31 | }); |
| 32 | } |
| 33 | |
| 34 | return list; |
| 35 | } |
| 36 | |
| 37 | const BADGE_COLORS = [ |
| 38 | "#f44336", |