Increase size of input in test setting logic function tab (#18369)
## Before <img width="1031" height="836" alt="image" src="https://github.com/user-attachments/assets/475ca1be-f7c4-49d0-b329-649dbe8da489" /> ## After <img width="1195" height="862" alt="image" src="https://github.com/user-attachments/assets/b1bac131-e562-4439-8f8e-bda4d6e2a646" /> --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { styled } from '@linaria/react';
|
||||
import Editor, { type EditorProps, type Monaco } from '@monaco-editor/react';
|
||||
import { Loader } from '@ui/feedback/loader/components/Loader';
|
||||
import { ResizeHandle } from '@ui/layout/resize-handle/components/ResizeHandle';
|
||||
import { BASE_CODE_EDITOR_THEME_ID } from '@ui/input/code-editor/constants/BaseCodeEditorThemeId';
|
||||
import { useResizeHandle } from '@ui/layout/resize-handle/hooks/useResizeHandle';
|
||||
import { getBaseCodeEditorTheme } from '@ui/input/code-editor/theme/utils/getBaseCodeEditorTheme';
|
||||
import { ThemeContext } from '@ui/theme';
|
||||
import { themeCssVariables } from '@ui/theme-constants';
|
||||
@@ -20,6 +22,7 @@ type CodeEditorProps = Pick<
|
||||
variant?: CodeEditorVariant;
|
||||
isLoading?: boolean;
|
||||
transparentBackground?: boolean;
|
||||
resizable?: boolean;
|
||||
};
|
||||
|
||||
const StyledEditorLoader = styled.div<{
|
||||
@@ -118,6 +121,7 @@ export const CodeEditor = ({
|
||||
transparentBackground,
|
||||
isLoading = false,
|
||||
options,
|
||||
resizable = false,
|
||||
}: CodeEditorProps) => {
|
||||
const { theme } = useContext(ThemeContext);
|
||||
const [monaco, setMonaco] = useState<Monaco | undefined>(undefined);
|
||||
@@ -126,6 +130,18 @@ export const CodeEditor = ({
|
||||
>(undefined);
|
||||
const [isEditorFocused, setIsEditorFocused] = useState(false);
|
||||
|
||||
const numericHeight = typeof height === 'number' ? height : 450;
|
||||
const {
|
||||
size: resizableHeight,
|
||||
handleResizeStart,
|
||||
handleResizeMove,
|
||||
handleResizeEnd,
|
||||
} = useResizeHandle({
|
||||
initialSize: numericHeight,
|
||||
});
|
||||
|
||||
const currentHeight = resizable ? resizableHeight : height;
|
||||
|
||||
const setModelMarkers = (
|
||||
editor: editor.IStandaloneCodeEditor | undefined,
|
||||
monaco: Monaco | undefined,
|
||||
@@ -147,7 +163,7 @@ export const CodeEditor = ({
|
||||
};
|
||||
|
||||
return isLoading ? (
|
||||
<StyledEditorLoader height={height} variant={variant}>
|
||||
<StyledEditorLoader height={currentHeight} variant={variant}>
|
||||
<Loader />
|
||||
</StyledEditorLoader>
|
||||
) : (
|
||||
@@ -163,7 +179,7 @@ export const CodeEditor = ({
|
||||
transparentBackground={transparentBackground}
|
||||
>
|
||||
<Editor
|
||||
height={height}
|
||||
height={currentHeight}
|
||||
value={value}
|
||||
language={language}
|
||||
loading=""
|
||||
@@ -213,6 +229,13 @@ export const CodeEditor = ({
|
||||
}}
|
||||
/>
|
||||
</StyledEditorWrapper>
|
||||
{resizable && (
|
||||
<ResizeHandle
|
||||
onPointerDown={handleResizeStart}
|
||||
onPointerMove={handleResizeMove}
|
||||
onPointerUp={handleResizeEnd}
|
||||
/>
|
||||
)}
|
||||
</StyledCodeEditorContainer>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user