Skip to content

Commit 7c3c981

Browse files
Made boxes in Media self-arrange to fill empty space, improved mobile readability of Publications.
1 parent 16d74b6 commit 7c3c981

3 files changed

Lines changed: 98 additions & 6 deletions

File tree

_includes/archive-single.html

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,51 @@
1212
{% assign title = post.title %}
1313
{% endif %}
1414

15+
<style>
16+
/* Responsive archive item styling */
17+
.archive__item-teaser img {
18+
width: 300px;
19+
height: auto;
20+
}
21+
22+
/* Mobile responsive - scale down icons */
23+
@media (max-width: 768px) {
24+
.archive__item-teaser img {
25+
width: 80px !important;
26+
max-width: 80px !important;
27+
}
28+
29+
.archive__item-content {
30+
min-width: 0; /* Allow text to wrap */
31+
}
32+
33+
.archive__item-title {
34+
font-size: 0.9rem !important;
35+
line-height: 1.3 !important;
36+
}
37+
38+
.publication-meta {
39+
font-size: 0.85rem !important;
40+
}
41+
}
42+
43+
/* Extra small screens */
44+
@media (max-width: 480px) {
45+
.archive__item-teaser img {
46+
width: 60px !important;
47+
max-width: 60px !important;
48+
}
49+
50+
.archive__item-title {
51+
font-size: 0.85rem !important;
52+
}
53+
54+
.publication-meta {
55+
font-size: 0.8rem !important;
56+
}
57+
}
58+
</style>
59+
1560
<div class="{{ include.type | default: "list" }}__item">
1661
<article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">
1762
<div style="display: flex; align-items: center; gap: 15px;">
@@ -23,7 +68,7 @@
2368
{% else %}
2469
"{{ teaser | prepend: "/images/" | prepend: base_path }}"
2570
{% endif %}
26-
alt="{{ title | default: post.title }}" style="width: 300px; height: auto;">
71+
alt="{{ title | default: post.title }}">
2772
</div>
2873
{% endif %}
2974
<div class="archive__item-content" style="flex-grow: 1;">

_media/grasp-news.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ title: "GRASP Lab’s Award-Winning Automated System for Printing Origami Robots
33
date: 2024-05-15
44
permalink: /media/grasp-news
55
link: https://www.grasp.upenn.edu/news/kinegami/
6-
summary: "GRARP Lab news put out [a feature article](https://www.grasp.upenn.edu/news/kinegami/) on [the Kinegami project](https://sung.seas.upenn.edu/research/kinegami/) that I'm part of. They wrote this when [the project's first paper](https://ieeexplore.ieee.org/document/9914656) (which was from before I joined) got an honorable mention for the T-RO best paper award, and the article also discusses the future of the project including my [OSME paper](https://repository.upenn.edu/handle/20.500.14332/60333) and ongoing work."
6+
summary: "GRASP Lab news put out [a feature article](https://www.grasp.upenn.edu/news/kinegami/) on [the Kinegami project](https://sung.seas.upenn.edu/research/kinegami/) that I'm part of. They wrote this when [the project's first paper](https://ieeexplore.ieee.org/document/9914656) (which was from before I joined) got an honorable mention for the T-RO best paper award, and the article also discusses the future of the project including my [OSME paper](https://repository.upenn.edu/handle/20.500.14332/60333) and ongoing work."
77
---

_pages/media.html

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
padding: 1rem !important;
1717
box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
1818
margin-bottom: 1rem !important;
19+
align-self: start !important;
20+
}
21+
22+
/* Grid with small row units for masonry effect */
23+
.media-grid {
24+
display: grid !important;
25+
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
26+
grid-auto-rows: 10px !important; /* Smaller units for better fit */
27+
gap: 0.75rem !important;
28+
align-items: start !important;
1929
}
2030

2131
/* Tighter spacing between elements */
@@ -34,7 +44,7 @@
3444

3545
<h1>Media</h1>
3646

37-
<section class="media-grid" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:.75rem;align-items:start;">
47+
<section class="media-grid">
3848
{% assign media_items = site.media | sort: "date" | reverse %}
3949
{% for item in media_items %}
4050
<article class="media-card" style="border: 2px solid #ccc !important; background: #fff !important; padding: 1rem !important; border-radius: 8px !important; box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;">
@@ -70,7 +80,44 @@ <h3 class="archive__item-title" style="margin: 0.1rem 0 0.25rem !important;">
7080

7181
<script async src="https://www.instagram.com/embed.js"></script>
7282
<script>
73-
window.addEventListener('load', function () {
74-
if (window.instgrm && instgrm.Embeds) { instgrm.Embeds.process(); }
75-
});
83+
window.addEventListener('load', function() {
84+
function masonryLayout() {
85+
const grid = document.querySelector('.media-grid');
86+
const items = grid.querySelectorAll('.media-card');
87+
const rowHeight = 10; // Must match grid-auto-rows
88+
const gap = 12; // 0.75rem in pixels
89+
90+
items.forEach(item => {
91+
// Reset any previous spanning
92+
item.style.gridRowEnd = 'auto';
93+
94+
// Force layout calculation
95+
const rect = item.getBoundingClientRect();
96+
const height = rect.height;
97+
98+
// Calculate how many 10px rows this item needs (including gap)
99+
const rowSpan = Math.ceil((height + gap) / (rowHeight + gap));
100+
101+
// Apply the span
102+
item.style.gridRowEnd = `span ${rowSpan}`;
103+
});
104+
}
105+
106+
// Run layout multiple times to ensure proper sizing
107+
function runLayout() {
108+
masonryLayout();
109+
setTimeout(masonryLayout, 100); // Run again after brief delay
110+
setTimeout(masonryLayout, 500); // And once more after embeds settle
111+
}
112+
113+
if (window.instgrm && instgrm.Embeds) {
114+
instgrm.Embeds.process();
115+
setTimeout(runLayout, 2000); // Wait for Instagram embeds to load
116+
} else {
117+
runLayout();
118+
}
119+
120+
// Re-run layout on window resize
121+
window.addEventListener('resize', runLayout);
122+
});
76123
</script>

0 commit comments

Comments
 (0)