Show hover effect on active time slot

This commit is contained in:
Benji Grant 2023-06-14 13:59:34 +10:00
parent 48d53e9b54
commit 9b5cbaa7e9
3 changed files with 17 additions and 4 deletions

View file

@ -98,6 +98,7 @@
background-origin: border-box;
transition: background-color .1s;
touch-action: none;
position: relative;
border-top-width: 2px;
border-top-style: solid;
@ -108,6 +109,13 @@
}
}
.nonEditable:hover::after {
content: '';
position: absolute;
inset: 0;
background-color: var(--highlight-color, rgba(0,0,0,.3));
}
.editable {
@media (hover: hover) {
&:hover:not(:active) {

View file

@ -83,6 +83,7 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) =
key={y}
className={makeClass(
styles.time,
styles.nonEditable,
(focusCount === undefined || focusCount === peopleHere.length) && highlight && (peopleHere.length === max || tempFocus) && peopleHere.length > 0 && styles.highlight,
)}
style={{

View file

@ -15,9 +15,13 @@ export const usePalette = (steps: number) => {
})
.format('rgba')
.map(([r, g, b, a]) => color(r, g, b, a / 255))
.map(c => ({
string: c.hex('rgba'),
highlight: c.luminance() > .5 ? c.darker().hex('rgba') : c.brighter().hex('rgba'),
})),
.map(c => {
let highlight = c.luminance() > .5 ? c.darker() : c.brighter()
highlight = highlight.alpha(highlight.alpha() + .3)
return {
string: c.hex('rgba'),
highlight: highlight.hex('rgba'),
}
}),
[steps, colormap])
}