tramway 0.1.5 → 0.1.6
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 +12 -1
- data/app/components/tailwinds/navbar_component.html.haml +1 -1
- data/app/components/tailwinds/navbar_component.rb +23 -0
- data/lib/tramway/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5d6641dda4dedcf7e4d1a4e0638690e21b5f72fbfdccca6c40fa423eec9e3f8
|
4
|
+
data.tar.gz: c0e4e0955c58b253c5aac6198302b6c11f3393f42d5edfd4fc317dd7b1a7894b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2b1fd87395239845d1eeb4e901e44063e1487bdd83f226a247746dc1bc4fc555cfba4c8357345486dd31e5f5e8c0b5be59e2831e599a87d9c10632b221ad64e
|
7
|
+
data.tar.gz: eb6e88f325e65e1c49094a197a58419c11c71a5c24f78a5132167798ea4bff644c0a6d98320b073d16cea1b8baa258fa2300583474e95223e0f4ba09e9152327
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Tramway use [Tailwind](https://tailwindcss.com/) by default. All UI helpers impl
|
|
20
20
|
Tramway provides DSL for rendering Tailwind Navgiation bar.
|
21
21
|
|
22
22
|
```ruby
|
23
|
-
tramway_navbar title: 'Purple Magic' do |nav|
|
23
|
+
tramway_navbar title: 'Purple Magic', background: { color: :red, intensity: 500 } do |nav|
|
24
24
|
nav.left do
|
25
25
|
nav.item 'Users', '/users'
|
26
26
|
nav.item 'Podcasts', '/podcasts'
|
@@ -34,6 +34,17 @@ end
|
|
34
34
|
|
35
35
|
will render [this](https://play.tailwindcss.com/UZPTCudFw5)
|
36
36
|
|
37
|
+
#### tramway_navbar
|
38
|
+
|
39
|
+
This helper provides several options. Here is YAML view of `tramway_navbar` options structure
|
40
|
+
|
41
|
+
```yaml
|
42
|
+
title: String that will be added to the left side of the navbar
|
43
|
+
background:
|
44
|
+
color: Css-color. Supports all named CSS colors and HEX colors
|
45
|
+
intensity: Color intensity. Range: **100..950**. Used by Tailwind. Not supported in case of using HEX color in the background.color
|
46
|
+
```
|
47
|
+
|
37
48
|
#### nav.left and nav.right
|
38
49
|
|
39
50
|
Tramway navbar provides `left` and `right` methods that puts items to left and right part of navbar.
|
@@ -8,6 +8,29 @@ module Tailwinds
|
|
8
8
|
@title = options[:title]
|
9
9
|
@left_items = options[:left_items]
|
10
10
|
@right_items = options[:right_items]
|
11
|
+
@color = background(options)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
CSS_COLORS = %i[aqua black blue fuchsia gray green lime maroon navy olive orange purple red
|
17
|
+
silver teal white yellow].freeze
|
18
|
+
MIN_INTENSITY = 100
|
19
|
+
MAX_INTENSITY = 950
|
20
|
+
|
21
|
+
def background(options)
|
22
|
+
color = options.dig(:background, :color) || :purple
|
23
|
+
intensity = options.dig(:background, :intensity) || 700
|
24
|
+
|
25
|
+
unless (MIN_INTENSITY..MAX_INTENSITY).cover?(intensity)
|
26
|
+
raise "Navigation Background Color intensity should be between #{MIN_INTENSITY} and #{MAX_INTENSITY}"
|
27
|
+
end
|
28
|
+
|
29
|
+
if color.in? CSS_COLORS
|
30
|
+
"#{color}-#{intensity}"
|
31
|
+
else
|
32
|
+
"[#{color}]"
|
33
|
+
end
|
11
34
|
end
|
12
35
|
end
|
13
36
|
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: 0.1.
|
4
|
+
version: 0.1.6
|
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: 2023-06-
|
12
|
+
date: 2023-06-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml-rails
|