mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 23:04:57 +00:00
69 lines
1.3 KiB
Lua
69 lines
1.3 KiB
Lua
-- Render user profile card
|
|
|
|
require("profile.types")
|
|
|
|
local M = {}
|
|
|
|
---Renders the user profile card with form inputs
|
|
---@param ctx RenderContext
|
|
---@return UIComponent
|
|
function M.render(ctx)
|
|
---@type InputProps
|
|
local usernameProps = {
|
|
label = "Username",
|
|
value = ctx.user.username,
|
|
disabled = true
|
|
}
|
|
---@type InputProps
|
|
local emailProps = {
|
|
label = "Email",
|
|
name = "email",
|
|
value = ctx.user.email or ""
|
|
}
|
|
---@type ButtonProps
|
|
local saveProps = {
|
|
text = "Save Changes",
|
|
onClick = "saveProfile"
|
|
}
|
|
---@type UIComponent
|
|
local card = {
|
|
type = "Card",
|
|
children = {
|
|
{
|
|
type = "CardHeader",
|
|
children = {
|
|
{
|
|
type = "Icon",
|
|
props = {
|
|
---@type IconProps
|
|
name = "IdCard",
|
|
size = "large"
|
|
}
|
|
},
|
|
{ type = "CardTitle", props = { text = "Your Profile" } }
|
|
}
|
|
},
|
|
{
|
|
type = "CardContent",
|
|
children = {
|
|
{
|
|
type = "Input",
|
|
props = usernameProps
|
|
},
|
|
{
|
|
type = "Input",
|
|
props = emailProps
|
|
},
|
|
{
|
|
type = "Button",
|
|
props = saveProps
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return card
|
|
end
|
|
|
|
return M
|