Skip to content

Commit

Permalink
enhance(homepage): dynamically fill space with 1 or 2 socials column
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Jan 21, 2025
1 parent dfde08b commit 50ffb2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions site/gdocs/pages/Homepage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@
}

.homepage-social-ribbon__social-list {
grid-template-columns: 1fr; // fallback for browsers that don't support `max()` below.

// A bunch of magic numbers!
// The 40% ensures that auto-fit creates at most 2 columns. We can't use the more sensible 50%, because grid gaps need to be accounted for.
// The 120px ensures that a column is at least 120px wide, i.e. we only get 2 columns if the container is at least 240px (+gap) wide.
grid-template-columns: repeat(auto-fit, minmax(max(40%, 120px), 1fr));

margin-top: 16px;
li {
list-style: none;
Expand Down
2 changes: 1 addition & 1 deletion site/gdocs/pages/Homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const SocialSection = () => {
</section>
<section className="homepage-social-ribbon__social-media span-cols-4 span-sm-cols-12 col-sm-start-2">
<h2 className="h2-semibold">Follow us</h2>
<ul className="homepage-social-ribbon__social-list grid grid-cols-2 grid-md-cols-1">
<ul className="homepage-social-ribbon__social-list grid">
{[...SOCIALS, ...RSS_FEEDS].map(({ title, url, icon }) => (
<li key={title}>
<a
Expand Down

0 comments on commit 50ffb2b

Please sign in to comment.