Skip to content

Commit f916e2e

Browse files
fix: reviews
1 parent dc6eb70 commit f916e2e

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

src/components/YamlEditor/YamlEditor.jsx renamed to src/components/YamlEditor/YamlEditor.tsx

+26-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { React, useState, useEffect } from "react";
1+
import React, { useState, useEffect } from "react";
22

33
import AceEditor from "react-ace";
44
import "ace-builds/src-noconflict/theme-github";
@@ -15,13 +15,7 @@ const ajv = new Ajv({ allErrors: true });
1515
import Schema from "../../../static/schema/schema.v2.json";
1616

1717
const validate = ajv.compile(Schema.definitions.schema);
18-
19-
export default function YamlEditor() {
20-
const [value, setValue] = useState("");
21-
const [annotations, setAnnotations] = useState([]);
22-
23-
useEffect(() => {
24-
const initialValue = `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
18+
const initialValue = `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
2519
language: "en-US"
2620
early_access: false
2721
reviews:
@@ -38,6 +32,11 @@ chat:
3832
auto_reply: true
3933
4034
`;
35+
export default function YamlEditor() {
36+
const [value, setValue] = useState(initialValue);
37+
const [annotations, setAnnotations] = useState([]);
38+
39+
useEffect(() => {
4140
setValue(initialValue);
4241
validateAndSetAnnotations(initialValue);
4342
}, []);
@@ -135,21 +134,24 @@ chat:
135134
}
136135

137136
return (
138-
<AceEditor
139-
mode="yaml"
140-
theme="github"
141-
onChange={onChange}
142-
value={value}
143-
name="yaml-editor"
144-
editorProps={{ $blockScrolling: true }}
145-
setOptions={{
146-
useWorker: false,
147-
showPrintMargin: false,
148-
showGutter: true,
149-
}}
150-
annotations={annotations}
151-
width="100%"
152-
height="400px"
153-
/>
137+
<div className="m4">
138+
<AceEditor
139+
mode="yaml"
140+
theme="github"
141+
onChange={onChange}
142+
value={value}
143+
name="yaml-editor"
144+
editorProps={{ $blockScrolling: true }}
145+
setOptions={{
146+
useWorker: false,
147+
showPrintMargin: false,
148+
showGutter: true,
149+
}}
150+
annotations={annotations}
151+
width="100%"
152+
height="400px"
153+
/>
154+
<br />
155+
</div>
154156
);
155157
}

0 commit comments

Comments
 (0)