diff options
author | 2021-05-30 12:23:17 -0400 | |
---|---|---|
committer | 2021-05-30 12:23:17 -0400 | |
commit | 2171021a76b4527845b51dc437a3101777f7fc0b (patch) | |
tree | c975a0b83a0b2bcb9843c232381e30081afe75e7 /src | |
parent | Merge branch 'main' of https://github.com/python-discord/forms-frontend into ... (diff) |
Update code field styling after pulling upstream
Diffstat (limited to 'src')
-rw-r--r-- | src/components/InputTypes/Code.tsx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/components/InputTypes/Code.tsx b/src/components/InputTypes/Code.tsx index ca02cb5..506e181 100644 --- a/src/components/InputTypes/Code.tsx +++ b/src/components/InputTypes/Code.tsx @@ -1,5 +1,5 @@ /** @jsx jsx */ -import { jsx } from "@emotion/react"; +import { jsx, css } from "@emotion/react"; import React, { useEffect } from "react"; import { basicSetup } from "@codemirror/basic-setup"; @@ -13,15 +13,23 @@ interface CodeProps { questionId: string, } +const styles = css` + border: 3px solid lightgray; + border-radius: 5px; + overflow:auto; + height: 20rem; +`; + export default function Code(props: CodeProps): JSX.Element { const onUpdate = () => EditorView.updateListener.of((v: ViewUpdate) => { props.handler(v.state.doc.toString()); + }); useEffect(() => { const el = document.getElementById(`${props.questionId}-code`); const state = EditorState.create({ - extensions: [basicSetup, python(), onUpdate(), oneDark] + extensions: [basicSetup, python(), onUpdate(), oneDark], }); const view = new EditorView({ state, @@ -31,7 +39,5 @@ export default function Code(props: CodeProps): JSX.Element { return () => view.destroy(); }, []); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return <div id={`${props.questionId}-code`}/>; + return <div id={`${props.questionId}-code`} css={styles} />; } |