relay_ui 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/relay_ui/engine.rb +9 -11
- data/lib/relay_ui/version.rb +1 -1
- data/lib/rui/badges/base.rb +5 -1
- data/lib/rui/badges/blue.rb +3 -1
- data/lib/rui/badges/gray.rb +3 -1
- data/lib/rui/badges/green.rb +3 -1
- data/lib/rui/badges/purple.rb +3 -1
- data/lib/rui/badges/red.rb +3 -1
- data/lib/rui/badges/yellow.rb +3 -1
- data/lib/rui/badges.rb +3 -0
- data/lib/rui/base.rb +3 -8
- data/lib/rui/buttons/base.rb +9 -7
- data/lib/rui/buttons/destructive.rb +3 -1
- data/lib/rui/buttons/ghost.rb +3 -1
- data/lib/rui/buttons/outline.rb +3 -1
- data/lib/rui/buttons/primary.rb +3 -1
- data/lib/rui/buttons/secondary.rb +3 -1
- data/lib/rui/buttons.rb +3 -0
- data/lib/rui/card.rb +92 -0
- data/lib/rui/flash.rb +51 -0
- data/lib/rui/forms/checkbox.rb +25 -0
- data/lib/rui/forms/email.rb +19 -0
- data/lib/rui/forms/field_group.rb +5 -0
- data/lib/rui/forms/label.rb +7 -0
- data/lib/rui/forms/password.rb +18 -0
- data/lib/rui/forms/phone.rb +18 -0
- data/lib/rui/forms/radio.rb +22 -0
- data/lib/rui/forms/select.rb +24 -0
- data/lib/rui/forms/text.rb +17 -0
- data/lib/rui/forms/textarea.rb +18 -0
- data/lib/rui/forms.rb +3 -0
- data/lib/rui/helpers.rb +3 -0
- data/lib/rui/icon.rb +3 -1
- data/lib/rui/layout/body.rb +7 -0
- data/lib/rui/layout/main.rb +5 -0
- data/lib/rui/layout/page.rb +5 -0
- data/lib/rui/layout.rb +3 -0
- data/lib/rui/links/base.rb +5 -3
- data/lib/rui/links/destructive.rb +3 -1
- data/lib/rui/links/ghost.rb +3 -1
- data/lib/rui/links/outline.rb +3 -1
- data/lib/rui/links/primary.rb +3 -1
- data/lib/rui/links/secondary.rb +3 -1
- data/lib/rui/links.rb +3 -0
- data/lib/rui/markdown/generator.rb +2 -1
- data/lib/rui/markdown/safe.rb +3 -1
- data/lib/rui/markdown/safe_renderer.rb +3 -1
- data/lib/rui/markdown/unsafe.rb +3 -1
- data/lib/rui/markdown/unsafe_renderer.rb +9 -1
- data/lib/rui/markdown.rb +3 -0
- data/lib/rui/navigation/menu_button.rb +7 -0
- data/lib/rui/navigation/sidebar.rb +43 -0
- data/lib/rui/navigation/top.rb +19 -0
- data/lib/rui/navigation.rb +2 -50
- data/lib/rui/slideout.rb +9 -9
- data/lib/rui/table.rb +54 -0
- data/lib/rui/text.rb +5 -3
- metadata +70 -3
- data/dist/relay_ui/relay_ui.css +0 -595
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7158b2530047c016d6353aba1125ad761104ae2f553656c3d28c40cf6fc74f4a
|
4
|
+
data.tar.gz: 917a96410664ca64d92e4f41c86d7af74ebcbdc27511dbcf167fc74bd45bec26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad6bf23e5f39a374115580a70469e382cfdb3578f0c553a04394b73632902484ba479755430eed9ad5af782a7ec633f57fe8d97ea5e75404a7609463221ebf9
|
7
|
+
data.tar.gz: 9f9bc6189f61911c6691b73ba0e6822fd586d339c859714d492db5b5587d3e2fcc2ea5e6c20ae0b18fff65f92872124999798c66200a84308f119e5ce7aeeab1
|
data/lib/relay_ui/engine.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RUI
|
4
|
-
|
5
|
-
|
4
|
+
if defined?(Rails)
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
isolate_namespace RUI
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
"#{Gem::Specification.find_by_name('relay_ui').gem_dir}/lib/rui",
|
14
|
-
namespace: RUI
|
15
|
-
)
|
8
|
+
initializer "relay_ui.autoload.components" do
|
9
|
+
Rails.autoloaders.main.push_dir(
|
10
|
+
"#{Gem::Specification.find_by_name('relay_ui').gem_dir}/lib/rui",
|
11
|
+
namespace: RUI
|
12
|
+
)
|
13
|
+
end
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
data/lib/relay_ui/version.rb
CHANGED
data/lib/rui/badges/base.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Badges::Base < RUI::Base
|
2
4
|
def view_template
|
3
|
-
|
5
|
+
div do
|
6
|
+
span(class: "whitespace-nowrap px-3 py-0.5 text-xs rounded-full text-center font-medium #{variant_classes}") { yield }
|
7
|
+
end
|
4
8
|
end
|
5
9
|
end
|
data/lib/rui/badges/blue.rb
CHANGED
data/lib/rui/badges/gray.rb
CHANGED
data/lib/rui/badges/green.rb
CHANGED
data/lib/rui/badges/purple.rb
CHANGED
data/lib/rui/badges/red.rb
CHANGED
data/lib/rui/badges/yellow.rb
CHANGED
data/lib/rui/badges.rb
ADDED
data/lib/rui/base.rb
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class RUI::Base < Phlex::HTML
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if Rails.env.development?
|
8
|
-
def before_template
|
9
|
-
comment { "Before #{self.class.name}" }
|
10
|
-
super
|
11
|
-
end
|
4
|
+
def initialize(**attrs, &)
|
5
|
+
@attrs = attrs
|
6
|
+
super(&)
|
12
7
|
end
|
13
8
|
end
|
data/lib/rui/buttons/base.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Buttons::Base < RUI::Base
|
2
|
-
def initialize(icon: nil,
|
4
|
+
def initialize(icon: nil, **attrs)
|
3
5
|
@icon = icon
|
4
|
-
@
|
6
|
+
@attrs = attrs
|
5
7
|
end
|
6
8
|
|
7
9
|
def view_template
|
8
|
-
button(class: classes,
|
9
|
-
div(class: "
|
10
|
+
button(class: classes, **@attrs) do
|
11
|
+
div(class: "flex flex-row items-center gap-2") do
|
10
12
|
if @icon
|
11
|
-
div(class: "
|
13
|
+
div(class: "size-4 my-1") do
|
12
14
|
render RUI::Icon.new(@icon)
|
13
15
|
end
|
14
16
|
end
|
15
|
-
span { yield } if block_given?
|
17
|
+
span(class: "text-nowrap") { yield } if block_given?
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -23,5 +25,5 @@ class RUI::Buttons::Base < RUI::Base
|
|
23
25
|
"#{base_classes} #{variant_classes}"
|
24
26
|
end
|
25
27
|
|
26
|
-
def base_classes = "
|
28
|
+
def base_classes = "inline-block px-2 py-1 hover:cursor-pointer rounded-md transition duration-200 ease-in-out"
|
27
29
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Buttons::Destructive < RUI::Buttons::Base
|
2
4
|
private
|
3
5
|
|
4
|
-
def variant_classes = "
|
6
|
+
def variant_classes = "bg-red-700 hover:bg-red-900 text-white border border-red-700 hover:border-red-900"
|
5
7
|
end
|
data/lib/rui/buttons/ghost.rb
CHANGED
data/lib/rui/buttons/outline.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Buttons::Outline < RUI::Buttons::Base
|
2
4
|
private
|
3
5
|
|
4
|
-
def variant_classes = "
|
6
|
+
def variant_classes = "border rounded border-zinc-300 hover:border-zinc-700 text-zinc-700"
|
5
7
|
end
|
data/lib/rui/buttons/primary.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Buttons::Primary < RUI::Buttons::Base
|
2
4
|
private
|
3
5
|
|
4
|
-
def variant_classes = "
|
6
|
+
def variant_classes = "bg-blue-700 hover:bg-blue-900 text-white border border-blue-700 hover:border-blue-900"
|
5
7
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Buttons::Secondary < RUI::Buttons::Base
|
2
4
|
private
|
3
5
|
|
4
|
-
def variant_classes = "
|
6
|
+
def variant_classes = "bg-zinc-700 hover:bg-zinc-900 text-white border border-zinc-700 hover:border-zinc-900"
|
5
7
|
end
|
data/lib/rui/buttons.rb
ADDED
data/lib/rui/card.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Card < RUI::Base
|
4
|
+
def view_template(&)
|
5
|
+
div(role: "region", aria: { label: "Card" }, **@attrs) do
|
6
|
+
div(
|
7
|
+
class: "#{padding(capture(&))} flex flex-col gap-4 border border-zinc-300 rounded-lg overflow-hidden",
|
8
|
+
data: { component: "card" },
|
9
|
+
&
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def header(&)
|
15
|
+
render Header.new(&)
|
16
|
+
end
|
17
|
+
|
18
|
+
def image(&)
|
19
|
+
img(src: capture(&))
|
20
|
+
end
|
21
|
+
|
22
|
+
def body(&)
|
23
|
+
div(class: "px-4", &)
|
24
|
+
end
|
25
|
+
|
26
|
+
def footer(&)
|
27
|
+
render Footer.new(&)
|
28
|
+
end
|
29
|
+
|
30
|
+
class Header < RUI::Base
|
31
|
+
def view_template(&)
|
32
|
+
header(class: "flex flex-row justify-between items-center gap-4 px-4", &)
|
33
|
+
end
|
34
|
+
|
35
|
+
def thumbnail(&)
|
36
|
+
img(src: capture(&), class: "inline-block rounded-full size-10")
|
37
|
+
end
|
38
|
+
|
39
|
+
def titles(&)
|
40
|
+
render Titles.new(&)
|
41
|
+
end
|
42
|
+
|
43
|
+
def actions(&)
|
44
|
+
div(class: "flex flex-row gap-2 items-center", &)
|
45
|
+
end
|
46
|
+
|
47
|
+
class Titles < RUI::Base
|
48
|
+
def view_template(&)
|
49
|
+
div(class: "grow shrink basis-0 flex flex-col", &)
|
50
|
+
end
|
51
|
+
|
52
|
+
def title(&)
|
53
|
+
h2(class: "text-xl font-semibold", &)
|
54
|
+
end
|
55
|
+
|
56
|
+
def subtitle(&)
|
57
|
+
h3(class: "text-lg", &)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class Footer < RUI::Base
|
63
|
+
def view_template(&)
|
64
|
+
footer(class: "flex flex-row justify-end items-center gap-4 px-4", &)
|
65
|
+
end
|
66
|
+
|
67
|
+
def actions(&)
|
68
|
+
render Actions.new(&)
|
69
|
+
end
|
70
|
+
|
71
|
+
class Actions < RUI::Base
|
72
|
+
def view_template(&)
|
73
|
+
div(class: "flex flex-row gap-2 items-center", &)
|
74
|
+
end
|
75
|
+
|
76
|
+
def action(href: "#", **kwargs, &)
|
77
|
+
a(href:, class: "text-blue-700 hover:underline uppercase text-sm font-semibold", **kwargs, &)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
def padding(content)
|
85
|
+
return if content.empty?
|
86
|
+
padding = []
|
87
|
+
doc = Nokogiri::HTML::DocumentFragment.parse(content)
|
88
|
+
padding << "pt-4" if doc.children.first.name != "img"
|
89
|
+
padding << "pb-4" if doc.children.last.name != "img"
|
90
|
+
padding.join(" ")
|
91
|
+
end
|
92
|
+
end
|
data/lib/rui/flash.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Flash < RUI::Base
|
4
|
+
def initialize(variant = "alert")
|
5
|
+
@variant = variant
|
6
|
+
end
|
7
|
+
|
8
|
+
def view_template
|
9
|
+
div(role: "alert", data: { controller: "flash" }, class: "lg:max-w-lg border p-3 lg:px-5 lg:py-3 rounded-lg opacity-0 transition-opacity duration-100 ease-in-out " + classes) do
|
10
|
+
div(class: "flex flex-row items-center justify-between gap-3") do
|
11
|
+
div(class: "w-6") { render RUI::Icon.new(icon) }
|
12
|
+
p(class: "w-full") { yield }
|
13
|
+
button(class: "w-6 hover:cursor-pointer", data: { action: "flash#close" }) do
|
14
|
+
render RUI::Icon.new("x")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def classes = {
|
23
|
+
"notice" => "bg-blue-50 text-blue-900 border-blue-500",
|
24
|
+
"success" => "bg-green-50 text-green-900 border-green-500",
|
25
|
+
"alert" => "bg-yellow-50 text-yellow-900 border-yellow-500",
|
26
|
+
"failure" => "bg-red-50 text-red-900 border-red-500"
|
27
|
+
}.fetch @variant, "bg-zinc-50 text-zinc-900 border-zinc-500"
|
28
|
+
|
29
|
+
def icon = {
|
30
|
+
"notice" => "info-circle",
|
31
|
+
"success" => "circle-check",
|
32
|
+
"alert" => "alert-triangle",
|
33
|
+
"failure" => "flag"
|
34
|
+
}.fetch @variant, "alert-circle-filled"
|
35
|
+
|
36
|
+
class Wrapper < RUI::Base
|
37
|
+
def view_template(&)
|
38
|
+
div(class: "fixed left-0 lg:left-auto bottom-0 right-0 m-5 lg:m-10 flex flex-col gap-3", &)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module Helper
|
43
|
+
def success(message)
|
44
|
+
flash[:success] = message
|
45
|
+
end
|
46
|
+
|
47
|
+
def failure(message)
|
48
|
+
flash[:failure] = message
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Checkbox < RUI::Base
|
4
|
+
def initialize(**kwargs)
|
5
|
+
@kwargs = kwargs
|
6
|
+
end
|
7
|
+
|
8
|
+
def view_template(&)
|
9
|
+
div(class: "flex flex-row gap-3 items-center") do
|
10
|
+
input(
|
11
|
+
type: "hidden",
|
12
|
+
value: "0",
|
13
|
+
autocomplete: "off",
|
14
|
+
**@kwargs
|
15
|
+
)
|
16
|
+
input(
|
17
|
+
type: "checkbox",
|
18
|
+
value: "1",
|
19
|
+
class: "appearance-none size-4 border border-zinc-300 rounded hover:border-zinc-500 hover:cursor-pointer checked:bg-blue-700",
|
20
|
+
**@kwargs
|
21
|
+
)
|
22
|
+
render RUI::Forms::Label.new(&) if block_given?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Email < RUI::Base
|
4
|
+
def initialize(**kwargs)
|
5
|
+
@kwargs = kwargs
|
6
|
+
end
|
7
|
+
|
8
|
+
def view_template(&)
|
9
|
+
render RUI::Forms::FieldGroup.new do
|
10
|
+
render RUI::Forms::Label.new(&) if block_given?
|
11
|
+
input(
|
12
|
+
type: "email",
|
13
|
+
class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
|
14
|
+
**@kwargs
|
15
|
+
)
|
16
|
+
end
|
17
|
+
div
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Password < RUI::Base
|
4
|
+
def initialize(**kwargs)
|
5
|
+
@kwargs = kwargs
|
6
|
+
end
|
7
|
+
|
8
|
+
def view_template(&)
|
9
|
+
render RUI::Forms::FieldGroup.new do
|
10
|
+
render RUI::Forms::Label.new(&) if block_given?
|
11
|
+
input(
|
12
|
+
type: "password",
|
13
|
+
class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
|
14
|
+
**@kwargs
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Phone < RUI::Base
|
4
|
+
def initialize(**kwargs)
|
5
|
+
@kwargs = kwargs
|
6
|
+
end
|
7
|
+
|
8
|
+
def view_template(&)
|
9
|
+
render RUI::Forms::FieldGroup.new do
|
10
|
+
render RUI::Forms::Label.new(&) if block_given?
|
11
|
+
input(
|
12
|
+
type: :tel,
|
13
|
+
class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
|
14
|
+
**@kwargs
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Radio < RUI::Base
|
4
|
+
def initialize(label:, &)
|
5
|
+
@label = label
|
6
|
+
super(&)
|
7
|
+
end
|
8
|
+
|
9
|
+
def view_template
|
10
|
+
render RUI::Forms::FieldGroup.new do
|
11
|
+
render RUI::Forms::Label.new { @label }
|
12
|
+
yield
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def option(**attrs, &)
|
17
|
+
div(class: "flex flex-row gap-3 items-center") do
|
18
|
+
input(class: "hover:cursor-pointer", type: :radio, **attrs)
|
19
|
+
label(&)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Select < RUI::Base
|
4
|
+
def initialize(label:, **attrs, &)
|
5
|
+
@label = label
|
6
|
+
@attrs = attrs
|
7
|
+
super(&)
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&)
|
11
|
+
render RUI::Forms::FieldGroup.new do
|
12
|
+
render RUI::Forms::Label.new { @label }
|
13
|
+
select(
|
14
|
+
class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1.5 hover:cursor-pointer",
|
15
|
+
**@attrs,
|
16
|
+
&
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def option(**attrs, &)
|
22
|
+
tag(:option, **attrs, &)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Text < RUI::Base
|
4
|
+
def initialize(**kwargs)
|
5
|
+
@kwargs = kwargs
|
6
|
+
end
|
7
|
+
|
8
|
+
def view_template(&)
|
9
|
+
render RUI::Forms::FieldGroup.new do
|
10
|
+
render RUI::Forms::Label.new(&) if block_given?
|
11
|
+
input(
|
12
|
+
class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
|
13
|
+
**@kwargs
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RUI::Forms::Textarea < RUI::Base
|
4
|
+
def initialize(**kwargs)
|
5
|
+
@kwargs = kwargs
|
6
|
+
end
|
7
|
+
|
8
|
+
def view_template(&)
|
9
|
+
render RUI::Forms::FieldGroup.new do
|
10
|
+
render RUI::Forms::Label.new(&) if block_given?
|
11
|
+
textarea(
|
12
|
+
rows: 5,
|
13
|
+
class: "border border-zinc-300 hover:border-zinc-400 rounded px-2 py-1",
|
14
|
+
**@kwargs
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rui/forms.rb
ADDED
data/lib/rui/helpers.rb
ADDED
data/lib/rui/icon.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "tabler_icons_ruby"
|
2
4
|
|
3
5
|
class RUI::Icon < RUI::Base
|
@@ -6,6 +8,6 @@ class RUI::Icon < RUI::Base
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def view_template
|
9
|
-
|
11
|
+
div { TablerIconsRuby.render(@icon) }
|
10
12
|
end
|
11
13
|
end
|
data/lib/rui/layout.rb
ADDED
data/lib/rui/links/base.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Links::Base < RUI::Base
|
2
4
|
def initialize(href: "#", icon: nil, data: {})
|
3
5
|
@href = href
|
@@ -7,9 +9,9 @@ class RUI::Links::Base < RUI::Base
|
|
7
9
|
|
8
10
|
def view_template
|
9
11
|
a(href: @href, class: classes, data: @data) do
|
10
|
-
div(class: "
|
12
|
+
div(class: "flex flex-row items-center gap-2") do
|
11
13
|
if @icon
|
12
|
-
div(class: "
|
14
|
+
div(class: "size-4 my-1") do
|
13
15
|
render RUI::Icon.new(@icon)
|
14
16
|
end
|
15
17
|
end
|
@@ -24,5 +26,5 @@ class RUI::Links::Base < RUI::Base
|
|
24
26
|
"#{base_classes} #{variant_classes}"
|
25
27
|
end
|
26
28
|
|
27
|
-
def base_classes = "
|
29
|
+
def base_classes = "inline-block px-2 py-1 hover:cursor-pointer rounded transition duration-200 ease-in-out"
|
28
30
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class RUI::Links::Destructive < RUI::Links::Base
|
2
4
|
private
|
3
5
|
|
4
|
-
def variant_classes = "
|
6
|
+
def variant_classes = "bg-red-700 hover:bg-red-900 text-white border border-red-700 hover:border-red-900"
|
5
7
|
end
|