Skip to content

Commit 99ff1d4

Browse files
authored
ui: Make source view sticky to screen size (#6085)
1 parent bb41939 commit 99ff1d4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ui/packages/shared/profile/src/ProfileView/components/VisualizationContainer/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ export const VisualizationContainer: FC<VisualizationContainerProps> = ({
5151
className={cx(
5252
'w-full min-h-96',
5353
snapshot.isDragging ? 'bg-gray-200 dark:bg-gray-500' : 'bg-inherit dark:bg-gray-900',
54-
isMultiPanelView ? 'border-2 border-gray-100 dark:border-gray-700 rounded-md p-3' : ''
54+
isMultiPanelView ? 'border-2 border-gray-100 dark:border-gray-700 rounded-md p-3' : '',
55+
dashboardItem === 'source' && isMultiPanelView ? 'sticky top-0 self-start' : ''
5556
)}
57+
style={
58+
dashboardItem === 'source' && isMultiPanelView
59+
? {maxHeight: 'calc(100vh - 50px)'}
60+
: undefined
61+
}
5662
>
5763
<VisualizationPanel
5864
handleClosePanel={handleClosePanel}

ui/packages/shared/profile/src/SourceView/Highlighter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ export const Highlighter = ({file, content, renderer}: HighlighterProps): JSX.El
218218
<div>Source</div>
219219
</div>
220220
</div>
221-
<div className="text-xs">
221+
<div className="text-xs overflow-auto" style={{maxHeight: 'calc(100vh - 200px)'}}>
222222
<SyntaxHighlighter
223223
language={language}
224224
style={isDarkMode ? atomOneDark : atomOneLight}
225225
showLineNumbers
226226
renderer={renderer}
227-
customStyle={{padding: 0, height: '90vh'}}
227+
customStyle={{padding: 0}}
228228
>
229229
{content}
230230
</SyntaxHighlighter>

0 commit comments

Comments
 (0)