mirror of
https://github.com/bspeice/speice.io
synced 2024-12-22 16:48:10 -05:00
Formatting tweak
This commit is contained in:
parent
f643996128
commit
192286a86a
@ -1,6 +1,5 @@
|
|||||||
import React, {useEffect, useState, createContext, useRef} from "react";
|
import React, {useEffect, useState, createContext, useRef} from "react";
|
||||||
import {useColorMode} from "@docusaurus/theme-common";
|
import {useColorMode} from "@docusaurus/theme-common";
|
||||||
import BrowserOnly from "@docusaurus/BrowserOnly";
|
|
||||||
|
|
||||||
type PainterProps = {
|
type PainterProps = {
|
||||||
width: number;
|
width: number;
|
||||||
@ -76,13 +75,18 @@ export const Canvas: React.FC<CanvasProps> = ({style, children}) => {
|
|||||||
}
|
}
|
||||||
}, [painter]);
|
}, [painter]);
|
||||||
|
|
||||||
const filter = useColorMode().colorMode === 'dark' ? 'invert(1)' : '';
|
const canvasProps = {
|
||||||
|
ref: canvasRef,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
style: {filter: useColorMode().colorMode === 'dark' ? 'invert(1)' : ''}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<center>
|
<center>
|
||||||
<div ref={sizingRef} style={style}>
|
<div ref={sizingRef} style={style}>
|
||||||
{width > 0 ? <canvas ref={canvasRef} width={width} height={height} style={{filter}}/> : null}
|
{width > 0 ? <canvas {...canvasProps}/> : null}
|
||||||
</div>
|
</div>
|
||||||
</center>
|
</center>
|
||||||
<PainterContext.Provider value={{width, height, setPainter}}>
|
<PainterContext.Provider value={{width, height, setPainter}}>
|
||||||
|
Loading…
Reference in New Issue
Block a user