#403 main display documentation

This commit is contained in:
Mikayla Fischler
2025-09-01 16:37:21 -04:00
parent 92113671ff
commit d0401fe51f
3 changed files with 100 additions and 11 deletions

View File

@@ -49,7 +49,7 @@ return function (data, base_page, title, items, scroll_height)
local page_end
for i = 1, #items do
local item = items[i] ---@type pocket_doc_sect|pocket_doc_subsect|pocket_doc_text|pocket_doc_list
local item = items[i] ---@type pocket_doc_sect|pocket_doc_subsect|pocket_doc_text|pocket_doc_note|pocket_doc_tip|pocket_doc_list
if item.type == DOC_TYPE.SECTION then
---@cast item pocket_doc_sect
@@ -73,6 +73,8 @@ return function (data, base_page, title, items, scroll_height)
local _ = Div{parent=name_list,height=1}
end
table.insert(search_db, { string.lower(item.name), item.name, title, view })
local name_title = Div{parent=name_list,height=1}
TextBox{parent=name_title,x=1,text=title_text,fg_bg=cpair(colors.lightGray,colors.black)}
PushButton{parent=name_title,x=title_offs,y=1,text=item.name,alignment=ALIGN.LEFT,fg_bg=cpair(colors.green,colors.black),active_fg_bg=btn_active,callback=view}
@@ -108,6 +110,19 @@ return function (data, base_page, title, items, scroll_height)
TextBox{parent=def_list,text=item.text}
page_end = Div{parent=def_list,height=1,can_focus=true}
elseif item.type == DOC_TYPE.NOTE then
---@cast item pocket_doc_note
TextBox{parent=def_list,text=item.text,fg_bg=cpair(colors.gray,colors._INHERIT)}
page_end = Div{parent=def_list,height=1,can_focus=true}
elseif item.type == DOC_TYPE.TIP then
---@cast item pocket_doc_tip
TextBox{parent=def_list,text="TIP!",fg_bg=cpair(colors.orange,colors._INHERIT)}
TextBox{parent=def_list,text=item.text}
page_end = Div{parent=def_list,height=1,can_focus=true}
elseif item.type == DOC_TYPE.LIST then
---@cast item pocket_doc_list