mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-27 07:14:56 +00:00
34 lines
1.1 KiB
Lua
34 lines
1.1 KiB
Lua
---@class AccessDenied
|
|
local M = {}
|
|
|
|
---@class DeniedProps
|
|
---@field title? string
|
|
---@field description? string
|
|
---@field actionLabel? string
|
|
---@field onAction? string
|
|
|
|
---@class UIComponent
|
|
---@field type string
|
|
---@field props? table
|
|
---@field children? table
|
|
|
|
---@param props DeniedProps
|
|
---@return UIComponent
|
|
function M.render(props)
|
|
return {
|
|
type = "Stack",
|
|
props = { spacing = 2, className = "items-center justify-center min-h-[50vh] text-center" },
|
|
children = {
|
|
{ type = "Icon", props = { name = "lock", size = 48, className = "text-muted-foreground" } },
|
|
{ type = "Typography", props = { variant = "h5", text = props.title or "Access restricted" } },
|
|
{ type = "Typography", props = { variant = "body2", text = props.description or "You don't have permission.", className = "text-muted-foreground" } },
|
|
props.actionLabel and {
|
|
type = "Button",
|
|
props = { variant = "contained", text = props.actionLabel, onClick = props.onAction or "goBack" }
|
|
} or nil
|
|
}
|
|
}
|
|
end
|
|
|
|
return M
|