pass theme as context
This commit is contained in:
parent
ba56edf588
commit
8f497cae85
5 changed files with 37 additions and 41 deletions
|
@ -1,5 +1,5 @@
|
|||
import {hslToString, Theme} from '../theme.ts';
|
||||
import {useEffect, useRef} from 'react';
|
||||
import {hslToString, ThemeContext} from '../theme.ts';
|
||||
import {useContext, useEffect, useRef} from 'react';
|
||||
import './PixelGridCanvas.css';
|
||||
|
||||
const pixelsPerRow = 352;
|
||||
|
@ -104,10 +104,10 @@ function drawPixelsToCanvas(
|
|||
context.putImageData(imageData, 0, 0);
|
||||
}
|
||||
|
||||
export default function PixelGridCanvas({pixels, theme}: {
|
||||
export default function PixelGridCanvas({pixels}: {
|
||||
readonly pixels: Uint8ClampedArray;
|
||||
readonly theme: Theme;
|
||||
}) {
|
||||
const theme = useContext(ThemeContext);
|
||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue