Skip to content

Commit 811c07e

Browse files
committed
Sticky close button
1 parent 626481f commit 811c07e

File tree

2 files changed

+47
-33
lines changed

2 files changed

+47
-33
lines changed

src/components/WorldMap.css

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@
3939
color: var(--text-color);
4040
box-shadow: var(--box-shadow);
4141
padding: 1em;
42-
overflow-y: auto; /* Independent scrolling within the sidebar */
42+
overflow: hidden; /* Remove scroll from the entire panel */
4343
transition: transform 0.3s ease-in-out;
4444
border-left: 1px solid var(--border-color);
45-
z-index: 15; /* Ensure it stays above the map when visible */
45+
z-index: 15;
46+
display: flex;
47+
flex-direction: column; /* Align elements vertically */
4648
}
4749

4850
@media (max-width: 768px) {
@@ -51,31 +53,11 @@
5153
top: 0;
5254
left: 0;
5355
width: 100%;
54-
height: 100%; /* Cover entire viewport height */
55-
overflow-y: auto; /* Allow scrolling within the side panel */
56-
z-index: 20; /* Ensure it overlays the map */
56+
height: 100%;
57+
z-index: 20;
5758
}
5859
}
5960

60-
/* Scrollbar Styling */
61-
.side-panel::-webkit-scrollbar {
62-
width: 12px;
63-
}
64-
65-
.side-panel::-webkit-scrollbar-track {
66-
background: var(--scrollbar-track-color);
67-
}
68-
69-
.side-panel::-webkit-scrollbar-thumb {
70-
background: var(--scrollbar-thumb-color);
71-
border-radius: 6px;
72-
filter: brightness(0.8);
73-
}
74-
75-
.side-panel::-webkit-scrollbar-thumb:hover {
76-
background: var(--scrollbar-thumb-hover-color);
77-
}
78-
7961
/* Close button styling */
8062
.close-button {
8163
background-color: var(--button-background);
@@ -84,9 +66,11 @@
8466
padding: 10px;
8567
font-size: 16px;
8668
cursor: pointer;
87-
margin-bottom: 20px;
8869
border-radius: 5px;
89-
width: 100%
70+
width: 100%;
71+
margin-bottom: 1em; /* Add margin below the button */
72+
z-index: 20; /* Ensure button stays on top */
73+
flex-shrink: 0; /* Prevent close button from resizing */
9074
}
9175

9276
.close-button:hover {
@@ -157,6 +141,31 @@
157141
white-space: nowrap;
158142
}
159143

144+
/* Accordion container with scrolling */
145+
.accordion-container {
146+
overflow-y: auto;
147+
flex: 1; /* Allow accordion to take the remaining height */
148+
}
149+
150+
/* Scrollbar Styling */
151+
.accordion-container::-webkit-scrollbar {
152+
width: 12px;
153+
}
154+
155+
.accordion-container::-webkit-scrollbar-track {
156+
background: var(--scrollbar-track-color);
157+
}
158+
159+
.accordion-container::-webkit-scrollbar-thumb {
160+
background: var(--scrollbar-thumb-color);
161+
border-radius: 6px;
162+
filter: brightness(0.8);
163+
}
164+
165+
.accordion-container::-webkit-scrollbar-thumb:hover {
166+
background: var(--scrollbar-thumb-hover-color);
167+
}
168+
160169
.item-key {
161170
font-weight: bold;
162171
flex: 1;

src/components/WorldMap.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const SidePanel = ({ selectedData, onClose }) => {
121121
</button>
122122
{Array.isArray(selectedData) ? (
123123
// Cluster is selected, group by instance ID
124-
<div className="accordion">
124+
<div className="accordion-container">
125125
{Object.keys(groupedData).map((instanceId) => (
126126
<div key={instanceId} className="accordion-item-wrapper">
127127
<strong>{instanceId}</strong>
@@ -140,12 +140,17 @@ const SidePanel = ({ selectedData, onClose }) => {
140140
</div>
141141
) : (
142142
// Single marker is selected
143-
<AccordionItem
144-
instanceScore={selectedData.instanceScore}
145-
orchObj={selectedData.orchObj}
146-
instanceObj={selectedData.instanceObj}
147-
startExpanded={true}
148-
/>
143+
<div className="accordion-container">
144+
<strong>{selectedData.instanceObj.id}</strong>
145+
<div className="accordion-item-details">
146+
<AccordionItem
147+
instanceScore={selectedData.instanceScore}
148+
orchObj={selectedData.orchObj}
149+
instanceObj={selectedData.instanceObj}
150+
startExpanded={true}
151+
/>
152+
</div>
153+
</div>
149154
)}
150155
</div>
151156
);

0 commit comments

Comments
 (0)