tramway 1.0.0.2 → 1.0.1
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/README.md +1 -1
- data/app/components/tailwinds/badge_component.html.haml +2 -0
- data/app/components/tailwinds/badge_component.rb +18 -0
- data/app/components/tailwinds/base_component.rb +36 -0
- data/app/components/tailwinds/button_component.rb +0 -39
- data/lib/tramway/helpers/views_helper.rb +7 -0
- data/lib/tramway/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e80ee744d6bfbcc4a55b9cbccc19b9d2c755830c8641009198d86553961cc0ed
|
|
4
|
+
data.tar.gz: 58f0e9d547c6d209800c02e9ac6774b910366ead27c3f2306c5cc5bf379e7f38
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37b4d134de11d33b1dbbf1dd08818934a02c1d4de126d07bd15ad9b763fb8ec7b355ec9f05913e72a2b2133e2ef0679651b620ea29bb658cb8859e999bd35f66
|
|
7
|
+
data.tar.gz: 4537dd751d10550a4cf9176b969195200caeabc2f74556a96dc72afd73e5c9d8b3238b71c48c59d751550d2ae9faddac98991a95222db19114d1f93b7d624ace
|
data/README.md
CHANGED
|
@@ -820,7 +820,7 @@ Available form helpers:
|
|
|
820
820
|
|
|
821
821
|
*app/views/devise/sessions/new.html.erb*
|
|
822
822
|
```erb
|
|
823
|
-
<%= tramway_form_for(resource, as: resource_name, url: session_path(resource_name), class: 'bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4') do |f| %>
|
|
823
|
+
<%= tramway_form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: 'bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4') } do |f| %>
|
|
824
824
|
<%= component 'forms/errors', record: resource %>
|
|
825
825
|
|
|
826
826
|
<%= f.text_field :email, placeholder: 'Your email' %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tailwinds
|
|
4
|
+
# Default Tramway badge
|
|
5
|
+
#
|
|
6
|
+
class BadgeComponent < Tailwinds::BaseComponent
|
|
7
|
+
option :text
|
|
8
|
+
option :type, optional: true
|
|
9
|
+
option :color, optional: true
|
|
10
|
+
|
|
11
|
+
def classes
|
|
12
|
+
[
|
|
13
|
+
'flex', 'px-3', 'py-1', 'text-sm', 'font-semibold', 'text-white', "bg-#{resolved_color}-500",
|
|
14
|
+
"dark:bg-#{resolved_color}-600", 'rounded-full', 'w-fit'
|
|
15
|
+
]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -3,5 +3,41 @@
|
|
|
3
3
|
module Tailwinds
|
|
4
4
|
# Shared base component for Tailwinds components
|
|
5
5
|
class BaseComponent < Tramway::BaseComponent
|
|
6
|
+
TYPE_COLOR_MAP = {
|
|
7
|
+
default: :gray,
|
|
8
|
+
life: :gray,
|
|
9
|
+
primary: :blue,
|
|
10
|
+
hope: :blue,
|
|
11
|
+
secondary: :zinc,
|
|
12
|
+
success: :green,
|
|
13
|
+
will: :green,
|
|
14
|
+
warning: :orange,
|
|
15
|
+
greed: :orange,
|
|
16
|
+
danger: :red,
|
|
17
|
+
rage: :red,
|
|
18
|
+
love: :violet,
|
|
19
|
+
compassion: :indigo,
|
|
20
|
+
compassio: :indigo,
|
|
21
|
+
fear: :yellow,
|
|
22
|
+
submit: :green
|
|
23
|
+
}.freeze
|
|
24
|
+
|
|
25
|
+
def resolved_color
|
|
26
|
+
(color || type_color).to_s
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def type_color
|
|
30
|
+
TYPE_COLOR_MAP.fetch(normalized_type, TYPE_COLOR_MAP[:default]).to_sym
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def normalized_type
|
|
34
|
+
value = type
|
|
35
|
+
value = nil if value.respond_to?(:empty?) && value.empty?
|
|
36
|
+
value ||= :default
|
|
37
|
+
value = value.downcase if value.respond_to?(:downcase)
|
|
38
|
+
value = value.to_sym if value.respond_to?(:to_sym)
|
|
39
|
+
|
|
40
|
+
TYPE_COLOR_MAP.key?(value) ? value : :default
|
|
41
|
+
end
|
|
6
42
|
end
|
|
7
43
|
end
|
|
@@ -21,25 +21,6 @@ module Tailwinds
|
|
|
21
21
|
}[size]
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
TYPE_COLOR_MAP = {
|
|
25
|
-
default: :gray,
|
|
26
|
-
life: :gray,
|
|
27
|
-
primary: :blue,
|
|
28
|
-
hope: :blue,
|
|
29
|
-
secondary: :zinc,
|
|
30
|
-
success: :green,
|
|
31
|
-
will: :green,
|
|
32
|
-
warning: :orange,
|
|
33
|
-
greed: :orange,
|
|
34
|
-
danger: :red,
|
|
35
|
-
rage: :red,
|
|
36
|
-
love: :violet,
|
|
37
|
-
compassion: :indigo,
|
|
38
|
-
compassio: :indigo,
|
|
39
|
-
fear: :yellow,
|
|
40
|
-
submit: :green
|
|
41
|
-
}.freeze
|
|
42
|
-
|
|
43
24
|
def classes
|
|
44
25
|
(default_classes +
|
|
45
26
|
light_mode_classes +
|
|
@@ -69,25 +50,5 @@ module Tailwinds
|
|
|
69
50
|
'dark:text-gray-300'
|
|
70
51
|
]
|
|
71
52
|
end
|
|
72
|
-
|
|
73
|
-
private
|
|
74
|
-
|
|
75
|
-
def resolved_color
|
|
76
|
-
(color || type_color).to_s
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def type_color
|
|
80
|
-
TYPE_COLOR_MAP.fetch(normalized_type, TYPE_COLOR_MAP[:default]).to_sym
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def normalized_type
|
|
84
|
-
value = type
|
|
85
|
-
value = nil if value.respond_to?(:empty?) && value.empty?
|
|
86
|
-
value ||= :default
|
|
87
|
-
value = value.downcase if value.respond_to?(:downcase)
|
|
88
|
-
value = value.to_sym if value.respond_to?(:to_sym)
|
|
89
|
-
|
|
90
|
-
TYPE_COLOR_MAP.key?(value) ? value : :default
|
|
91
|
-
end
|
|
92
53
|
end
|
|
93
54
|
end
|
data/lib/tramway/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tramway
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kalashnikovisme
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-11-
|
|
12
|
+
date: 2025-11-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: anyway_config
|
|
@@ -145,6 +145,8 @@ files:
|
|
|
145
145
|
- app/components/tailwind_component.rb
|
|
146
146
|
- app/components/tailwinds/back_button_component.html.haml
|
|
147
147
|
- app/components/tailwinds/back_button_component.rb
|
|
148
|
+
- app/components/tailwinds/badge_component.html.haml
|
|
149
|
+
- app/components/tailwinds/badge_component.rb
|
|
148
150
|
- app/components/tailwinds/base_component.rb
|
|
149
151
|
- app/components/tailwinds/button_component.html.haml
|
|
150
152
|
- app/components/tailwinds/button_component.rb
|