yazi/yazi-plugin/preset/components/manager.lua

34 lines
870 B
Lua
Raw Normal View History

Manager = {
area = ui.Rect.default,
}
function Manager:layout(area)
self.area = area
return ui.Layout()
2023-12-30 18:41:41 +03:00
:direction(ui.Layout.HORIZONTAL)
:constraints({
2023-12-30 18:41:41 +03:00
ui.Constraint.Ratio(MANAGER.ratio.parent, MANAGER.ratio.all),
ui.Constraint.Ratio(MANAGER.ratio.current, MANAGER.ratio.all),
ui.Constraint.Ratio(MANAGER.ratio.preview, MANAGER.ratio.all),
})
:split(area)
end
function Manager:render(area)
local chunks = self:layout(area)
return ya.flat {
-- Borders
2023-12-30 18:41:41 +03:00
ui.Bar(chunks[1], ui.Bar.RIGHT):symbol(THEME.manager.border_symbol):style(THEME.manager.border_style),
ui.Bar(chunks[3], ui.Bar.LEFT):symbol(THEME.manager.border_symbol):style(THEME.manager.border_style),
-- Parent
Parent:render(chunks[1]:padding(ui.Padding.x(1))),
-- Current
Current:render(chunks[2]),
-- Preview
Preview:render(chunks[3]:padding(ui.Padding.x(1))),
}
end