rails_heroicon 1.0.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/compressed/icons.json +842 -460
- data/lib/rails_heroicon/rails_heroicon.rb +25 -17
- data/lib/rails_heroicon/version.rb +1 -1
- metadata +18 -4
@@ -2,7 +2,7 @@ require_relative "errors"
|
|
2
2
|
|
3
3
|
module RailsHeroicon
|
4
4
|
class RailsHeroicon
|
5
|
-
VARIANTS = %w[outline solid].freeze
|
5
|
+
VARIANTS = %w[outline solid mini].freeze
|
6
6
|
|
7
7
|
attr_reader :options
|
8
8
|
|
@@ -15,14 +15,7 @@ module RailsHeroicon
|
|
15
15
|
@size = icon_size_with(size)
|
16
16
|
|
17
17
|
@options.merge!(a11y)
|
18
|
-
@options.merge!(
|
19
|
-
viewBox: outline? ? "0 0 24 24" : "0 0 20 20",
|
20
|
-
height: @size,
|
21
|
-
width: @size,
|
22
|
-
version: "1.1",
|
23
|
-
fill: outline? ? "none" : "currentColor",
|
24
|
-
stroke: solid? ? "none" : "currentColor"
|
25
|
-
})
|
18
|
+
@options.merge!(misc)
|
26
19
|
end
|
27
20
|
|
28
21
|
# Finds the svg icon with respect to variant.
|
@@ -47,16 +40,27 @@ module RailsHeroicon
|
|
47
40
|
accessible
|
48
41
|
end
|
49
42
|
|
43
|
+
def misc
|
44
|
+
hash = {}
|
45
|
+
|
46
|
+
hash[:viewBox] = mini? ? "0 0 20 20" : "0 0 24 24"
|
47
|
+
hash[:height] = @size
|
48
|
+
hash[:width] = @size
|
49
|
+
hash[:version] = "1.1"
|
50
|
+
hash[:fill] = outline? ? "none" : "currentColor"
|
51
|
+
hash[:stroke] = outline? ? "currentColor" : "none"
|
52
|
+
hash[:"stroke-width"] = "1.5" if outline?
|
53
|
+
|
54
|
+
hash
|
55
|
+
end
|
56
|
+
|
50
57
|
# 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, else default to 20 if variant is
|
58
|
+
# then default to 24 if variant is outline or solid, else default to 20 if variant is mini.
|
52
59
|
def icon_size_with(size)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
else
|
58
|
-
size
|
59
|
-
end
|
60
|
+
return size if size
|
61
|
+
return 20 if mini?
|
62
|
+
|
63
|
+
24
|
60
64
|
end
|
61
65
|
|
62
66
|
def outline?
|
@@ -66,5 +70,9 @@ module RailsHeroicon
|
|
66
70
|
def solid?
|
67
71
|
@variant == "solid"
|
68
72
|
end
|
73
|
+
|
74
|
+
def mini?
|
75
|
+
@variant == "mini"
|
76
|
+
end
|
69
77
|
end
|
70
78
|
end
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_heroicon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- abeidahmed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: actionview
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: railties
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
@@ -63,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
77
|
- !ruby/object:Gem::Version
|
64
78
|
version: '0'
|
65
79
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
80
|
+
rubygems_version: 3.3.7
|
67
81
|
signing_key:
|
68
82
|
specification_version: 4
|
69
83
|
summary: Ruby on Rails view helpers for the awesome Heroicons by Steve Schoger.
|