Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | import React from "react"; import styled, { css } from "styled-components"; interface RollChannelHoverProps { cellSize: number; hoverColumn: number | null; hoverRow: number | null; } interface WrapperProps { $rows: number; $cols: number; $size: number; } interface HorizontalHoverProps { $row: number; $size: number; } interface VerticalHoverProps { $col: number; $size: number; } const numRows = 12 * 6; const numCols = 64; const Wrapper = styled.div<WrapperProps>` position: absolute; top: 0; overflow: hidden; pointer-events: none; ${(props) => css` margin: 0 ${3 * props.$size}px ${2 * props.$size}px 10px; width: ${props.$cols * props.$size}px; height: ${props.$rows * props.$size}px; `} `; const HorizontalHover = styled.div<HorizontalHoverProps>` position: absolute; left: 0; ${(props) => css` background: ${props.theme.colors.tracker.rollCell.border}; opacity: 0.3; top: ${(numCols - props.$row + 7) * props.$size}px; width: 100%; height: ${props.$size}px; `} `; const VerticalHover = styled.div<VerticalHoverProps>` position: absolute; top: 0; ${(props) => css` background: ${props.theme.colors.tracker.rollCell.border}; opacity: 0.3; left: ${props.$col * props.$size}px; width: ${props.$size}px; height: 100%; `} `; export const RollChannelHover = ({ cellSize, hoverColumn, hoverRow, }: RollChannelHoverProps) => { Iif (hoverColumn === null || hoverRow == null) { return null; } return ( <Wrapper $rows={numRows} $cols={numCols} $size={cellSize}> <HorizontalHover $row={hoverRow} $size={cellSize} /> <VerticalHover $col={hoverColumn} $size={cellSize} /> </Wrapper> ); }; |