diff options
| author | jackyzha0 <[email protected]> | 2021-03-05 22:17:18 -0800 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2021-03-05 22:17:18 -0800 |
| commit | 3e8500d466b641ef34c24f8b0de8163a44ba7a9e (patch) | |
| tree | ebb3411d636912b12f9fee14ecd494601cd796fc /frontend/src/components/Inputs/Code.js | |
| parent | remove extra langs (diff) | |
| download | ctrl-v-3e8500d466b641ef34c24f8b0de8163a44ba7a9e.tar.xz ctrl-v-3e8500d466b641ef34c24f8b0de8163a44ba7a9e.zip | |
refactoring css
Diffstat (limited to 'frontend/src/components/Inputs/Code.js')
| -rw-r--r-- | frontend/src/components/Inputs/Code.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/frontend/src/components/Inputs/Code.js b/frontend/src/components/Inputs/Code.js new file mode 100644 index 0000000..1353d95 --- /dev/null +++ b/frontend/src/components/Inputs/Code.js @@ -0,0 +1,35 @@ +import React, {useEffect, useRef} from "react"; +import * as indentation from "indent-textarea"; +import FloatingLabel from "../decorators/FloatingLabel"; +import CharLimit from "../decorators/CharLimit"; +import {RelPositioning} from "./shared"; + +export const Code = ({content, ...props}) => { + const textInput = useRef(null); + + useEffect(() => { + indentation.watch(textInput.current); + }, [textInput]) + + return ( + <RelPositioning> + <FloatingLabel + label="content" + id={props.id} + value={content} /> + <textarea + name="content" + readOnly={props.readOnly} + placeholder="Paste your text here" + value={content} + id={props.id} + ref={textInput} + required + onChange={props.onChange} + className="lt-shadow" /> + <CharLimit + content={content} + maxLength={props.maxLength} /> + </RelPositioning> + ); +}
\ No newline at end of file |