diff --git a/src/Components/TextArea.tsx b/src/Components/TextArea.tsx index 34fbc3a..ba86e31 100644 --- a/src/Components/TextArea.tsx +++ b/src/Components/TextArea.tsx @@ -1,11 +1,12 @@ import styled from "styled-components"; export const TextArea = styled.textarea` - flex: 1; border: none; resize: none; background-color: transparent; color: #fafafa; + width: 100%; + height: 100%; padding: 10px; &:focus { diff --git a/src/Editor/index.tsx b/src/Editor/index.tsx index e47ed8b..19e2fd5 100644 --- a/src/Editor/index.tsx +++ b/src/Editor/index.tsx @@ -1,4 +1,4 @@ -import { FC } from "react"; +import { createRef, FC, useEffect, useRef } from "react"; import { Editor as MonacoEditor } from "@monaco-editor/react"; import { useRecoilState } from "recoil"; import { EditorValueState } from "../GlobalStates/EditorValueState"; @@ -6,9 +6,26 @@ import { motion } from "framer-motion"; export const Editor: FC = () => { const [value, setValue] = useRecoilState(EditorValueState) + const ref = useRef() + const containerRef = createRef() + + useEffect(() => { + window.addEventListener('resize', () => { + ref.current?.layout({ width: 0, height: 0 }) + + window.requestAnimationFrame(() => { + const rect = containerRef.current?.getBoundingClientRect() + ref.current?.layout({ + width: rect?.width ?? 0, + height: rect?.height ?? 0 + }) + }) + }) + }, []) return ( @@ -16,6 +33,7 @@ export const Editor: FC = () => { loading={<>} value={value} language="yaml" + onMount={(v) => ref.current = v} onChange={(v) => setValue(v ?? '')} options={{ automaticLayout: true, diff --git a/src/TransformGridItem/index.tsx b/src/TransformGridItem/index.tsx index cd7a4e0..3ac9fbe 100644 --- a/src/TransformGridItem/index.tsx +++ b/src/TransformGridItem/index.tsx @@ -15,6 +15,7 @@ import { WrappedTransformResult } from "../Transforms/Transform"; import { useLocalStorage } from "@uidotdev/usehooks"; +import { AnimatePresence, motion } from "framer-motion"; interface TransformGridItemProp { transform: WrappedTransform @@ -169,13 +170,21 @@ export const TransformGridItem: FC = ({ transform }) => { - {!closed && -