mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
30 lines
657 B
Lua
30 lines
657 B
Lua
Tip = {
|
|
_id = "tip",
|
|
}
|
|
|
|
function Tip:new(area, text)
|
|
local me = setmetatable({ _area = area, _text = text }, { __index = self })
|
|
me:layout()
|
|
return me
|
|
end
|
|
|
|
function Tip:layout()
|
|
self._chunks = ui.Layout()
|
|
:direction(ui.Layout.VERTICAL)
|
|
:constraints({
|
|
ui.Constraint.Fill(1),
|
|
ui.Constraint.Length(3),
|
|
ui.Constraint.Fill(1),
|
|
})
|
|
:split(self._area)
|
|
end
|
|
|
|
function Tip:reflow() return {} end
|
|
|
|
function Tip:redraw()
|
|
return {
|
|
ui.Clear(self._chunks[2]),
|
|
ui.Text(""):area(self._chunks[2]):align(ui.Align.CENTER):bg("yellow"),
|
|
ui.Text(self._text):area(self._chunks[2]:pad(ui.Pad.xy(1, 1))):align(ui.Align.CENTER):fg("black"):bold(),
|
|
}
|
|
end
|