@@ -865,13 +877,17 @@ export function fitsOneRow(counts: number[], width: number, tile: number, gap: n
(never more than there are). If that would leave one tile alone on
the last row, one fewer across, so the last row has two: 7 that fit
6 across go 5 and 2. With only 2 across, a third, narrower column
- takes the odd one instead (3 tiles on a phone go 3 across). */
+ takes the odd one instead, if tiles stay at least 60% of full
+ width; on a narrow phone a lone last tile beats three unreadable
+ ones. */
export function balancedColumns(count: number, width: number, tile: number, gap: number): number {
if (count <= 1) return 1;
const fit = Math.floor((width + gap) / (tile + gap));
const cols = Math.min(count, 10, Math.max(2, fit));
if (count % cols !== 1) return cols;
- return cols > 2 ? cols - 1 : Math.min(count, 3);
+ if (cols > 2) return cols - 1;
+ const third = (width - 2 * gap) / 3;
+ return count >= 3 && third >= tile * 0.6 ? 3 : 2;
}
/* A string id is a people slug; a numeric or missing one is a
diff --git a/src/index.css b/src/index.css
index 062a334..9a1b072 100644
--- a/src/index.css
+++ b/src/index.css
@@ -371,7 +371,10 @@ iframe[src*="churchcenter"] {
@container (max-width: 30rem) {
.ev-grid {
grid-template-columns: 1fr;
+ /* The logo gets its own row: without one, grid-area: image made
+ an extra column beside the text. */
grid-template-areas:
+ "image"
"org"
"info"
"desc";
diff --git a/src/pages/sections/EventList-Cards.tsx b/src/pages/sections/EventList-Cards.tsx
index acc4efc..03695ff 100644
--- a/src/pages/sections/EventList-Cards.tsx
+++ b/src/pages/sections/EventList-Cards.tsx
@@ -190,25 +190,25 @@ export function Card({
// past event) keeps its links out of the tab order too.
inert={!interactive}
>
-
+
{compact ? (
/* ── GRID CARD: layout driven by .ev-grid container queries ── */
{typeBadge}
-
+
{ev.title}
{ev.theme && (
-
"{ev.theme}"
+
"{ev.theme}"
)}
- {ev.date_label &&
{ev.date_label}
}
- {schedule &&
{schedule}
}
+ {ev.date_label &&
{ev.date_label}
}
+ {schedule &&
{schedule}
}
{ev.location_label && (
-
{ev.location_label}
+
{ev.location_label}
)}
{typeBadge}
-
+
{ev.title}
{ev.theme && (
-
"{ev.theme}"
+ "{ev.theme}"
)}
- {ev.date_label && {ev.date_label}
}
- {schedule && {schedule}
}
+ {ev.date_label && {ev.date_label}
}
+ {schedule && {schedule}
}
{ev.location_label && (
- {ev.location_label}
+ {ev.location_label}
)}
@@ -496,6 +496,18 @@ export default function EventListCards({
const prev = () => setIndex(i => Math.max(0, i - 1));
const next = () => setIndex(i => Math.min(events.length - 1, i + 1));
+ // A sideways swipe of 40px or more on a touch screen turns the carousel.
+ const swipeFrom = useRef
(null);
+ const onTouchStart = (e: React.TouchEvent) => { swipeFrom.current = e.touches[0]?.clientX ?? null; };
+ const onTouchEnd = (e: React.TouchEvent) => {
+ const from = swipeFrom.current;
+ swipeFrom.current = null;
+ const to = e.changedTouches[0]?.clientX;
+ if (from == null || to == null || Math.abs(to - from) < 40) return;
+ if (to < from) next();
+ else prev();
+ };
+
// Arrows and dots follow the section accent, not the active card.
const arrowStyle = enabled => ({
border: `1px solid ${accent}`,
@@ -616,7 +628,7 @@ export default function EventListCards({