MCPcopy
hub / github.com/facebook/react / ConfigEditor

Function ConfigEditor

compiler/apps/playground/components/Editor/ConfigEditor.tsx:31–70  ·  compiler/apps/playground/components/Editor/ConfigEditor.tsx::ConfigEditor
({
  appliedOptions,
}: {
  appliedOptions: PluginOptions | null;
})

Source from the content-addressed store, hash-verified

29loader.config({monaco});
30
31export default function ConfigEditor({
32 appliedOptions,
33}: {
34 appliedOptions: PluginOptions | null;
35}): React.ReactElement {
36 const [isExpanded, setIsExpanded] = useState(false);
37
38 return (
39 // TODO: Use <Activity> when it is compatible with Monaco: https://github.com/suren-atoyan/monaco-react/issues/753
40 <>
41 <div
42 style={{
43 display: isExpanded ? 'block' : 'none',
44 }}>
45 <ExpandedEditor
46 onToggle={() => {
47 startTransition(() => {
48 addTransitionType(CONFIG_PANEL_TRANSITION);
49 setIsExpanded(false);
50 });
51 }}
52 appliedOptions={appliedOptions}
53 />
54 </div>
55 <div
56 style={{
57 display: !isExpanded ? 'block' : 'none',
58 }}>
59 <CollapsedEditor
60 onToggle={() => {
61 startTransition(() => {
62 addTransitionType(CONFIG_PANEL_TRANSITION);
63 setIsExpanded(true);
64 });
65 }}
66 />
67 </div>
68 </>
69 );
70}
71
72function ExpandedEditor({
73 onToggle,

Callers

nothing calls this directly

Calls 3

useStateFunction · 0.90
startTransitionFunction · 0.90
addTransitionTypeFunction · 0.85

Tested by

no test coverage detected