tramway 0.1.3 → 0.1.3.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c47949a76aef2c3d5dc7e663bb34012b3450fbbe6f699e4ca7e9d0d98a9613f
|
4
|
+
data.tar.gz: 1bbed346affab3a710234b4848af549200ae94cb1f3d05f97b3c7bd3acd63dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7119b80a25ff0a302a3b8fd36b10877ce9f256952faf784d88097e7c0862e770f88eb948e909efc6a431ce273817f3847e17296211946bdfd95113984770658b
|
7
|
+
data.tar.gz: 8fc6359c32257287ee3ae2383dfb502d6ed8415a15c1b6e977bbfed087cf4f1352316a2afb2db4657930a3ff4f75cc114a973b1b00bf5ef8c82db18dea833b14
|
data/README.md
CHANGED
@@ -1,28 +1,48 @@
|
|
1
1
|
# Tramway
|
2
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
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).
|
@@ -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(
|
9
|
-
|
10
|
-
|
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
|
data/lib/tramway/version.rb
CHANGED