Files
metabuilder/packages/ui_level2/seed/scripts/comments/list.lua
2025-12-30 13:32:53 +00:00

29 lines
712 B
Lua

-- Comment list component
-- Single function module for comments UI
require("comments.types")
---@class CommentList
local M = {}
---Render list of comments
---@param comments Comment[] Array of comment objects
---@return UIComponent
function M.list(comments)
local items = {}
for _, c in ipairs(comments) do
items[#items + 1] = {
type = "Card",
children = {
{ type = "CardContent", children = {
{ type = "Typography", props = { text = c.content } },
{ type = "Typography", props = { variant = "caption", text = c.author } }
}}
}
}
end
return { type = "Stack", props = { spacing = 2 }, children = items }
end
return M