Page updates: v1.10.3 to v1.10.6 #20
2 changed files with 41 additions and 4 deletions
|
|
@ -66,6 +66,16 @@
|
||||||
border-left: 1px solid var(--pl-rule);
|
border-left: 1px solid var(--pl-rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Everyone on one line (fitsOneRow in PeopleTiles.tsx): the groups
|
||||||
|
share it by head count, and the tiles narrow to fit. */
|
||||||
|
.pl__groups[data-row="one"] {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pl__groups[data-row="one"] .pl__group {
|
||||||
|
flex: var(--pl-share) 1 0;
|
||||||
|
}
|
||||||
|
|
||||||
.pl__group-head {
|
.pl__group-head {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,10 @@ import "./PeopleTiles.css";
|
||||||
* Rows fill (balancedColumns): as many tiles across as fit, never
|
* Rows fill (balancedColumns): as many tiles across as fit, never
|
||||||
* fewer than 2 or more than 10, one fewer when that would leave a
|
* fewer than 2 or more than 10, one fewer when that would leave a
|
||||||
* lone tile on the last row. When 2 don't fit at full size they
|
* lone tile on the last row. When 2 don't fit at full size they
|
||||||
* shrink.
|
* shrink. And when everyone (every group, leads and members alike)
|
||||||
|
* fits on one line with tiles at ONE_ROW_SHRINK of full width or
|
||||||
|
* wider, they all share that one line instead (fitsOneRow): a
|
||||||
|
* board of 7 reads as one row, not 5 and 2.
|
||||||
*
|
*
|
||||||
* Details open in a panel right under the tile, over what follows
|
* Details open in a panel right under the tile, over what follows
|
||||||
* (flipped to end at the tile's right edge when it would run off
|
* (flipped to end at the tile's right edge when it would run off
|
||||||
|
|
@ -484,6 +487,9 @@ export function PeopleTilesView({
|
||||||
}
|
}
|
||||||
|
|
||||||
const open = openKey ? findByKey(resolvedGroups, openKey) : null;
|
const open = openKey ? findByKey(resolvedGroups, openKey) : null;
|
||||||
|
const oneRow =
|
||||||
|
room !== null && overflow !== "scroll" &&
|
||||||
|
fitsOneRow(resolvedGroups.map((group) => group.people.length), room.width, room.tile, room.gap);
|
||||||
const anchored = overflow !== "scroll";
|
const anchored = overflow !== "scroll";
|
||||||
const closePanel = () => {
|
const closePanel = () => {
|
||||||
setOpenKey(null);
|
setOpenKey(null);
|
||||||
|
|
@ -537,13 +543,17 @@ export function PeopleTilesView({
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
<span ref={probeRef} className="pl__probe" aria-hidden="true" />
|
<span ref={probeRef} className="pl__probe" aria-hidden="true" />
|
||||||
<div className="pl__groups">
|
<div className="pl__groups" data-row={oneRow ? "one" : undefined}>
|
||||||
{resolvedGroups.map((group) => (
|
{resolvedGroups.map((group) => (
|
||||||
<section
|
<section
|
||||||
key={group.id}
|
key={group.id}
|
||||||
className="pl__group"
|
className="pl__group"
|
||||||
style={
|
style={
|
||||||
group.accent ? ({ "--pl-accent": group.accent } as CSSProperties) : undefined
|
{
|
||||||
|
...(group.accent ? { "--pl-accent": group.accent } : null),
|
||||||
|
// Sharing one line: each group's width follows its head count.
|
||||||
|
...(oneRow ? { "--pl-share": group.people.length } : null),
|
||||||
|
} as CSSProperties
|
||||||
}
|
}
|
||||||
aria-label={group.label || undefined}
|
aria-label={group.label || undefined}
|
||||||
>
|
>
|
||||||
|
|
@ -559,7 +569,9 @@ export function PeopleTilesView({
|
||||||
style={
|
style={
|
||||||
room
|
room
|
||||||
? ({
|
? ({
|
||||||
"--pl-cols": balancedColumns(group.people.length, room.width, room.tile, room.gap),
|
"--pl-cols": oneRow
|
||||||
|
? group.people.length
|
||||||
|
: balancedColumns(group.people.length, room.width, room.tile, room.gap),
|
||||||
} as CSSProperties)
|
} as CSSProperties)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
|
@ -834,6 +846,21 @@ function Chevron() {
|
||||||
|
|
||||||
/* ── Helpers ─────────────────────────────────────────────────── */
|
/* ── Helpers ─────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
/* How small a tile may get so a whole list shares one line. */
|
||||||
|
export const ONE_ROW_SHRINK = 0.75;
|
||||||
|
|
||||||
|
/* Whether every group fits side by side on one line, 10 tiles at most,
|
||||||
|
with tiles no smaller than ONE_ROW_SHRINK of full width. Groups are
|
||||||
|
divided by a gap, padding and a 1px rule (PeopleTiles.css). */
|
||||||
|
export function fitsOneRow(counts: number[], width: number, tile: number, gap: number): boolean {
|
||||||
|
const total = counts.reduce((sum, n) => sum + n, 0);
|
||||||
|
if (total < 2 || total > 10) return false;
|
||||||
|
const smallest = tile * ONE_ROW_SHRINK;
|
||||||
|
const tiles = counts.reduce((sum, n) => sum + n * smallest + (n - 1) * gap, 0);
|
||||||
|
const dividers = (counts.length - 1) * (gap * 3 + 1);
|
||||||
|
return tiles + dividers <= width;
|
||||||
|
}
|
||||||
|
|
||||||
/* Tiles across a row: as many as fit, at least 2 and at most 10
|
/* Tiles across a row: as many as fit, at least 2 and at most 10
|
||||||
(never more than there are). If that would leave one tile alone on
|
(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
|
the last row, one fewer across, so the last row has two: 7 that fit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue