Merge pull request #273 from GRA0007/fix/palette-bounds
Prevent colour index from escaping the bounds of the palette
This commit is contained in:
commit
999c629c93
|
|
@ -74,7 +74,7 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) =
|
|||
if (tempFocus) {
|
||||
peopleHere = peopleHere.filter(p => p === tempFocus)
|
||||
}
|
||||
const color = palette[tempFocus && peopleHere.length ? max : peopleHere.length - min]
|
||||
const color = palette[(tempFocus && peopleHere.length) ? Math.min(max, palette.length - 1) : Math.max(peopleHere.length - min, 0)]
|
||||
|
||||
return <div
|
||||
key={y}
|
||||
|
|
|
|||
Loading…
Reference in a new issue