mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 14:54:55 +00:00
23 lines
449 B
Lua
23 lines
449 B
Lua
-- Create a grid of stat cards
|
|
require("stats.types")
|
|
local card = require("stats.card")
|
|
|
|
---@class StatGrid
|
|
local M = {}
|
|
|
|
---@param stats StatCardProps[]
|
|
---@return UIComponent
|
|
function M.create(stats)
|
|
local items = {}
|
|
for _, s in ipairs(stats) do
|
|
items[#items + 1] = card.create(s)
|
|
end
|
|
return {
|
|
type = "Grid",
|
|
props = { cols = #stats > 4 and 4 or #stats, gap = 4 },
|
|
children = items
|
|
}
|
|
end
|
|
|
|
return M
|