mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 14:54:55 +00:00
41 lines
1.1 KiB
Lua
41 lines
1.1 KiB
Lua
---@class Confirm
|
|
local M = {}
|
|
|
|
---@class ConfirmProps
|
|
---@field open boolean
|
|
---@field title? string
|
|
---@field message string
|
|
---@field confirmText? string
|
|
---@field destructive? boolean
|
|
|
|
---@class UIComponent
|
|
---@field type string
|
|
---@field props? table
|
|
---@field children? table
|
|
|
|
---@param props ConfirmProps
|
|
---@return UIComponent
|
|
function M.render(props)
|
|
return {
|
|
type = "Dialog",
|
|
props = { open = props.open },
|
|
children = {
|
|
{
|
|
type = "DialogContent",
|
|
children = {
|
|
{ type = "DialogHeader", children = {
|
|
{ type = "DialogTitle", props = { text = props.title or "Confirm" } },
|
|
{ type = "DialogDescription", props = { text = props.message } }
|
|
}},
|
|
{ type = "DialogFooter", children = {
|
|
{ type = "Button", props = { variant = "outline", text = "Cancel", onClick = "onCancel" } },
|
|
{ type = "Button", props = { variant = props.destructive and "destructive" or "default", text = props.confirmText or "Confirm", onClick = "onConfirm" } }
|
|
}}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
return M
|