mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 23:04:57 +00:00
29 lines
712 B
Lua
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
|