@@ -6,6 +6,7 @@ import { h } from 'preact'; // eslint-disable-line @typescript-eslint/no-unused-
6
6
import type * as Hooks from 'preact/hooks' ;
7
7
import { DOCUMENT , WINDOW } from '../../constants' ;
8
8
import CropCornerFactory from './CropCorner' ;
9
+ import PenIconFactory from './PenIcon' ;
9
10
import { createScreenshotInputStyles } from './ScreenshotInput.css' ;
10
11
import { useTakeScreenshotFactory } from './useTakeScreenshot' ;
11
12
@@ -72,10 +73,11 @@ export function ScreenshotEditorFactory({
72
73
options,
73
74
} : FactoryParams ) : ComponentType < Props > {
74
75
const useTakeScreenshot = useTakeScreenshotFactory ( { hooks } ) ;
76
+ const CropCorner = CropCornerFactory ( { h } ) ;
77
+ const PenIcon = PenIconFactory ( { h } ) ;
75
78
76
79
return function ScreenshotEditor ( { onError } : Props ) : VNode {
77
80
const styles = hooks . useMemo ( ( ) => ( { __html : createScreenshotInputStyles ( options . styleNonce ) . innerText } ) , [ ] ) ;
78
- const CropCorner = CropCornerFactory ( { h } ) ;
79
81
80
82
const canvasContainerRef = hooks . useRef < HTMLDivElement > ( null ) ;
81
83
const cropContainerRef = hooks . useRef < HTMLDivElement > ( null ) ;
@@ -397,14 +399,25 @@ export function ScreenshotEditorFactory({
397
399
< div class = "editor" >
398
400
< style nonce = { options . styleNonce } dangerouslySetInnerHTML = { styles } />
399
401
{ options . _experiments . annotations && (
400
- < button
401
- class = "editor__pen-tool"
402
- style = { { background : isAnnotating ? 'red' : 'white' } }
403
- onClick = { e => {
404
- e . preventDefault ( ) ;
405
- setIsAnnotating ( ! isAnnotating ) ;
406
- } }
407
- > </ button >
402
+ < div class = "editor__tool-container" >
403
+ < button
404
+ class = "editor__pen-tool"
405
+ style = { {
406
+ background : isAnnotating
407
+ ? 'var(--button-primary-background, var(--accent-background))'
408
+ : 'var(--button-background, var(--background))' ,
409
+ color : isAnnotating
410
+ ? 'var(--button-primary-foreground, var(--accent-foreground))'
411
+ : 'var(--button-foreground, var(--foreground))' ,
412
+ } }
413
+ onClick = { e => {
414
+ e . preventDefault ( ) ;
415
+ setIsAnnotating ( ! isAnnotating ) ;
416
+ } }
417
+ >
418
+ < PenIcon />
419
+ </ button >
420
+ </ div >
408
421
) }
409
422
< div class = "editor__canvas-container" ref = { canvasContainerRef } >
410
423
< div class = "editor__crop-container" style = { { zIndex : isAnnotating ? 1 : 2 } } ref = { cropContainerRef } >
0 commit comments