heroicons-ruby 0.1.0 → 2.0.0.pre.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +11 -0
- data/lib/heroicons/config.rb +2 -1
- data/lib/heroicons/helper.rb +4 -2
- data/lib/heroicons/icon.rb +3 -3
- data/lib/heroicons/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f341effc5e3fd8c718c7265494aafa2b78dcfdf287794473a8069e1e8033eca
|
4
|
+
data.tar.gz: 968c447e06a755a7316f5870a09291fb90066814d06863669fa9e35dc93fdae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e10eeca46ac23846edf59e8ac053b4fdd174980377478ce62c319baa18365ca751d760eb60857fb19b75ec6fde7cbc9c06aa08b8fbd03f3b3dca38bd7c465d7a
|
7
|
+
data.tar.gz: d910dfe3301e08608aacd896a6f524b21126ecedd94963495a4c180a51756dfdb0191c63470d6ec33dca4af609339ee26d728ee9b004d18c3f04e15b5a893698
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -22,6 +22,8 @@ bundle add heroicons-ruby
|
|
22
22
|
<%= heroicon "arrow-right", class: "h-4 w-4", fill: "none" %>
|
23
23
|
```
|
24
24
|
|
25
|
+
|
26
|
+
## Configuration
|
25
27
|
Valid `variant` values are `%i[mini solid outline]`. The default variant is `solid` however that default can be changed using:
|
26
28
|
|
27
29
|
```ruby
|
@@ -31,6 +33,15 @@ Heroicons.configure do |config|
|
|
31
33
|
end
|
32
34
|
```
|
33
35
|
|
36
|
+
If you would like to specify default HTML attributes (eg. `class="h-4 w-4"`) for a given `variant`, you can configure that like so:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
# config/initializers/heroicons.rb
|
40
|
+
Heroicons.configure do |config|
|
41
|
+
config.attributes[:mini] = { class: "h-4 w-4" }
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
34
45
|
### Rationale
|
35
46
|
|
36
47
|
> Don't libraries already exist for this? Why make another?
|
data/lib/heroicons/config.rb
CHANGED
data/lib/heroicons/helper.rb
CHANGED
@@ -4,8 +4,10 @@ require "action_view/helpers" if defined?(Rails)
|
|
4
4
|
|
5
5
|
module Heroicons
|
6
6
|
module Helper
|
7
|
-
def heroicon(name, variant: Heroicons.config.variant, **
|
8
|
-
icon = Heroicons::Icon.new(name: name,
|
7
|
+
def heroicon(name, variant: Heroicons.config.variant, **attributes)
|
8
|
+
icon = Heroicons::Icon.new(name: name,
|
9
|
+
variant: variant,
|
10
|
+
attributes: Heroicons.config.attributes[variant].merge(attributes))
|
9
11
|
|
10
12
|
raw icon.render
|
11
13
|
end
|
data/lib/heroicons/icon.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module Heroicons
|
4
4
|
class Icon
|
5
|
-
def initialize(name:, variant:,
|
5
|
+
def initialize(name:, variant:, attributes: {})
|
6
6
|
@name = name
|
7
7
|
@variant = variant
|
8
|
-
@
|
8
|
+
@attributes = attributes
|
9
9
|
end
|
10
10
|
|
11
11
|
def render
|
@@ -14,7 +14,7 @@ module Heroicons
|
|
14
14
|
doc = Nokogiri::XML::Document.parse(file)
|
15
15
|
svg = doc.at_css("svg")
|
16
16
|
|
17
|
-
@
|
17
|
+
@attributes.each do |k, v|
|
18
18
|
svg[dasherize(k.to_s)] = v
|
19
19
|
end
|
20
20
|
|
data/lib/heroicons/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroicons-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 2.0.0.pre.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- narciero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -1004,9 +1004,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1004
1004
|
version: '2.7'
|
1005
1005
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1006
1006
|
requirements:
|
1007
|
-
- - "
|
1007
|
+
- - ">"
|
1008
1008
|
- !ruby/object:Gem::Version
|
1009
|
-
version:
|
1009
|
+
version: 1.3.1
|
1010
1010
|
requirements: []
|
1011
1011
|
rubygems_version: 3.4.6
|
1012
1012
|
signing_key:
|