Skip to content

Commit 54b65ff

Browse files
committed
bug and merge conflicts
1 parent 4007670 commit 54b65ff

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

src/components/ChangelogSnippet/ChangelogCard.astro

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,18 @@ const formattedDate = formatDate(item["date-of-release"])
160160
const totalImages = images.length
161161

162162
const checkCardHeight = () => {
163-
// Determine max height based on viewport
164-
const isMobile = window.innerWidth <= 768
165-
const wrapperMaxHeight = isMobile ? 300 : 400
163+
// Check if wrapper's content exceeds its visible height
164+
const wrapperEl = wrapper as HTMLElement
165+
const hasOverflow = card.scrollHeight > wrapperEl.clientHeight
166166

167-
// Check if card exceeds wrapper height
168-
if (card.scrollHeight <= wrapperMaxHeight) {
169-
// Card fits, hide the button and fade
170-
footer.style.opacity = "0"
171-
footer.style.pointerEvents = "none"
172-
} else {
173-
// Card exceeds wrapper, show button and fade
167+
if (hasOverflow) {
168+
// Content exceeds wrapper, show button and fade
174169
footer.style.opacity = "1"
175170
footer.style.pointerEvents = "auto"
171+
} else {
172+
// Content fits within wrapper, hide the button and fade
173+
footer.style.opacity = "0"
174+
footer.style.pointerEvents = "none"
176175
}
177176
}
178177

@@ -199,11 +198,11 @@ const formattedDate = formatDate(item["date-of-release"])
199198
})
200199
}
201200
})
202-
} else {
203-
// No images, check immediately
204-
checkCardHeight()
205201
}
206202

203+
// this is needed to make the fade/show more work.
204+
setTimeout(checkCardHeight, 2000)
205+
207206
let isExpanded = false
208207

209208
button.addEventListener("click", () => {
@@ -230,12 +229,7 @@ const formattedDate = formatDate(item["date-of-release"])
230229
})
231230
}
232231

233-
// Initialize on page load
234-
swapDataAttributeImages()
235-
initExpandableCards()
236-
237-
// Re-initialize after navigation (for SPA-like behavior)
238-
document.addEventListener("astro:page-load", () => {
232+
document.addEventListener("DOMContentLoaded", () => {
239233
swapDataAttributeImages()
240234
initExpandableCards()
241235
})

src/components/ChangelogSnippet/ChangelogCard.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
& .card {
1717
padding: var(--space-4x);
1818
}
19+
20+
& ul {
21+
padding-left: var(--space-6x);
22+
}
23+
& li {
24+
list-style-type: disc;
25+
}
1926
}
2027

2128
/* Used on individual pages like CCIP/DataFeeds */
@@ -203,9 +210,13 @@
203210
}
204211

205212
@media screen and (max-width: 768px) {
213+
.cardWrapper {
214+
max-height: 440px;
215+
}
206216
.card {
207217
padding: var(--space-4x);
208218
gap: var(--space-4x);
219+
flex-direction: column;
209220
}
210221

211222
.header {

src/pages/changelog.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const types = logs ? getUniqueTypes(logs) : []
6969
{
7070
logs?.map((log, index) => (
7171
<div class="changelog-item" data-index={index} style={index >= 25 ? "display: none;" : ""}>
72-
<ChangelogCard showBorder={false} item={log} />
72+
<ChangelogCard showNetworksAndTopic showBorder={false} item={log} />
7373
</div>
7474
))
7575
}

0 commit comments

Comments
 (0)