From 248a9c7d3dfad2d4e2842043a975660bb68e314c Mon Sep 17 00:00:00 2001 From: melnikga Date: Mon, 15 Jul 2024 21:22:10 +0300 Subject: [PATCH] Removed light mode from cairo-lang page --- components/Editor/index.tsx | 6 +++--- pages/cairo-lang/index.tsx | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/Editor/index.tsx b/components/Editor/index.tsx index 02bcea6..c7e0804 100644 --- a/components/Editor/index.tsx +++ b/components/Editor/index.tsx @@ -101,12 +101,12 @@ const Editor = ({ readOnly = false, isCairoLangPage = false }: Props) => { useEffect(() => { // when theme is changed, we again set theme of editor - if (theme === 'dark') { + if (theme === 'dark' || isCairoLangPage) { monaco?.editor.setTheme('dark-theme') } else { monaco?.editor.setTheme('light-theme') } - }, [monaco?.editor, theme]) + }, [monaco?.editor, theme, isCairoLangPage]) const handleEditorDidMount = async ( editor: editor.IStandaloneCodeEditor, @@ -115,7 +115,7 @@ const Editor = ({ readOnly = false, isCairoLangPage = false }: Props) => { editorRef.current = editor registerCairoLanguageSupport(monaco as any) // once the editor is mounted we set the user selected theme - if (theme === 'dark') { + if (theme === 'dark' || isCairoLangPage) { monaco.editor.setTheme('dark-theme') } else { monaco.editor.setTheme('light-theme') diff --git a/pages/cairo-lang/index.tsx b/pages/cairo-lang/index.tsx index 7932839..7afcaad 100644 --- a/pages/cairo-lang/index.tsx +++ b/pages/cairo-lang/index.tsx @@ -1,6 +1,7 @@ import { useContext, useEffect } from 'react' import Head from 'next/head' +import { useTheme } from 'next-themes' import { AppUiContext } from 'context/appUiContext' @@ -8,10 +9,12 @@ import Editor from 'components/Editor' const CairoLangPage = () => { const { enableFullScreen } = useContext(AppUiContext) + const { setTheme } = useTheme() useEffect(() => { + setTheme('dark') enableFullScreen() - }, [enableFullScreen]) + }, [enableFullScreen, setTheme]) return ( <>