Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fc17edb

Browse files
committed
feat(menu): change language btn
1 parent e1bd8b0 commit fc17edb

File tree

4 files changed

+11
-47
lines changed

4 files changed

+11
-47
lines changed

lua/leetcode-menu/layout/default.lua

Lines changed: 0 additions & 39 deletions
This file was deleted.

lua/leetcode-menu/layout/loading.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local Buttons = require("leetcode-menu.components.buttons")
55
local button = require("leetcode-ui.component.button")
66
local Title = require("leetcode-menu.components.title")
77

8-
local problems = button:init({ icon = "", src = "" }, "", function() end)
8+
local problems = button:init({ icon = "", src = "" }, nil, function() end)
99
local title = Title:init("Loading...")
1010

1111
return Layout:init({

lua/leetcode-menu/layout/problems.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ local random_btn = Button:init(
1616
function() cmd.random_question() end
1717
)
1818

19-
local qot_btn = Button:init(
20-
{ src = "Daily Question", icon = "󰃭" },
21-
"t",
22-
function() cmd.qot() end
19+
local qot_btn = Button:init({ src = "Daily", icon = "󰃭" }, "t", function() cmd.qot() end)
20+
21+
local lang_btn = Button:init(
22+
{ src = "Language", icon = "󰢱" },
23+
"l",
24+
function() cmd.prompt_lang() end
2325
)
2426

2527
local back_btn = Button:init(
@@ -42,6 +44,7 @@ return Layout:init({
4244
list_btn,
4345
random_btn,
4446
qot_btn,
47+
lang_btn,
4548
back_btn,
4649
},
4750
}),

lua/leetcode-ui/component/button.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ setmetatable(button, component)
1111
---@field src string
1212

1313
--- @param text lc-ui.Button.text
14-
--- @param sc string
14+
--- @param sc string|nil
1515
--- @param on_press function? optional
1616
--- @param expandable boolean? optional
1717
--- @param keybind string? optional
@@ -22,6 +22,7 @@ function button:init(text, sc, on_press, expandable, keybind, keybind_opts)
2222
on_press = on_press or function() end,
2323
sc = sc,
2424
}
25+
sc = sc and "" or ""
2526
-- log.debug(opts)
2627

2728
local width = 50
@@ -34,8 +35,7 @@ function button:init(text, sc, on_press, expandable, keybind, keybind_opts)
3435
local line = NuiLine()
3536
line:append(txt)
3637
line:append(padding)
37-
-- line:append(sc, "LeetCodeInfo")
38-
line:append("", "LeetCodeInfo")
38+
line:append(sc, "LeetCodeInfo")
3939

4040
local obj = setmetatable({
4141
opts = opts,

0 commit comments

Comments
 (0)