rails_iowaicon 1.0.4
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 +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +117 -0
- data/compressed/icons.json +1010 -0
- data/lib/rails_iowaicon/errors.rb +19 -0
- data/lib/rails_iowaicon/helper.rb +42 -0
- data/lib/rails_iowaicon/rails_iowaicon.rb +71 -0
- data/lib/rails_iowaicon/railtie.rb +9 -0
- data/lib/rails_iowaicon/version.rb +3 -0
- data/lib/rails_iowaicon.rb +9 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d3ee7e63831c77ae5bc46c22e6d0cf1ba3f68df8801eaa37fdca2bef776e92c9
|
4
|
+
data.tar.gz: 879988f6c79d03e91e7cb9db17ef6370cbea3152a0c5854d156e80b9a1d394ac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4858e690b38a0ed2a4971a1f603869bcc55a8fb2d4c7dd702ba49d82cee9d4ff9a599f0dee0f85ff98dae1f5076d72f16467527085f6bd84b7debe0a6033b21c
|
7
|
+
data.tar.gz: '0081101a7a402f42a43b11fd0711c533896780d03104bdb281000c3f583ad4e0fc96061a6ec05da59207ffd17ee1eb671a058638f58edf31cabeaddc05bd8dc9'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 abeidahmed
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# Rails Heroicon 
|
2
|
+
|
3
|
+
Ruby on Rails views helper for Iowa branded icons. To see
|
4
|
+
all the icons visit [Iowa Branding](https://brand.uiowa.edu/).
|
5
|
+
|
6
|
+
500 icons included as of today.
|
7
|
+
|
8
|
+
> This gem started as a fork of [rails_heroicon](https://github.com/abeidahmed/rails-heroicon)
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem "rails_iowaicon"
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
```bash
|
21
|
+
bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
```bash
|
27
|
+
gem install rails_iowaicon
|
28
|
+
```
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
After installing the gem, call `<%= heroicon "user" %>` on your `erb` template.
|
33
|
+
The first argument is the icon name. All the icons are listed [here](https://heroicons.com/).
|
34
|
+
|
35
|
+
This will generate the following html:
|
36
|
+
|
37
|
+
```html
|
38
|
+
<svg
|
39
|
+
width="24"
|
40
|
+
height="24"
|
41
|
+
viewBox="0 0 24 24"
|
42
|
+
fill="none"
|
43
|
+
stroke="currentColor"
|
44
|
+
version="1.1"
|
45
|
+
>
|
46
|
+
<path
|
47
|
+
d="M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z"
|
48
|
+
stroke-width="2"
|
49
|
+
stroke-linecap="round"
|
50
|
+
stroke-linejoin="round"
|
51
|
+
/>
|
52
|
+
<path
|
53
|
+
d="M12 14C8.13401 14 5 17.134 5 21H19C19 17.134 15.866 14 12 14Z"
|
54
|
+
stroke-width="2"
|
55
|
+
stroke-linecap="round"
|
56
|
+
stroke-linejoin="round"
|
57
|
+
/>
|
58
|
+
</svg>
|
59
|
+
```
|
60
|
+
|
61
|
+
### Variant
|
62
|
+
|
63
|
+
`rails_iowaicon` provides 2 variants, `outline` and `solid`, `outline` being
|
64
|
+
the default.
|
65
|
+
|
66
|
+
To change the variant `<%= iowaicon "graduation-cap", variant: "solid" %>`.
|
67
|
+
|
68
|
+
### HTML attributes
|
69
|
+
|
70
|
+
Any `html` and `eruby` attribute is supported, for eg:
|
71
|
+
|
72
|
+
```erb
|
73
|
+
<%= graduation-cap "graduation-cap", class: "text-gray-500", aria: { label: "user-icon" } %>
|
74
|
+
```
|
75
|
+
|
76
|
+
### Handling the size of the icon
|
77
|
+
|
78
|
+
Normally, if you're just using vanilla iowaicon with [Tailwind CSS](https://tailwindcss.com/),
|
79
|
+
you'd add `w-5 h-5` as classes on the svg element. With `rails_iowaicon`, you just
|
80
|
+
need to set the `size` attribute on the helper method.
|
81
|
+
|
82
|
+
```erb
|
83
|
+
<%= iowaicon "user", size: 20 %>
|
84
|
+
```
|
85
|
+
|
86
|
+
If the `variant` is set as `outline`, `size` automatically defaults to `24`,
|
87
|
+
and if the `variant` is set as `solid`, `size` automatically defaults to `20`.
|
88
|
+
However, this can be over-written with the `size` attribute.
|
89
|
+
|
90
|
+
### Accessibility
|
91
|
+
|
92
|
+
`rails_iowaicon` automatically sets `aria-hidden="true"` if `aria-label` is not
|
93
|
+
set, and if `aria-label` is set, then `role="img"` is set.
|
94
|
+
|
95
|
+
### Tooltip
|
96
|
+
|
97
|
+
You can provide tooltips on hover if you pass in a `title` option. Anything
|
98
|
+
passed into the `title` option will be rendered inside of a
|
99
|
+
`<title>` tag within the rendered SVG, which modern browsers will lean on to
|
100
|
+
display a tooltip on hover.
|
101
|
+
|
102
|
+
## Development
|
103
|
+
|
104
|
+
- Clone the repo
|
105
|
+
- Run `bundle install`, or run `./bin/setup`
|
106
|
+
- Run `bundle exec rake` to run the tests to see if it passing
|
107
|
+
|
108
|
+
## License
|
109
|
+
|
110
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
111
|
+
|
112
|
+
|
113
|
+
## Similar projects
|
114
|
+
|
115
|
+
- [rails_heroicon](https://github.com/abeidahmed/rails_heroicon)Ruby on Rails views helper method for rendering heroicons
|
116
|
+
- [rails_feather](https://github.com/abeidahmed/rails_feather) - Ruby on Rails
|
117
|
+
views helper method for rendering beautiful feather icons.
|