diff --git a/src/components/FixedHeightQuery/FixedHeightQuery.scss b/src/components/FixedHeightQuery/FixedHeightQuery.scss index 02fa7124df..e61f2cad7d 100644 --- a/src/components/FixedHeightQuery/FixedHeightQuery.scss +++ b/src/components/FixedHeightQuery/FixedHeightQuery.scss @@ -23,7 +23,7 @@ height: 100% !important; margin: 0 !important; - padding: var(--g-spacing-2) !important; + padding: 0 !important; white-space: pre-wrap !important; text-overflow: ellipsis !important; @@ -39,4 +39,8 @@ word-break: break-word !important; } } + .ydb-syntax-highlighter__copy { + top: 0; + right: 0; + } } diff --git a/src/components/FixedHeightQuery/FixedHeightQuery.tsx b/src/components/FixedHeightQuery/FixedHeightQuery.tsx index 1eefe60f90..3af165a8fd 100644 --- a/src/components/FixedHeightQuery/FixedHeightQuery.tsx +++ b/src/components/FixedHeightQuery/FixedHeightQuery.tsx @@ -7,14 +7,17 @@ import './FixedHeightQuery.scss'; const b = cn('ydb-fixed-height-query'); -const FIXED_PADDING = 8; +const FIXED_PADDING = 0; const LINE_HEIGHT = 20; +type FixedHeightQueryMode = 'fixed' | 'max'; + interface FixedHeightQueryProps { value?: string; lines?: number; hasClipboardButton?: boolean; clipboardButtonAlwaysVisible?: boolean; + mode?: FixedHeightQueryMode; } export const FixedHeightQuery = ({ @@ -22,18 +25,21 @@ export const FixedHeightQuery = ({ lines = 4, hasClipboardButton, clipboardButtonAlwaysVisible, + mode = 'fixed', }: FixedHeightQueryProps) => { const heightValue = `${lines * LINE_HEIGHT + FIXED_PADDING}px`; // Remove empty lines from the beginning (lines with only whitespace are considered empty) const trimmedValue = value.replace(/^(\s*\n)+/, ''); + const heightStyle = mode === 'fixed' ? {height: heightValue} : {maxHeight: heightValue}; + return (