|
114 | 114 | <div class="row js-content-cards-list"> |
115 | 115 | <% content_group[:content].each do |content| %> |
116 | 116 | <div class="col s12 m6 l4 xl3 js-content-card-container"> |
117 | | - <div class="hoverable card sticky-action z-depth-1" style="margin-bottom: 20px; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; height: 450px;"> |
| 117 | + <div class="hoverable card sticky-action z-depth-1" style="margin-bottom: 20px; border-radius: 8px; overflow: hidden;"> |
118 | 118 | <!-- Color indicator bar at top of card --> |
119 | 119 | <div style="height: 4px; background-color: <%= content_group[:color] == 'grey' ? '#9e9e9e' : "var(--#{content_group[:color]})" %>;"></div> |
120 | 120 |
|
121 | | - <div class="card-image waves-effect waves-block waves-light" style="flex: 0 0 auto;"> |
| 121 | + <div class="card-image waves-effect waves-block waves-light"> |
122 | 122 | <% |
123 | 123 | # Find image for this content |
124 | 124 | content_image = @random_image_pool_cache.fetch([content.class.name, content.id], []) |
|
146 | 146 | </div> |
147 | 147 |
|
148 | 148 | <!-- Improved card actions --> |
149 | | - <div class="card-content" style="padding: 16px; border-bottom: 1px solid #f0f0f0; flex: 1 0 auto; display: flex; flex-direction: column;"> |
| 149 | + <div class="card-content" style="padding: 16px; border-bottom: 1px solid #f0f0f0;"> |
150 | 150 | <!-- Creator info with avatar --> |
151 | 151 | <% user = @users_cache[content.user_id] %> |
152 | 152 | <% if user %> |
|
166 | 166 |
|
167 | 167 | <!-- Tags as pills --> |
168 | 168 | <% if content.respond_to?(:page_tags) && content.page_tags.any? %> |
169 | | - <div class="tags-container" style="display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; flex: 1 0 auto;"> |
| 169 | + <div class="tags-container" style="display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;"> |
170 | 170 | <% content.page_tags.each do |tag| %> |
171 | 171 | <% if tag.tag == @tag %> |
172 | 172 | <span class="tag-pill" style="padding: 4px 10px; background-color: <%= content_group[:color] == 'grey' ? '#9e9e9e' : "var(--#{content_group[:color]}-lighten-1)" %>; color: white; border-radius: 20px; font-size: 12px;"> |
|
182 | 182 | <% end %> |
183 | 183 | </div> |
184 | 184 |
|
185 | | - <div class="card-action" style="display: flex; justify-content: space-between; background-color: #fafafa; padding: 12px 16px; flex: 0 0 auto;"> |
| 185 | + <div class="card-action" style="display: flex; justify-content: space-between; background-color: #fafafa; padding: 12px 16px;"> |
186 | 186 | <% if content.is_a?(Document) %> |
187 | 187 | <%= link_to content, class: "#{content_group[:color]}-text", style: "font-weight: 500; display: flex; align-items: center;", target: '_blank' do %> |
188 | 188 | <i class="material-icons left" style="font-size: 18px; margin-right: 6px;">visibility</i> View |
|
372 | 372 | --orange-lighten-5: #fff3e0; |
373 | 373 | } |
374 | 374 |
|
375 | | - /* Equal height card grid */ |
| 375 | + /* Card grid layout */ |
376 | 376 | .js-content-cards-list { |
377 | | - display: flex; |
378 | | - flex-wrap: wrap; |
| 377 | + display: block; |
379 | 378 | } |
380 | 379 |
|
381 | | - .js-content-card-container { |
382 | | - display: flex; |
383 | | - margin-bottom: 20px; |
384 | | - } |
385 | | - |
386 | | - /* Responsive adjustments */ |
387 | | - @media only screen and (max-width: 993px) { |
| 380 | + /* Card height consistency using CSS Grid */ |
| 381 | + @media only screen and (min-width: 601px) { |
| 382 | + .js-content-cards-list { |
| 383 | + display: grid; |
| 384 | + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); |
| 385 | + grid-gap: 20px; |
| 386 | + } |
| 387 | + |
388 | 388 | .js-content-card-container { |
389 | | - height: auto; |
| 389 | + margin-bottom: 0; |
| 390 | + } |
| 391 | + |
| 392 | + .js-content-card-container .card { |
| 393 | + height: 100%; |
| 394 | + margin-bottom: 0; |
| 395 | + display: grid; |
| 396 | + grid-template-rows: auto 1fr auto; |
| 397 | + } |
| 398 | + |
| 399 | + .card .card-image { |
| 400 | + grid-row: 1; |
| 401 | + } |
| 402 | + |
| 403 | + .card .card-content { |
| 404 | + grid-row: 2; |
390 | 405 | } |
391 | 406 |
|
392 | | - .card.sticky-action { |
393 | | - height: auto !important; |
| 407 | + .card .card-action { |
| 408 | + grid-row: 3; |
| 409 | + align-self: end; |
394 | 410 | } |
395 | 411 | } |
396 | 412 |
|
|
0 commit comments