mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
feat: satori and resvg for rendering
This commit is contained in:
1 parent
e48ea4c307
commit
c834f4f966
34 files changed
+670
-501
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import GenericStatsColumn from './components/GenericStatsColumn.js';
|
||||
|
||||
export type Stat = [string, string | number];
|
||||
|
||||
export interface GenericStatsProps {
|
||||
stats: Stat[];
|
||||
columnCount?: number;
|
||||
}
|
||||
|
||||
export default function GenericStats({
|
||||
stats,
|
||||
columnCount = 2,
|
||||
}: GenericStatsProps) {
|
||||
const itemsPerRow = Math.ceil(stats.length / columnCount);
|
||||
const columns: Stat[][] = [];
|
||||
|
||||
stats.forEach((stat, index) => {
|
||||
const column = Math.floor(index / itemsPerRow);
|
||||
if (!columns[column]) columns[column] = [];
|
||||
columns[column].push(stat);
|
||||
});
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', gap: 32 }}>
|
||||
{columns.map((stats) => (
|
||||
<GenericStatsColumn
|
||||
key={stats.map((stat) => stat[0]).join('-')}
|
||||
stats={stats}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user