Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 37x 330x 1043x | import Dot from "@/components/stat/Dot";
import StatItem from "@/components/stat/StatItem";
import React from "react";
export interface CollectionStat {
label: string;
value: number;
loading?: boolean;
}
export interface StatsBarProps {
stats: CollectionStat[];
/** Number of items visible after filtering. Rendered as a trailing
* "Shown" stat — pass it only while a search/filter is active. */
shown?: number;
}
/** The summary strip rendered at the top of every collection subpage. */
const StatsBar: React.FC<StatsBarProps> = ({ stats, shown }) => (
<div className="flex flex-wrap items-center gap-x-6 gap-y-2 py-3 px-4 rounded-xl bg-gray-50 dark:bg-gray-800/60 border border-gray-100 dark:border-gray-700">
{stats.map((stat, i) => (
<React.Fragment key={`${stat.label}-${i}`}>
{i > 0 && <Dot />}
<StatItem
label={stat.label}
value={stat.value}
loading={stat.loading}
/>
</React.Fragment>
))}
{shown !== undefined && (
<>
<Dot />
<StatItem label="Shown" value={shown} />
</>
)}
</div>
);
export default StatsBar;
|