mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-03 18:24:53 +00:00
24 lines
482 B
Lua
24 lines
482 B
Lua
-- Render sidebar item
|
|
require("sidebar.types")
|
|
|
|
local M = {}
|
|
|
|
---@param item SidebarItem
|
|
---@param currentPath? string
|
|
---@return UIComponent
|
|
function M.item(item, currentPath)
|
|
local active = currentPath == item.path
|
|
return {
|
|
type = "Button",
|
|
props = {
|
|
variant = active and "secondary" or "ghost",
|
|
className = "w-full justify-start",
|
|
text = item.label,
|
|
onClick = "navigate",
|
|
data = item.path
|
|
}
|
|
}
|
|
end
|
|
|
|
return M
|