Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Removed light mode from cairo-lang page #183

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading