rails_heroicon 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 036e43862972296490064dff1eb9597b6854243121730bb870746dafb1e9a2ae
4
- data.tar.gz: 25c509f874ee1ff535ecbf64b9dbc0f6f2b13393f0635ab0017457ae4757f553
3
+ metadata.gz: 2aed94b6ddf272cc5af1926db6db5b8e03395c5d258fc56ec232f28aa1cf4c9b
4
+ data.tar.gz: 0f20b6f8f11abeaebfe16fae67a2c46e9964019519e475c7036b1e5167f527d9
5
5
  SHA512:
6
- metadata.gz: 4591fb73a8d70483b0a30b88cdfdb78625f2a5aacbff89fad35763090e971c13252d6bf2fc4d68a7b38f052f6796fa4eb47dd426e525d557cee615115c09c300
7
- data.tar.gz: c6a5df14bd328ef13c49334b198ec79975f55f064120e524c3cee98dd66ba3f87765e338b654cf2bddbbe99661a5372ee6720ec3fdb627454588c238d6a0f717
6
+ metadata.gz: 2ceaf42df7a6a8735e9ec20d8de3899c8b956a9553cf57be0c81649c3b8473a285855135b219e8a9a22acc4f420e2477bfd9a8b1f9a26f80c29f881810da01fa
7
+ data.tar.gz: d9386e51465ef3025ffae99f21fc61b8496a20df54cc0b40f40c89afc2e4adba7cb57a096d23ba5c6e04082672321413c8b42dd1cc6b3afd76df4c70eab037b2
@@ -0,0 +1,25 @@
1
+ name: CI
2
+ on: [pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ ruby: [2.7, 3.0]
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@main
12
+
13
+ - name: Setup Ruby
14
+ uses: actions/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+
18
+ - name: Install Dependencies
19
+ run: |
20
+ gem update --system
21
+ gem install bundler
22
+ bundle install --jobs 4 --retry 3
23
+
24
+ - name: Tests
25
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1
4
+
5
+ - Add `rdoc` documentation
6
+ - Add documentation for core methods
7
+
3
8
  ## 0.1.0
4
9
 
5
10
  - Release gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_heroicon (0.1.0.alpha)
4
+ rails_heroicon (0.1.0)
5
5
  nokogiri (>= 1.11.1)
6
6
 
7
7
  GEM
@@ -56,4 +56,4 @@ DEPENDENCIES
56
56
  rubocop (~> 1.7)
57
57
 
58
58
  BUNDLED WITH
59
- 2.2.7
59
+ 2.2.11
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # RailsHeroicon
1
+ # Rails Heroicon ![ci](https://github.com/abeidahmed/rails-heroicon/actions/workflows/ci.yml/badge.svg)
2
2
 
3
- A set of free MIT-licensed high-quality SVG icons for your rails app. To view
3
+ Ruby on Rails `view helpers` for the awesome Heroicons by Steve Schoger. To view
4
4
  all the icons visit [heroicons](https://heroicons.com/).
5
5
 
6
6
  > This gem has no official affiliation with Tailwind labs yet.
@@ -2,6 +2,36 @@ require "action_view"
2
2
 
3
3
  module RailsHeroicon
4
4
  module Helper
5
+ # To add a heroicon, call <tt><%= heroicon "icon_name" %></tt> on your erb template.
6
+ # Head over to https://heroicons.com/ to view all the icons.
7
+ #
8
+ # == Options
9
+ # The helper method accepts mutiple arguments such as:
10
+ #
11
+ # === Variant
12
+ # There are two types of variants: 'outline' and 'solid', the default being the 'outline'.
13
+ # To specify the solid variant, call <tt><%= heroicon "icon_name", variant: :solid %></tt>
14
+ #
15
+ # === Accessibility
16
+ # The helper method automatically sets <tt>aria-hidden=true</tt> if <tt>aria-label</tt> is not set, and
17
+ # if <tt>aria-label</tt> is set, then <tt>role=img</tt> is set automatically.
18
+ #
19
+ # === HTML attributes
20
+ # Any <tt>html</tt> attribute is supported, for eg:
21
+ #
22
+ # <tt><%= heroicon "icon_name", class: "text-gray-500", data: { controller: "icon" } %></tt>
23
+ #
24
+ # === Handling the icon size
25
+ # Normally, if you're just using vanilla heroicons with tailwindcss, you'd set <tt>w-5 h-5</tt> as class attributes
26
+ # on the svg. With this helper, you just need to set the <tt>size</tt> attribute on the icon.
27
+ #
28
+ # <tt><%= heroicon "icon_name", size: 20 %></tt>
29
+ #
30
+ # This will set the <tt>height</tt> and <tt>width</tt> attribute on the svg.
31
+ #
32
+ # If the variant is set as <tt>outline</tt>, size automatically defaults to 24, and if the variant is set as
33
+ # <tt>solid</tt>, size automatically defaults to 20. However, this can be over-written with the <tt>size</tt>
34
+ # attribute.
5
35
  def heroicon(symbol, **options)
6
36
  icon = RailsHeroicon.new(symbol, **options)
7
37
  content_tag(:svg, icon.svg_path.html_safe, icon.options)
@@ -26,6 +26,7 @@ module RailsHeroicon
26
26
  })
27
27
  end
28
28
 
29
+ # Finds the svg icon with respect to variant.
29
30
  def svg_path
30
31
  file_path = if solid?
31
32
  "#{SOLID_ICON_PATH}/#{@icon}.svg"
@@ -56,6 +57,8 @@ module RailsHeroicon
56
57
  accessible
57
58
  end
58
59
 
60
+ # If the user has explicitly stated the size attribute, then use that. If size attribute is not passed
61
+ # then default to 24 if variant is outline, else default to 20 if variant is solid.
59
62
  def icon_size_with(size)
60
63
  if size
61
64
  size
@@ -1,3 +1,3 @@
1
1
  module RailsHeroicon
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_heroicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - abeidahmed
@@ -31,6 +31,7 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/workflows/ci.yml"
34
35
  - ".gitignore"
35
36
  - ".rspec"
36
37
  - ".rubocop.yml"
@@ -502,7 +503,6 @@ files:
502
503
  - lib/rails_heroicon/errors.rb
503
504
  - lib/rails_heroicon/helper.rb
504
505
  - lib/rails_heroicon/rails_heroicon.rb
505
- - lib/rails_heroicon/rails_heroicon_helper.rb
506
506
  - lib/rails_heroicon/railtie.rb
507
507
  - lib/rails_heroicon/version.rb
508
508
  - rails_heroicon.gemspec
@@ -528,7 +528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
528
528
  - !ruby/object:Gem::Version
529
529
  version: '0'
530
530
  requirements: []
531
- rubygems_version: 3.2.3
531
+ rubygems_version: 3.1.4
532
532
  signing_key:
533
533
  specification_version: 4
534
534
  summary: Ruby on Rails view helpers for the awesome Heroicons by Steve Schoger.
@@ -1,10 +0,0 @@
1
- require "action_view"
2
-
3
- module RailsHeroicon
4
- module Helper
5
- def heroicon(symbol, **options)
6
- icon = RailsHeroicon.new(symbol, **options)
7
- content_tag(:svg, icon.svg_path.html_safe, icon.options)
8
- end
9
- end
10
- end