tramway 0.6.1.1 → 0.6.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fffab981c47137351c1b55fb952713cf8ee9f1b4ba963ca60e2349d8e836d2e
4
- data.tar.gz: e858d3b6377eb934c5ae15bccee505a65f1a4abdb4d7088340f7271ba923c8f8
3
+ metadata.gz: 84e55c77d1524c7f3fd7a9fed9702e4a9dfd1b206b706b1680359b326df1af96
4
+ data.tar.gz: df5e1366a5aadb38cf75a5b5513a1f19b864efff5236e21148c5fdc73e14ec6f
5
5
  SHA512:
6
- metadata.gz: 82dede0fafef9b81bf1e2bf12da749d14a7bf508d7855d57497ccecefb5f2bcb779c89460fdda9f4bdb71bdd6af6df224cb7c0036b457dba0f6d44e703f61cd5
7
- data.tar.gz: 37b31c109c429c1d5979a8bbbff3c5ef171653b2abbadc8b2a41c979096af9cf22b0302ede6496539fb8755c4fb83766f01cfe1f98d3e4761a27bb1b89b6903b
6
+ metadata.gz: d4a83edca437f56371f0202a784419b13749f542060e5ccf6d7a8bf7cd6160d668564d62febda6d4d7ab272d35d3af9ed116a0ab4b1136af4fd8f125812eae04
7
+ data.tar.gz: b73c03bb119f003a5d8b8acacf719fa162b8aa8f292dc553a37c7efe63deb6a56e9812e780a297a1c89a286e2ef92da3eff3e0ba7bbdc945984d33d3bc330a19
@@ -2,11 +2,19 @@
2
2
  - if link
3
3
  = link_to text, path, class: classes, **options.except(:class)
4
4
  - else
5
- = button_to text, path, method:, class: classes, **options.except(:class)
5
+ - if type&.to_sym == :submit
6
+ %button{ type: :submit, name: :commit, class: classes, **options.except(:class) }
7
+ = text
8
+ - else
9
+ = button_to text, path, method:, class: classes, **options.except(:class)
6
10
  - else
7
11
  - if link
8
12
  = link_to path, class: classes, **options.except(:class) do
9
13
  = content
10
14
  - else
11
- = button_to path, method:, class: classes, **options.except(:class) do
12
- = content
15
+ - if type&.to_sym == :submit
16
+ %button{ type: :submit, name: :commit, class: classes, **options.except(:class) }
17
+ = content
18
+ - else
19
+ = button_to path, method:, class: classes, **options.except(:class) do
20
+ = content
@@ -5,7 +5,7 @@ module Tailwinds
5
5
  #
6
6
  class ButtonComponent < BaseComponent
7
7
  option :text, optional: true, default: -> {}
8
- option :path
8
+ option :path, optional: true, default: -> { '#' }
9
9
  option :color, optional: true
10
10
  option :type, optional: true
11
11
  option :size, default: -> { :middle }
@@ -14,12 +14,11 @@ module Tailwinds
14
14
  option :options, optional: true, default: -> { {} }
15
15
 
16
16
  def size_classes
17
- case size
18
- when :small
19
- 'text-sm py-1 px-2 rounded' # small button
20
- when :middle
21
- 'py-2 px-4' # middle button
22
- end
17
+ {
18
+ small: 'text-sm py-1 px-2 rounded',
19
+ middle: 'py-2 px-4',
20
+ large: 'text-lg px-5 py-3'
21
+ }[size]
23
22
  end
24
23
 
25
24
  TYPE_COLOR_MAP = {
@@ -37,7 +36,8 @@ module Tailwinds
37
36
  love: :violet,
38
37
  compassion: :indigo,
39
38
  compassio: :indigo,
40
- fear: :yellow
39
+ fear: :yellow,
40
+ submit: :green
41
41
  }.freeze
42
42
 
43
43
  def classes
@@ -49,13 +49,7 @@ module Tailwinds
49
49
 
50
50
  def default_classes
51
51
  [
52
- 'btn',
53
- 'btn-primary',
54
- 'font-bold',
55
- 'rounded-sm',
56
- 'flex',
57
- 'flex-row',
58
- size_classes.to_s,
52
+ 'btn', 'btn-primary', 'font-bold', 'rounded-sm', 'flex', 'flex-row', 'whitespace-nowrap', size_classes.to_s,
59
53
  options[:class].to_s
60
54
  ]
61
55
  end
@@ -2,6 +2,11 @@
2
2
  - base_classes = 'bg-red-500 hover:bg-red-700 text-white font-bold rounded focus:outline-none focus:shadow-outline cursor-pointer '
3
3
  - base_classes += 'dark:text-white dark:bg-red-600 dark:hover:bg-red-500 dark:focus:ring-2 dark:focus:ring-red-400'
4
4
  - classes = "#{size_class(:submit_button)} #{base_classes}"
5
- %button{ type: :submit, name: :commit, class: classes, **@options }
6
- = @text
5
+
6
+ = helpers.tramway_button text: @text,
7
+ type: :submit,
8
+ name: :commit,
9
+ size:,
10
+ **@options
11
+
7
12
  = @content
@@ -1,3 +1,3 @@
1
- %li
1
+ %li.whitespace-nowrap
2
2
  = button_to @href, method: @method, class: style, **@options do
3
3
  = content
@@ -1,3 +1,3 @@
1
- %li
1
+ %li.whitespace-nowrap
2
2
  = link_to @href, class: style, **@options do
3
3
  = content
@@ -101,6 +101,7 @@ module.exports = {
101
101
  'font-medium',
102
102
  'font-normal',
103
103
  'text-xs',
104
+ 'whitespace-nowrap',
104
105
 
105
106
  // === Button color presets ===
106
107
  'bg-gray-500',
@@ -36,7 +36,7 @@ module Tramway
36
36
  component 'tailwinds/table/cell', &
37
37
  end
38
38
 
39
- def tramway_button(path:, text: nil, method: :get, link: false, **options)
39
+ def tramway_button(path: nil, text: nil, method: :get, link: false, **options)
40
40
  component 'tailwinds/button',
41
41
  text:,
42
42
  path:,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.6.1.1'
4
+ VERSION = '0.6.1.3'
5
5
  end
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: 0.6.1.1
4
+ version: 0.6.1.3
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-10-28 00:00:00.000000000 Z
12
+ date: 2025-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anyway_config