Skip to content

Commit b29681d

Browse files
committed
docs(docs): add sample shell to recipe boards
1 parent ea1a782 commit b29681d

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

docs-site/samples/recipes.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ export function ManyDisplayCountdownsSample() {
340340
const deadlines = useMemo(() => [12_000, 24_000, 36_000, 48_000].map(offset => now() + offset), []);
341341

342342
return (
343-
<div className="sample-box">
343+
<DemoShell eyebrow="Display-only list" title="4 countdowns" status={clock.status}>
344344
<div className="sample-board">
345345
{deadlines.map((deadline, index) => {
346346
const remainingMs = Math.max(0, deadline - clock.now);
@@ -356,7 +356,7 @@ export function ManyDisplayCountdownsSample() {
356356
})}
357357
</div>
358358
<p className="sample-muted">One shared `useTimer()` drives every display-only row.</p>
359-
</div>
359+
</DemoShell>
360360
);
361361
}
362362

@@ -370,9 +370,10 @@ export function TimerGroupSample() {
370370
[],
371371
);
372372
const timers = useTimerGroup({ updateIntervalMs: 500, items });
373+
const runningCount = timers.ids.filter(id => timers.get(id)?.isRunning).length;
373374

374375
return (
375-
<div className="sample-box">
376+
<DemoShell eyebrow="Timer group" title={`${runningCount}/${timers.size} uploads running`} status={runningCount ? 'running' : 'paused'}>
376377
<div className="sample-board">
377378
{timers.ids.map((id, index) => {
378379
const timer = timers.get(id);
@@ -394,7 +395,7 @@ export function TimerGroupSample() {
394395
);
395396
})}
396397
</div>
397-
</div>
398+
</DemoShell>
398399
);
399400
}
400401

@@ -445,9 +446,10 @@ export function CheckoutHoldsSample() {
445446
endWhen: snapshot => snapshot.elapsedMilliseconds >= hold.durationMs,
446447
})),
447448
});
449+
const activeHolds = holds.filter(hold => timers.get(hold.id)?.isRunning).length;
448450

449451
return (
450-
<div className="sample-box">
452+
<DemoShell eyebrow="Checkout holds" title={`${activeHolds}/${holds.length} holds active`} status={activeHolds ? 'running' : 'paused'}>
451453
<div className="sample-board">
452454
{holds.map(hold => {
453455
const timer = timers.get(hold.id);
@@ -469,7 +471,7 @@ export function CheckoutHoldsSample() {
469471
);
470472
})}
471473
</div>
472-
</div>
474+
</DemoShell>
473475
);
474476
}
475477

@@ -490,9 +492,10 @@ export function PerItemPollingSample() {
490492
],
491493
})),
492494
});
495+
const activeJobs = timers.ids.filter(id => timers.get(id)?.isRunning).length;
493496

494497
return (
495-
<div className="sample-box">
498+
<DemoShell eyebrow="Per-item polling" title={`${activeJobs}/${timers.size} jobs polling`} status={activeJobs ? 'running' : 'paused'}>
496499
<div className="sample-board">
497500
{timers.ids.map(id => {
498501
const timer = timers.get(id);
@@ -511,7 +514,7 @@ export function PerItemPollingSample() {
511514
);
512515
})}
513516
</div>
514-
</div>
517+
</DemoShell>
515518
);
516519
}
517520

0 commit comments

Comments
 (0)