7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/helpers/nitro_kit/button_helper.rb', line 7
def nk_button(
text_or_href = nil,
href = nil,
icon: nil,
icon_right: nil,
size: :base,
type: :button,
variant: :default,
**attrs,
&block
)
content = block_given? ? capture(&block) : text_or_href
href = text_or_href if href.nil? && block_given?
if href && !href.is_a?(String)
href = url_for(href)
end
render(
NitroKit::Button.new(
href:,
icon:,
icon_right:,
size:,
type:,
variant:,
**attrs
)
) do
content
end
end
|