Skip to content

Commit 25b94bd

Browse files
authored
fix: Info-Toggle-Button (#147)
Previously, the toggle button was placed inside the `toggle-info-container`, which caused inconsistent styling and layout issues in different contexts. This fix moves the button outside the container by wrapping both elements in a separate `div`, ensuring visual consistency across all components. before: ![image](https://github.com/user-attachments/assets/101763c1-e370-4acc-bc20-cc2b82b4fb61) after: ![image](https://github.com/user-attachments/assets/281809b4-3312-46f8-82e5-6b21eb69c3a0)
1 parent 6df9e6e commit 25b94bd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/graphics/right_bar.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ function createInfoToggleButton(
499499
return button;
500500
}
501501

502-
// Main function to create toggle info
503502
export function createToggleInfo({
504503
title,
505504
details,
@@ -516,7 +515,7 @@ export function createToggleInfo({
516515
const list = document.createElement("ul");
517516
list.classList.add(infoClass, "hidden");
518517

519-
// Process details
518+
// Process details before creating the button
520519
Object.entries(details).forEach(([key, value]) => {
521520
let listItem: HTMLLIElement;
522521

@@ -531,13 +530,16 @@ export function createToggleInfo({
531530
list.appendChild(listItem);
532531
});
533532

533+
// Move the button outside the `toggle-info-container`
534534
const button = createInfoToggleButton(buttonClass, list, container, header);
535+
const wrapper = document.createElement("div"); // New wrapper for structural consistency
536+
wrapper.appendChild(button);
537+
wrapper.appendChild(container); // Now the container is separate from the button
535538

536-
container.appendChild(button);
537539
container.appendChild(header);
538540
container.appendChild(list);
539541

540-
return container;
542+
return wrapper; // Return the wrapper that contains the button and the info container
541543
}
542544

543545
export function createRightBarButton(

0 commit comments

Comments
 (0)