import React, { useEffect } from 'react' import Merge from 'react-codemirror-merge' import CodeMirror from '@uiw/react-codemirror' import * as shopify from '@shopify/lang-jsonc' import { ClientOnly } from 'remix-utils/client-only' import { ErrorBoundary } from 'react-error-boundary' import { githubDark, githubLight } from '@uiw/codemirror-theme-github' import { useState } from 'react' import { cn } from '~/utils/cn' import Fallback from './fallback' interface EditorProps { isDisabled?: boolean value: string onChange: (value: string) => void } export function Editor(props: EditorProps) { const [light, setLight] = useState(false) useEffect(() => { const theme = window.matchMedia('(prefers-color-scheme: light)') setLight(theme.matches) theme.addEventListener('change', (theme) => { setLight(theme.matches) }) }) return (
Failed to load the editor.

}> }> {() => ( props.onChange(value)} /> )}
) } interface DifferProps { left: string right: string } export function Differ(props: DifferProps) { const [light, setLight] = useState(false) useEffect(() => { const theme = window.matchMedia('(prefers-color-scheme: light)') setLight(theme.matches) theme.addEventListener('change', (theme) => { setLight(theme.matches) }) }) return (
{props.left === props.right ? (

No changes

) : ( Failed to load the editor.

}> }> {() => ( )}
)}
) }