Skip to content

Commit 738d253

Browse files
author
ci-bot
committed
fix bottom btn position
1 parent fe61863 commit 738d253

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

apps/remix-ide/src/app/components/styles/bottom-bar.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
padding: 4px 16px;
66
background-color: var(--bs-light) !important;
77
height: 32px;
8+
position: sticky;
9+
top: 0;
10+
z-index: 10;
811
}
912

1013
.bottom-bar .explain-icon {

libs/remix-ui/panel/src/lib/main/main-panel.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const RemixUIMainPanel = (props: RemixUIMainPanelProps) => {
1818
const mainPanelRef = useRef<HTMLDivElement>(null)
1919
const tabsRef = useRef<HTMLDivElement>(null)
2020
const terminalRef = useRef<HTMLDivElement>(null)
21+
const bottomBarRef = useRef<HTMLDivElement>(null)
2122

2223
const refs = [tabsRef, editorRef, mainPanelRef, terminalRef]
2324

@@ -56,18 +57,47 @@ const RemixUIMainPanel = (props: RemixUIMainPanelProps) => {
5657
}
5758

5859
const resize = (height: number) => {
60+
syncBottomBarPosition()
5961
layout.emit('resize', height)
6062
}
6163

64+
const syncBottomBarPosition = () => {
65+
if (terminalRef.current && bottomBarRef.current && mainPanelRef.current && !layout.panels.terminal.minimized) {
66+
const bottomBarElement = bottomBarRef.current
67+
const terminalElement = terminalRef.current
68+
const mainPanelElement = mainPanelRef.current
69+
70+
const bottomBarHeight = bottomBarElement.offsetHeight;
71+
72+
if (editorRef.current) {
73+
const dragBarHeight = 8
74+
const newEditorHeight = mainPanelElement.offsetHeight - terminalElement.offsetHeight - bottomBarHeight - dragBarHeight
75+
editorRef.current.style.height = `${newEditorHeight}px`
76+
}
77+
} else if (bottomBarRef.current) {
78+
bottomBarRef.current.style.visibility = 'hidden'
79+
if (editorRef.current && mainPanelRef.current && bottomBarRef.current) {
80+
editorRef.current.style.height = `${mainPanelRef.current.offsetHeight - bottomBarRef.current.offsetHeight}px`
81+
}
82+
}
83+
}
84+
6285
return (
63-
<div className="mainview">
86+
<div className="mainview" ref={mainPanelRef}>
6487
{Object.values(plugins).map((pluginRecord, i) => {
88+
let panelRef = refs[i]
89+
if (pluginRecord.profile.name === 'terminal') {
90+
panelRef = terminalRef
91+
} else if (pluginRecord.profile.name === 'bottomBar') {
92+
panelRef = bottomBarRef
93+
}
94+
6595
return (
6696
<React.Fragment key={`mainView${i}`}>
6797
{pluginRecord.profile.name === 'terminal' ? (
6898
<DragBar key="dragbar-terminal" onResize={resize} hidden={pluginRecord.minimized || false} setHideStatus={showTerminal} refObject={terminalRef}></DragBar>
6999
) : null}
70-
<RemixUIPanelPlugin ref={refs[i]} key={pluginRecord.profile.name} pluginRecord={pluginRecord} />
100+
<RemixUIPanelPlugin ref={panelRef} key={pluginRecord.profile.name} pluginRecord={pluginRecord} />
71101
</React.Fragment>
72102
)
73103
})}

0 commit comments

Comments
 (0)