File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { faCircleQuestion } from "@fortawesome/free-solid-svg-icons/faCircleQuestion" ;
22import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
3+ import { useEffect } from "preact/hooks" ;
34import "./cheatsheet.css" ;
45import type { CheatsheetInfo } from "./cheatsheet.types" ;
56import { cheatsheetLegendData } from "./utils/cheatsheetLegendData" ;
@@ -9,13 +10,15 @@ import CheatsheetNotesSection from "./CheatsheetNotesSection";
910import { applyBootstrapTheme } from "./utils/applyBootstrapTheme" ;
1011import SmartLink from "./utils/SmartLink" ;
1112
12- applyBootstrapTheme ( ) ;
13-
1413type Props = {
1514 cheatsheetInfo : CheatsheetInfo ;
1615} ;
1716
1817export function Cheatsheet ( { cheatsheetInfo } : Props ) {
18+ useEffect ( ( ) => {
19+ return applyBootstrapTheme ( ) ;
20+ } , [ ] ) ;
21+
1922 return (
2023 < main className = "cheatsheet" >
2124 < div className = "container-xxl pb-2" >
Original file line number Diff line number Diff line change 11export function applyBootstrapTheme ( ) {
2- console . log ( "hello" ) ;
32 const media = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
43
54 function applyTheme ( ) {
@@ -12,4 +11,8 @@ export function applyBootstrapTheme() {
1211 applyTheme ( ) ;
1312
1413 media . addEventListener ( "change" , applyTheme ) ;
14+
15+ return ( ) => {
16+ media . removeEventListener ( "change" , applyTheme ) ;
17+ } ;
1518}
Original file line number Diff line number Diff line change 1- import { Cheatsheet , defaultCheatsheetInfo } from "@cursorless/cheatsheet" ;
1+ import {
2+ Cheatsheet as OriginalCheatsheet ,
3+ defaultCheatsheetInfo ,
4+ } from "@cursorless/cheatsheet" ;
25
36export function Cheatsheet ( ) {
47 return (
58 < >
69 < title > Cursorless cheatsheet</ title >
7- < Cheatsheet cheatsheetInfo = { defaultCheatsheetInfo } />
10+ < OriginalCheatsheet cheatsheetInfo = { defaultCheatsheetInfo } />
811 </ >
912 ) ;
1013}
Original file line number Diff line number Diff line change 12811281 ]
12821282 },
12831283 "scripts" : {
1284- "build" : " pnpm run esbuild:prod && pnpm -F cheatsheet-local build:prod && pnpm -F cursorless-vscode-tutorial-webview build:prod && pnpm run populate-dist" ,
1285- "build:dev" : " pnpm generate-grammar && pnpm run esbuild && pnpm -F cheatsheet-local build && pnpm -F cursorless-vscode-tutorial-webview build && pnpm run populate-dist" ,
1284+ "build" : " pnpm run esbuild:prod && pnpm run populate-dist" ,
1285+ "build:dev" : " pnpm generate-grammar && pnpm run esbuild && pnpm run populate-dist" ,
12861286 "esbuild:base" : " bash ./scripts/compile-esbuild.sh" ,
12871287 "install-local" : " bash ./scripts/install-local.sh" ,
12881288 "install-from-pr" : " bash ./scripts/install-from-pr.sh" ,
13261326 "vscode-uri" : " ^3.1.0"
13271327 },
13281328 "devDependencies" : {
1329+ "@cursorless/cheatsheet-local" : " workspace:*" ,
1330+ "@cursorless/cursorless-vscode-tutorial-webview" : " workspace:*" ,
13291331 "@types/fs-extra" : " ^11.0.4" ,
13301332 "@types/js-yaml" : " ^4.0.9" ,
13311333 "@types/lodash-es" : " ^4.17.12" ,
You can’t perform that action at this time.
0 commit comments