|
94 | 94 |
|
95 | 95 | // Cap at measured content height to prevent gaps |
96 | 96 | $: topHeight = Math.min(rawTopHeight, topContentHeight); |
97 | | - $: bottomHeight = usableHeight - topHeight; |
| 97 | + $: bottomHeight = Math.min(usableHeight - topHeight, bottomContentHeight); |
| 98 | +
|
| 99 | + // Hide handlebar if content actually fits after capping |
| 100 | + $: actuallyShowHandlebar = |
| 101 | + showHandlebar && topHeight + bottomHeight >= usableHeight - 10; |
98 | 102 |
|
99 | 103 | // Style strings |
100 | | - $: topSectionStyle = showHandlebar ? `height: ${topHeight}px;` : ""; |
101 | | - $: bottomSectionStyle = showHandlebar ? `height: ${bottomHeight}px;` : ""; |
| 104 | + $: topSectionStyle = actuallyShowHandlebar ? `height: ${topHeight}px;` : ""; |
| 105 | + $: bottomSectionStyle = actuallyShowHandlebar |
| 106 | + ? `height: ${bottomHeight}px;` |
| 107 | + : ""; |
102 | 108 |
|
103 | 109 | function handleResize(e: CustomEvent<{ ratio: number }>) { |
104 | 110 | if (e.detail.ratio === -1) { |
|
126 | 132 | <!-- Top Section: Events + Saved --> |
127 | 133 | <div |
128 | 134 | class="flex flex-col gap-2 overflow-y-hidden min-h-0" |
129 | | - class:shrink-0={showHandlebar} |
130 | | - class:flex-1={!showHandlebar} |
| 135 | + class:shrink-0={actuallyShowHandlebar} |
| 136 | + class:flex-1={!actuallyShowHandlebar} |
131 | 137 | style={topSectionStyle}> |
132 | 138 | <div bind:this={eventsWrapperEl} class="shrink-0"> |
133 | 139 | <Events /> |
|
138 | 144 | </div> |
139 | 145 |
|
140 | 146 | <!-- Handlebar --> |
141 | | - {#if showHandlebar} |
| 147 | + {#if actuallyShowHandlebar} |
142 | 148 | <Handlebar |
143 | 149 | on:resize={handleResize} |
144 | 150 | containerHeight={usableHeight} /> |
|
148 | 154 | {#if hasSearchResults} |
149 | 155 | <div |
150 | 156 | class="min-h-0 flex flex-col flex-1" |
151 | | - class:shrink-0={showHandlebar} |
152 | | - class:overflow-y-hidden={showHandlebar} |
153 | | - class:overflow-y-auto={!showHandlebar} |
| 157 | + class:shrink-0={actuallyShowHandlebar} |
| 158 | + class:overflow-y-hidden={actuallyShowHandlebar} |
| 159 | + class:overflow-y-auto={!actuallyShowHandlebar} |
154 | 160 | style={bottomSectionStyle}> |
155 | 161 | <SearchResults bind:contentHeight={searchContentHeight} /> |
156 | 162 | </div> |
|
0 commit comments