tramway 0.1.3 → 0.1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '084eca40c591bb6705843669a4983d864fda457337341a75ebee213bd43e8b93'
4
- data.tar.gz: a1c3158c7f921668ff8d811606abdeddf9fd4e1aac369d3e8f292e5af93539ca
3
+ metadata.gz: 0c47949a76aef2c3d5dc7e663bb34012b3450fbbe6f699e4ca7e9d0d98a9613f
4
+ data.tar.gz: 1bbed346affab3a710234b4848af549200ae94cb1f3d05f97b3c7bd3acd63dcf
5
5
  SHA512:
6
- metadata.gz: b9b5fcb0b7f8a1d9e9b4cdc0b4f5064aefa8bab4ae306c47f73635fef93f30016a95b7e341459af975131b55200ff8ca42c48d10fa995f80df7aff25e0f74f43
7
- data.tar.gz: 8e1a52e17db4074f041e778a2790181c4b673d555fb384c3bc79c9cf929376fc1dcf24d345a5c571bc20b248fdc1073e67bae3b8c46e5950e89fb3766d83e1cb
6
+ metadata.gz: 7119b80a25ff0a302a3b8fd36b10877ce9f256952faf784d88097e7c0862e770f88eb948e909efc6a431ce273817f3847e17296211946bdfd95113984770658b
7
+ data.tar.gz: 8fc6359c32257287ee3ae2383dfb502d6ed8415a15c1b6e977bbfed087cf4f1352316a2afb2db4657930a3ff4f75cc114a973b1b00bf5ef8c82db18dea833b14
data/README.md CHANGED
@@ -1,28 +1,48 @@
1
1
  # Tramway
2
- Short description and motivation.
3
-
4
- ## Usage
5
- How to use my plugin.
2
+ Unite Ruby on Rails brilliance. Streamline development with Tramway.
6
3
 
7
4
  ## Installation
8
5
  Add this line to your application's Gemfile:
9
6
 
10
7
  ```ruby
11
8
  gem "tramway"
9
+ gem "view_component"
12
10
  ```
13
11
 
14
- And then execute:
15
- ```bash
16
- $ bundle
12
+ ## Usage
13
+
14
+ ### Tailwind components
15
+
16
+ Tramway use [Tailwind](https://tailwindcss.com/) by default. All UI helpers implemented with [ViewComponent](https://github.com/viewcomponent/view_component).
17
+
18
+ ### Navbar
19
+
20
+ #### Button
21
+
22
+ Tramway provides `Tailwinds::Navbar::ButtonComponent`, that uses `button_to` or `link_to`
23
+
24
+ ```haml
25
+ = render(Tailwinds::Navbar::ButtonComponent.new(href: "/users/sign_in")) do
26
+ Sign In
17
27
  ```
18
28
 
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install tramway
29
+ will render [this](https://play.tailwindcss.com/RT3Vvauu78)
30
+
31
+ ```haml
32
+ = render(Tailwinds::Navbar::ButtonComponent.new(action: "/users/sign_out", method: :delete)) do
33
+ Sign Out
22
34
  ```
23
35
 
36
+ will render [this](https://play.tailwindcss.com/pJ8450tV21)
37
+
24
38
  ## Contributing
25
- Contribution directions go here.
39
+
40
+ Install [lefthook](https://github.com/evilmartians/lefthook)
41
+
42
+ ```
43
+ bundle
44
+ lefthook install
45
+ ```
26
46
 
27
47
  ## License
28
48
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1 +1,6 @@
1
- = button_to @text, @href, class: 'text-white hover:bg-red-300 px-4 py-2 rounded'
1
+ - if @action.present?
2
+ = button_to @action, class: @style, **@options do
3
+ = content
4
+ - else
5
+ = link_to @href, class: @style, **@options do
6
+ = content
@@ -2,12 +2,18 @@
2
2
 
3
3
  module Tailwinds
4
4
  module Navbar
5
- # Render button styled with Tailwind
5
+ # Render button styled with Tailwind using button_to or link_to methods
6
6
  #
7
7
  class ButtonComponent < TailwindComponent
8
- def initialize(text:, href:)
9
- @href = href
10
- @text = text
8
+ def initialize(**options)
9
+ if options[:action].present?
10
+ @action = options[:action]
11
+ else
12
+ @href = options[:href]
13
+ end
14
+
15
+ @style = 'text-white hover:bg-red-300 px-4 py-2 rounded'
16
+ @options = options.except(:action, :href)
11
17
  end
12
18
  end
13
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.3.1'
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.1.3
4
+ version: 0.1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme