Prevent colour index from escaping the bounds of the palette
This commit is contained in:
parent
08f6646339
commit
597fbddee8
|
|
@ -74,7 +74,7 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) =
|
||||||
if (tempFocus) {
|
if (tempFocus) {
|
||||||
peopleHere = peopleHere.filter(p => p === 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
|
return <div
|
||||||
key={y}
|
key={y}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue