Skip to content

Commit

Permalink
Merge pull request #183 from melnikga/bug/remove-light-mode
Browse files Browse the repository at this point in the history
Bug: Removed light mode from cairo-lang page
  • Loading branch information
mazurroman authored Jul 16, 2024
2 parents e8152ec + 248a9c7 commit ebfbe2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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')
Expand Down
5 changes: 4 additions & 1 deletion pages/cairo-lang/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { useContext, useEffect } from 'react'

import Head from 'next/head'
import { useTheme } from 'next-themes'

import { AppUiContext } from 'context/appUiContext'

import Editor from 'components/Editor'

const CairoLangPage = () => {
const { enableFullScreen } = useContext(AppUiContext)
const { setTheme } = useTheme()

useEffect(() => {
setTheme('dark')
enableFullScreen()
}, [enableFullScreen])
}, [enableFullScreen, setTheme])

return (
<>
Expand Down

0 comments on commit ebfbe2b

Please sign in to comment.