Blog Post 1
+January 15, 2024
+Article summary and preview text...
+diff --git a/components/masonry.css b/components/masonry.css new file mode 100644 index 00000000..06a1d2c0 --- /dev/null +++ b/components/masonry.css @@ -0,0 +1,227 @@ +/* ============================================================ + EaseMotion CSS — masonry.css + Pinterest-style masonry layout utilities for flexible content grids + ============================================================ */ + +/* ──────────────────────────────────────────────────────────── + MASONRY BASE CLASS + – Defines the base container for masonry layouts + – Uses CSS columns for a lightweight, accessible approach + ──────────────────────────────────────────────────────────── */ + +.ease-masonry { + column-gap: var(--ease-space-4); + break-inside: avoid-column; +} + +.ease-masonry > * { + break-inside: avoid; + margin-bottom: var(--ease-space-4); +} + +/* ──────────────────────────────────────────────────────────── + 2-COLUMN MASONRY LAYOUT + – Responsive: 1 column mobile (< 640px), 2 columns tablet+ + ──────────────────────────────────────────────────────────── */ + +.ease-masonry-2 { + columns: 2; + column-gap: var(--ease-space-4); +} + +.ease-masonry-2 > * { + break-inside: avoid; + margin-bottom: var(--ease-space-4); +} + +/* Mobile: single column */ +@media (max-width: 639px) { + .ease-masonry-2 { + columns: 1; + } +} + +/* ──────────────────────────────────────────────────────────── + 3-COLUMN MASONRY LAYOUT + – Responsive: 1 column mobile (< 640px) + – 2 columns tablet (640px - 1023px) + – 3 columns desktop (>= 1024px) + ──────────────────────────────────────────────────────────── */ + +.ease-masonry-3 { + columns: 3; + column-gap: var(--ease-space-4); +} + +.ease-masonry-3 > * { + break-inside: avoid; + margin-bottom: var(--ease-space-4); +} + +/* Mobile: single column */ +@media (max-width: 639px) { + .ease-masonry-3 { + columns: 1; + } +} + +/* Tablet: two columns */ +@media (min-width: 640px) and (max-width: 1023px) { + .ease-masonry-3 { + columns: 2; + } +} + +/* ──────────────────────────────────────────────────────────── + 4-COLUMN MASONRY LAYOUT + – Responsive: 1 column mobile (< 640px) + – 2 columns tablet (640px - 1023px) + – 3 columns small desktop (1024px - 1279px) + – 4 columns large desktop (>= 1280px) + ──────────────────────────────────────────────────────────── */ + +.ease-masonry-4 { + columns: 4; + column-gap: var(--ease-space-4); +} + +.ease-masonry-4 > * { + break-inside: avoid; + margin-bottom: var(--ease-space-4); +} + +/* Mobile: single column */ +@media (max-width: 639px) { + .ease-masonry-4 { + columns: 1; + } +} + +/* Tablet: two columns */ +@media (min-width: 640px) and (max-width: 1023px) { + .ease-masonry-4 { + columns: 2; + } +} + +/* Small desktop: three columns */ +@media (min-width: 1024px) and (max-width: 1279px) { + .ease-masonry-4 { + columns: 3; + } +} + +/* ──────────────────────────────────────────────────────────── + MASONRY GAP VARIANTS + – Override default gap spacing using ease-space-* variables + ──────────────────────────────────────────────────────────── */ + +.ease-masonry.ease-gap-1, +.ease-masonry-2.ease-gap-1, +.ease-masonry-3.ease-gap-1, +.ease-masonry-4.ease-gap-1 { + column-gap: var(--ease-space-1); +} + +.ease-masonry.ease-gap-1 > *, +.ease-masonry-2.ease-gap-1 > *, +.ease-masonry-3.ease-gap-1 > *, +.ease-masonry-4.ease-gap-1 > * { + margin-bottom: var(--ease-space-1); +} + +.ease-masonry.ease-gap-2, +.ease-masonry-2.ease-gap-2, +.ease-masonry-3.ease-gap-2, +.ease-masonry-4.ease-gap-2 { + column-gap: var(--ease-space-2); +} + +.ease-masonry.ease-gap-2 > *, +.ease-masonry-2.ease-gap-2 > *, +.ease-masonry-3.ease-gap-2 > *, +.ease-masonry-4.ease-gap-2 > * { + margin-bottom: var(--ease-space-2); +} + +.ease-masonry.ease-gap-3, +.ease-masonry-2.ease-gap-3, +.ease-masonry-3.ease-gap-3, +.ease-masonry-4.ease-gap-3 { + column-gap: var(--ease-space-3); +} + +.ease-masonry.ease-gap-3 > *, +.ease-masonry-2.ease-gap-3 > *, +.ease-masonry-3.ease-gap-3 > *, +.ease-masonry-4.ease-gap-3 > * { + margin-bottom: var(--ease-space-3); +} + +.ease-masonry.ease-gap-6, +.ease-masonry-2.ease-gap-6, +.ease-masonry-3.ease-gap-6, +.ease-masonry-4.ease-gap-6 { + column-gap: var(--ease-space-6); +} + +.ease-masonry.ease-gap-6 > *, +.ease-masonry-2.ease-gap-6 > *, +.ease-masonry-3.ease-gap-6 > *, +.ease-masonry-4.ease-gap-6 > * { + margin-bottom: var(--ease-space-6); +} + +.ease-masonry.ease-gap-8, +.ease-masonry-2.ease-gap-8, +.ease-masonry-3.ease-gap-8, +.ease-masonry-4.ease-gap-8 { + column-gap: var(--ease-space-8); +} + +.ease-masonry.ease-gap-8 > *, +.ease-masonry-2.ease-gap-8 > *, +.ease-masonry-3.ease-gap-8 > *, +.ease-masonry-4.ease-gap-8 > * { + margin-bottom: var(--ease-space-8); +} + +/* ──────────────────────────────────────────────────────────── + MASONRY IMAGE SUPPORT + – Ensure images are responsive within masonry columns + ──────────────────────────────────────────────────────────── */ + +.ease-masonry img, +.ease-masonry-2 img, +.ease-masonry-3 img, +.ease-masonry-4 img { + width: 100%; + height: auto; + display: block; +} + +/* ──────────────────────────────────────────────────────────── + ACCESSIBILITY: REDUCED MOTION SUPPORT + – Respect user preferences for animations/transitions + ──────────────────────────────────────────────────────────── */ + +@media (prefers-reduced-motion: reduce) { + .ease-masonry > *, + .ease-masonry-2 > *, + .ease-masonry-3 > *, + .ease-masonry-4 > * { + transition: none !important; + } +} + +/* ──────────────────────────────────────────────────────────── + MASONRY + CARD INTEGRATION + – Seamless integration with ease-card utilities + ──────────────────────────────────────────────────────────── */ + +.ease-masonry .ease-card, +.ease-masonry-2 .ease-card, +.ease-masonry-3 .ease-card, +.ease-masonry-4 .ease-card { + margin-bottom: inherit; +} diff --git a/docs/masonry-layout-guide.md b/docs/masonry-layout-guide.md new file mode 100644 index 00000000..ac8a2141 --- /dev/null +++ b/docs/masonry-layout-guide.md @@ -0,0 +1,422 @@ +# Masonry Layout Utilities + +Create flexible Pinterest-style masonry grids with EaseMotion CSS. Perfect for portfolios, image galleries, blog cards, and responsive content layouts. + +## Overview + +The masonry utilities use CSS columns to create natural, flowing layouts where items of varying heights fit together seamlessly. This approach is: + +- **Lightweight**: Pure CSS, no JavaScript required +- **Responsive**: Mobile-first breakpoints built-in +- **Accessible**: Respects reduced motion preferences +- **Composable**: Works with existing EaseMotion utilities like `ease-card` and `ease-gap-*` + +## Base Masonry Class + +The base `ease-masonry` class sets up default masonry behavior with 2 columns on desktop, collapsing to 1 column on mobile. + +```html +
+
+
+
+January 15, 2024
+Article summary and preview text...
+
+
+
+
+By Author Name
+Brief description of the project or article...
+
+ "Amazing product and service!"
+ +Content...
+
+ ```
+
+3. **Batch rendering**: If adding items dynamically, batch DOM updates
+ ```javascript
+ const fragment = document.createDocumentFragment();
+ items.forEach(item => fragment.appendChild(item));
+ container.appendChild(fragment);
+ ```
+
+---
+
+## Common Use Cases
+
+### Portfolio Grid
+```html
+With more content that naturally flows...
+Somewhere in between
++ Create responsive Pinterest-style grids for portfolios, galleries, and content walls with pure CSS. +
++ Responsive 3-column masonry layout for portfolio projects. Adapts to 2 columns on tablet and 1 column on mobile. +
+ +<div class="ease-masonry-3 ease-gap-4">
+ <article class="ease-card ease-card-shadow ease-card-hover">
+ <!-- Portfolio item -->
+ </article>
+ <!-- More items -->
+</div>
+
+ 2024
+Modern responsive website redesign for tech startup with focus on performance and accessibility.
+2024
+Complete UI/UX design system for fitness tracking application with custom animations and micro-interactions.
+2023
+Complete brand identity system including logo, color palette, and design guidelines.
+2023
+Full-featured e-commerce platform with product filtering, cart, and checkout experience.
+2023
+Analytics dashboard with real-time data visualization and interactive charts.
+2023
+High-converting SaaS landing page with testimonials and pricing comparison.
++ Dense 4-column image gallery that adapts responsively: 3 columns on small desktop, 2 on tablet, 1 on mobile. +
+ ++ Blog articles in a masonry layout with varying content lengths. Each card adapts naturally. +
+ +Published on Jan 15, 2024
+Learn how to create responsive Pinterest-style layouts using CSS columns. This comprehensive guide covers all masonry utilities and responsive breakpoints.
+Published on Jan 10, 2024
+New masonry layout utilities, improved accessibility, and performance enhancements. Download the latest version and start building beautiful layouts.
+Features include responsive columns, gap variants, and seamless card integration.
+Published on Jan 5, 2024
+Pro tips for getting the best performance from masonry layouts. Learn about optimal column counts, image optimization, and rendering techniques.
+Published on Dec 28, 2023
+See how one designer increased engagement by 340% using masonry layouts. Includes before/after screenshots and detailed breakdown of design decisions.
+Learn from real-world implementation and best practices.
+Published on Dec 20, 2023
+Comprehensive guide to responsive design patterns with masonry. Perfect for designers and developers of all levels.
+Published on Dec 15, 2023
+Quick video walkthrough of masonry layout utilities. Perfect for getting started quickly and understanding responsive behavior.
++ All masonry layouts automatically adjust column count based on viewport width. Resize your browser to see the changes. +
+ +Mobile: 1 column
+Tablet+: 2 columns
+Best for: Two-column layouts, image pairs, side-by-side content.
+Mobile: 1 column
+Tablet: 2 columns
+Desktop: 3 columns
+Best for: Portfolios, galleries, blogs.
+Mobile: 1 column
+Tablet: 2 columns
+Sm Desktop: 3 columns
+Lg Desktop: 4 columns
+Best for: Dense galleries, image walls.
+