rails_heroicon 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +5 -5
- data/compressed/icons.json +1180 -878
- data/lib/rails_heroicon/rails_heroicon.rb +17 -5
- data/lib/rails_heroicon/version.rb +1 -1
- metadata +2 -2
@@ -2,7 +2,7 @@ require_relative "errors"
|
|
2
2
|
|
3
3
|
module RailsHeroicon
|
4
4
|
class RailsHeroicon
|
5
|
-
VARIANTS = %w[outline solid mini].freeze
|
5
|
+
VARIANTS = %w[outline solid mini micro].freeze
|
6
6
|
|
7
7
|
attr_reader :options
|
8
8
|
|
@@ -12,7 +12,7 @@ module RailsHeroicon
|
|
12
12
|
@icon = icon.to_s
|
13
13
|
@variant = variant.to_s
|
14
14
|
@options = options.dup
|
15
|
-
@size =
|
15
|
+
@size = default_or_defined_size(size)
|
16
16
|
@options.merge!(svg_properties)
|
17
17
|
end
|
18
18
|
|
@@ -30,7 +30,7 @@ module RailsHeroicon
|
|
30
30
|
properties = {}
|
31
31
|
|
32
32
|
properties[:xmlns] = "http://www.w3.org/2000/svg"
|
33
|
-
properties[:viewBox] =
|
33
|
+
properties[:viewBox] = view_box
|
34
34
|
properties[:height] = @size
|
35
35
|
properties[:width] = @size
|
36
36
|
properties[:version] = "1.1"
|
@@ -48,9 +48,11 @@ module RailsHeroicon
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# If the user has explicitly stated the size attribute, then use that. If size attribute is not passed
|
51
|
-
# then default to 24 if variant is outline or solid, else default to 20 if variant is mini
|
52
|
-
|
51
|
+
# then default to 24 if variant is outline or solid, else default to 20 if variant is mini, else default to 16 if
|
52
|
+
# variant is micro.
|
53
|
+
def default_or_defined_size(size)
|
53
54
|
return size if size
|
55
|
+
return 16 if micro?
|
54
56
|
return 20 if mini?
|
55
57
|
|
56
58
|
24
|
@@ -61,6 +63,12 @@ module RailsHeroicon
|
|
61
63
|
@options[:"stroke-width"] || 1.5
|
62
64
|
end
|
63
65
|
|
66
|
+
def view_box
|
67
|
+
return "0 0 20 20" if mini?
|
68
|
+
return "0 0 16 16" if micro?
|
69
|
+
"0 0 24 24"
|
70
|
+
end
|
71
|
+
|
64
72
|
def outline?
|
65
73
|
@variant == "outline"
|
66
74
|
end
|
@@ -72,5 +80,9 @@ module RailsHeroicon
|
|
72
80
|
def mini?
|
73
81
|
@variant == "mini"
|
74
82
|
end
|
83
|
+
|
84
|
+
def micro?
|
85
|
+
@variant == "micro"
|
86
|
+
end
|
75
87
|
end
|
76
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_heroicon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- abeidahmed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|