Files
metabuilder/packages/dashboard/seed/scripts/layout.lua
JohnDoe6345789 bf1401fe34 Enhance module definitions and add type annotations across various packages
- Added type annotations and class definitions in the dashboard layout, stats, and data table modules for improved type safety and documentation.
- Introduced new classes for UI components, props, and configuration in the form builder, navigation menu, notification center, and UI dialogs packages.
- Implemented detailed type definitions for actions, fields, and pagination components to streamline usage and enhance clarity.
- Updated initialization functions in multiple packages to include versioning and installation context.
- Improved structure and readability of the codebase by organizing and documenting component properties and methods.
2025-12-30 10:21:33 +00:00

59 lines
1.3 KiB
Lua

---@class Layout
local M = {}
---@class UIComponent
---@field type string
---@field props? table
---@field children? table
---@class LayoutProps
---@field header? table
---@field footer? table
---@field sidebar? table
---@field children? table
---@field className? string
---@param props LayoutProps
---@return UIComponent
function M.standard(props)
return {
type = "Box",
props = { className = "min-h-screen bg-background" },
children = {
props.header and { type = "AppHeader", props = props.header } or nil,
{
type = "Container",
props = { className = "max-w-7xl mx-auto px-4 py-8 space-y-8" },
children = props.children or {}
},
props.footer and { type = "AppFooter", props = props.footer } or nil
}
}
end
---@param props LayoutProps
---@return UIComponent
function M.with_sidebar(props)
return {
type = "Flex",
props = { className = "min-h-screen" },
children = {
{ type = "Sidebar", props = props.sidebar },
{
type = "Box",
props = { className = "flex-1" },
children = {
props.header and { type = "AppHeader", props = props.header } or nil,
{
type = "Box",
props = { className = "p-8 space-y-8" },
children = props.children or {}
}
}
}
}
}
end
return M