File tree Expand file tree Collapse file tree 2 files changed +29
-12
lines changed Expand file tree Collapse file tree 2 files changed +29
-12
lines changed Original file line number Diff line number Diff line change 19
19
--site-color-tooltip-background : # 353738 ;
20
20
--site-color-svg-icon-favorite : # e9669e ;
21
21
--site-color-checkbox-checked-bg : hsl (167deg 56% 73% / 25% );
22
- --site-color-feedback-background : # fff ;
22
+ --site-color-feedback-background : # f0f8ff ;
23
23
--docusaurus-highlighted-code-line-bg : rgb (0 0 0 / 10% );
24
24
/* Use a darker color to ensure contrast, ideally we don't need important */
25
25
--ifm-breadcrumb-color-active : var (--ifm-color-primary-darker ) !important ;
26
26
--ifm-menu-color-active : var (--ifm-color-primary-darker ) !important ;
27
27
}
28
28
29
29
html [data-theme = 'dark' ] {
30
- --site-color-feedback-background : # f0f8ff ;
30
+ --site-color-feedback-background : # 2a2929 ;
31
31
--site-color-favorite-background : # 1d1e1e ;
32
32
--site-color-checkbox-checked-bg : hsl (167deg 56% 73% / 10% );
33
33
--docusaurus-highlighted-code-line-bg : rgb (66 66 66 / 35% );
Original file line number Diff line number Diff line change 7
7
8
8
import React , { useEffect } from 'react' ;
9
9
import clsx from 'clsx' ;
10
+ import { useColorMode } from '@docusaurus/theme-common' ;
10
11
import Layout from '@theme/Layout' ;
11
12
12
13
import cannyScript from './cannyScript' ;
13
14
import styles from './styles.module.css' ;
14
15
15
16
const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91' ;
16
17
17
- export default function FeatureRequests ( {
18
- basePath,
19
- } : {
20
- basePath : string ;
21
- } ) : JSX . Element {
18
+ function useCannyTheme ( ) {
19
+ const { colorMode} = useColorMode ( ) ;
20
+ return colorMode === 'light' ? 'light' : 'dark' ;
21
+ }
22
+
23
+ function CannyWidget ( { basePath} : { basePath : string } ) {
22
24
useEffect ( ( ) => {
23
25
cannyScript ( ) ;
26
+ } , [ ] ) ;
27
+
28
+ const theme = useCannyTheme ( ) ;
29
+ useEffect ( ( ) => {
24
30
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25
31
const { Canny} = window as any ;
26
32
Canny ( 'render' , {
27
33
boardToken : BOARD_TOKEN ,
28
34
basePath,
35
+ theme,
29
36
} ) ;
30
- } , [ basePath ] ) ;
37
+ } , [ basePath , theme ] ) ;
38
+ return (
39
+ < main
40
+ key = { theme } // widget needs a full reset: unable to update the theme
41
+ className = { clsx ( 'container' , 'margin-vert--lg' , styles . main ) }
42
+ data-canny
43
+ />
44
+ ) ;
45
+ }
31
46
47
+ export default function FeatureRequests ( {
48
+ basePath,
49
+ } : {
50
+ basePath : string ;
51
+ } ) : JSX . Element {
32
52
return (
33
53
< Layout title = "Feedback" description = "Docusaurus 2 Feature Requests page" >
34
- < main
35
- className = { clsx ( 'container' , 'margin-vert--lg' , styles . main ) }
36
- data-canny
37
- />
54
+ < CannyWidget basePath = { basePath } />
38
55
</ Layout >
39
56
) ;
40
57
}
You can’t perform that action at this time.
0 commit comments