Skip to content

Commit ffdcc7a

Browse files
committed
refactor: improve layout and styling for control components
1 parent f349818 commit ffdcc7a

File tree

4 files changed

+60
-42
lines changed

4 files changed

+60
-42
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changes
22

33
## June 19, 2025
4+
- Improved space utilization for controls with more compact vertical spacing and better wrapping behavior, including reduced vertical separation between wrapped elements
45
- Added toggle legend button for plotly timeseries plots (Issue #328)
56
- Fixed margin difference between plotly and native NS plots by removing width reduction and right margin (Issue #330)
67

src/pages/NwbPage/plugins/common/components/ControlButton.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ export const ControlButton: FunctionComponent<ControlButtonProps> = ({
1919
style={{
2020
padding: "0px 0px",
2121
border: "1px solid #ddd",
22-
borderRadius: "4px",
23-
fontSize: "0.85rem",
22+
borderRadius: "3px",
23+
fontSize: "0.8rem",
2424
backgroundColor: disabled ? "#f5f5f5" : "white",
2525
cursor: disabled ? "not-allowed" : "pointer",
2626
color: disabled ? "#999" : "#333",
2727
transition: "all 0.2s ease",
28-
boxShadow: disabled ? "none" : "0 1px 2px rgba(0,0,0,0.05)",
28+
boxShadow: disabled ? "none" : "0 1px 1px rgba(0,0,0,0.05)",
2929
outline: "none",
30-
minWidth: "28px",
30+
minWidth: "24px",
31+
height: "22px",
32+
lineHeight: "1",
3133
fontFamily:
3234
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
3335
userSelect: "none",

src/pages/NwbPage/plugins/common/components/TimeseriesControls.tsx

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -162,25 +162,27 @@ export const TimeRangeControls: FunctionComponent<TimeRangeControlsProps> = ({
162162
<div
163163
style={{
164164
display: "flex",
165-
gap: "8px",
165+
gap: "6px",
166166
alignItems: "center",
167167
background: "#f8f9fa",
168-
padding: "8px 12px",
169-
borderRadius: "6px",
168+
padding: "3px 8px",
169+
borderRadius: "5px",
170170
border: "1px solid #e9ecef",
171-
boxShadow: "0 1px 3px rgba(0,0,0,0.05)",
171+
boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
172+
margin: "1px 0",
172173
}}
173174
>
174175
<div
175176
style={{
176-
fontSize: "0.9rem",
177+
fontSize: "0.85rem",
177178
color: "#495057",
178179
fontFamily:
179180
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
180181
display: "flex",
181182
alignItems: "center",
182-
gap: "4px",
183+
gap: "3px",
183184
minWidth: "130px",
185+
whiteSpace: "nowrap",
184186
}}
185187
>
186188
<span style={{ fontWeight: 500 }}>{label}</span>
@@ -194,11 +196,11 @@ export const TimeRangeControls: FunctionComponent<TimeRangeControlsProps> = ({
194196
onKeyDown={handleDurationKeyDown}
195197
style={{
196198
width: "60px",
197-
padding: "2px 4px",
199+
padding: "1px 3px",
198200
border: "1px solid #ced4da",
199201
borderRadius: "4px",
200-
fontSize: "0.9rem",
201-
marginLeft: "8px",
202+
fontSize: "0.85rem",
203+
marginLeft: "6px",
202204
}}
203205
/>
204206
) : (
@@ -228,10 +230,10 @@ export const TimeRangeControls: FunctionComponent<TimeRangeControlsProps> = ({
228230
onKeyDown={handleStartTimeKeyDown}
229231
style={{
230232
width: "60px",
231-
padding: "2px 4px",
233+
padding: "1px 3px",
232234
border: "1px solid #ced4da",
233235
borderRadius: "4px",
234-
fontSize: "0.9rem",
236+
fontSize: "0.85rem",
235237
}}
236238
/>
237239
) : (
@@ -313,25 +315,27 @@ export const ItemRangeControls: FunctionComponent<ItemRangeControlsProps> = ({
313315
<div
314316
style={{
315317
display: "flex",
316-
gap: "8px",
318+
gap: "6px",
317319
alignItems: "center",
318320
background: "#f8f9fa",
319-
padding: "8px 12px",
320-
borderRadius: "6px",
321+
padding: "3px 8px",
322+
borderRadius: "5px",
321323
border: "1px solid #e9ecef",
322-
boxShadow: "0 1px 3px rgba(0,0,0,0.05)",
324+
boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
325+
margin: "1px 0",
323326
}}
324327
>
325328
<div
326329
style={{
327-
fontSize: "0.9rem",
330+
fontSize: "0.85rem",
328331
color: "#495057",
329332
fontFamily:
330333
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
331334
display: "flex",
332335
alignItems: "center",
333-
gap: "8px",
336+
gap: "6px",
334337
minWidth: "70px",
338+
whiteSpace: "nowrap",
335339
}}
336340
>
337341
{itemLabel && <span style={{ fontWeight: 500 }}>{itemLabel}</span>}
@@ -382,14 +386,16 @@ export const CondensedLayout: FunctionComponent<{
382386
}> = ({ children }) => (
383387
<div
384388
style={{
385-
padding: "6px",
389+
padding: "3px",
386390
background: "#f5f5f5",
387391
borderRadius: "5px",
388392
fontFamily: "sans-serif",
389-
fontSize: "0.9rem",
393+
fontSize: "0.85rem",
390394
display: "flex",
391-
gap: "16px",
395+
gap: "6px",
396+
rowGap: "3px",
392397
alignItems: "center",
398+
flexWrap: "wrap",
393399
}}
394400
>
395401
{children}
@@ -407,18 +413,19 @@ export const FullLayout: FunctionComponent<{
407413
return (
408414
<div
409415
style={{
410-
padding: "10px",
416+
padding: "4px",
411417
background: "#f5f5f5",
412418
borderRadius: "5px",
413419
fontFamily: "sans-serif",
414-
fontSize: "0.9rem",
420+
fontSize: "0.85rem",
415421
}}
416422
>
417-
<div style={{ marginBottom: "12px" }}>{recordingInfo}</div>
423+
<div style={{ marginBottom: "4px" }}>{recordingInfo}</div>
418424
<div
419425
style={{
420426
display: "flex",
421-
gap: "12px",
427+
gap: "6px",
428+
rowGap: "3px",
422429
alignItems: "flex-start",
423430
flexWrap: "wrap",
424431
overflowX: "auto",
@@ -445,25 +452,27 @@ export const SeparationControls: FunctionComponent<SeparationControlsProps> = ({
445452
<div
446453
style={{
447454
display: "flex",
448-
gap: "8px",
455+
gap: "6px",
449456
alignItems: "center",
450457
background: "#f8f9fa",
451-
padding: "8px 12px",
452-
borderRadius: "6px",
458+
padding: "3px 8px",
459+
borderRadius: "5px",
453460
border: "1px solid #e9ecef",
454-
boxShadow: "0 1px 3px rgba(0,0,0,0.05)",
461+
boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
462+
margin: "1px 0",
455463
}}
456464
>
457465
<div
458466
style={{
459-
fontSize: "0.9rem",
467+
fontSize: "0.85rem",
460468
color: "#495057",
461469
fontFamily:
462470
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
463471
display: "flex",
464472
alignItems: "center",
465-
gap: "4px",
473+
gap: "3px",
466474
minWidth: "70px",
475+
whiteSpace: "nowrap",
467476
}}
468477
>
469478
<span style={{ fontWeight: 500 }}>Separation</span>

src/pages/NwbPage/plugins/simple-timeseries/Controls.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,21 @@ export const Controls: FunctionComponent<ControlsProps> = ({
103103
return (
104104
<FullLayout>
105105
<LabeledRow label="">
106-
<div
107-
style={{
108-
display: "flex",
109-
gap: "12px",
106+
<div
107+
style={{
108+
display: "flex",
109+
gap: "8px",
110+
alignItems: "center",
111+
flexWrap: "wrap",
112+
width: "100%",
113+
}}
114+
>
115+
<div style={{
116+
display: "flex",
110117
alignItems: "center",
111-
flexWrap: "wrap",
112-
}}
113-
>
114-
<div style={{ display: "flex", alignItems: "center" }}>
118+
whiteSpace: "nowrap",
119+
marginRight: "8px",
120+
}}>
115121
Start: {info.timeseriesStartTime.toFixed(2)} s, Duration:{" "}
116122
{info.timeseriesDuration.toFixed(2)} s,{" "}
117123
{formatSamplingFrequency(info.samplingFrequency)}

0 commit comments

Comments
 (0)