fix(home): remove <a> wrapper around bento-tile (was breaking grid)
The home service section had each bento-tile wrapped in an <a href="/services/..."> tag. This caused two problems: 1. The <a> became the grid item instead of the .bento-tile, so the .bento-tile's grid-column: span 3 was ignored. The <a> defaulted to display: block and stretched to 100% width, so all 4 tiles in a row had the same wide width — but the grid was no longer dividing them equally. 2. Astro's scoped CSS only applies to elements with the matching data-astro-cid attribute. The <a> wrapper had its own scope, and the .bento-grid > a selector wasn't styled — so the grid layout didn't propagate correctly. Fix: remove the <a> wrapper. Make the whole tile clickable by adding an absolutely-positioned <a class="tile-link-overlay"> inside the tile (covers the entire tile, sits behind text via z-index). The .bento-tile is now a direct child of .bento-grid and grid-column: span 3 works as expected. Result: 4 tiles width 3/12 each, exactly filling one row, clickable from anywhere on the tile. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -148,16 +148,16 @@ const featuredPortfolio = portfolio.filter(p => p.data.featured).slice(0, 4);
|
||||
const span = 3;
|
||||
const surface = (['yellow', 'purple-soft', 'mint', 'soft'] as const)[i];
|
||||
return (
|
||||
<a href={`/services/${s.id}`} style="display: block; text-decoration: none; color: inherit;">
|
||||
<BentoTile span={span} surface={surface} eyebrow={s.data.badge} title={s.data.title}>
|
||||
<p class="mega-subtitle">{s.data.subtitle}</p>
|
||||
<div class="mega-objective">
|
||||
<span class="objective-label">เป้าหมาย:</span>
|
||||
<span class="objective-value">{s.data.objective}</span>
|
||||
</div>
|
||||
<BentoTile span={span} surface={surface} eyebrow={s.data.badge} title={s.data.title}>
|
||||
<p class="mega-subtitle">{s.data.subtitle}</p>
|
||||
<div class="mega-objective">
|
||||
<span class="objective-label">เป้าหมาย:</span>
|
||||
<span class="objective-value">{s.data.objective}</span>
|
||||
</div>
|
||||
<a href={`/services/${s.id}`} class="tile-link-overlay">
|
||||
<span class="mega-cta">ดูรายละเอียด →</span>
|
||||
</BentoTile>
|
||||
</a>
|
||||
</a>
|
||||
</BentoTile>
|
||||
);
|
||||
})}
|
||||
</BentoGrid>
|
||||
|
||||
Reference in New Issue
Block a user