phosphor_icons 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +121 -0
- data/lib/build/data.json +1 -0
- data/lib/phosphor_icons/helper.rb +29 -0
- data/lib/phosphor_icons/icon.rb +63 -0
- data/lib/phosphor_icons/railtie.rb +11 -0
- data/lib/phosphor_icons/version.rb +5 -0
- data/lib/phosphor_icons.rb +14 -0
- data/lib/tasks/transform.rake +60 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4df513626e0433a5543cfe4d3072e7fef44cbb7a240ba3254b6d3a923c089856
|
4
|
+
data.tar.gz: 63ae690f3ed7a5d7b4b36c07dfa6dfb4232683eddd63729dfa23caa02794e260
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 40da2668ec567983f5fe147ba4255f43c94a2fa58a3bd0142ae470ec0825010b54ed8f065dc8c67125e0dc727d08efa11a3b1aac8ba50eca69a7ea53621b1240
|
7
|
+
data.tar.gz: 77d76be65eb64bfae8355e4216e5b6c58ce2642b1ccdc1f502f213591ecbe4dd159ce3a4a2358e7912bc9f296a4345f27af6c0cd6f4863d45749c17361df02d7
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Maful Prayoga
|
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,121 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="./social-phosphor-icons.png" width="1280" title="Social Card Ruby Phosphor Icons">
|
3
|
+
</p>
|
4
|
+
|
5
|
+
# Ruby Phosphor Icons
|
6
|
+
|
7
|
+
A gem to easily include [Phosphor Icons](https://phosphoricons.com) in your Ruby and Rails apps.
|
8
|
+
|
9
|
+
For a full list of available icons see [the assets directory](https://github.com/phosphor-icons/core/tree/c67d7a849f450be1bfe64fd5820471e4019e5ff0/assets) or preview them at [phosphoricons.com](https://phosphoricons.com/).
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
- Ruby 2.7 or higher
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Install the gem and add to the application's Gemfile by executing:
|
18
|
+
|
19
|
+
```sh
|
20
|
+
bundle add phosphor_icons
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require "phosphor_icons"
|
27
|
+
|
28
|
+
icon = PhosphorIcons::Icon.new("alarm")
|
29
|
+
icon.to_svg
|
30
|
+
# <svg class="phosphor-icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M128,32a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,32Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,208ZM61.66,29.66l-32,32A8,8,0,0,1,18.34,50.34l32-32A8,8,0,1,1,61.66,29.66Zm176,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,237.66,61.66ZM184,120a8,8,0,0,1,0,16H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48Z"/></svg>
|
31
|
+
```
|
32
|
+
|
33
|
+
If you are using Ruby on Rails, you can use `phosphor_icon` helper in your views directly
|
34
|
+
|
35
|
+
```erb
|
36
|
+
<%= phosphor_icon "alarm", class: "h-5 w-5 %>
|
37
|
+
```
|
38
|
+
|
39
|
+
## Documentation
|
40
|
+
|
41
|
+
The `Icon` class takes two arguments. The first is the symbol of the icon, and the second is a hash of arguments representing html attributes.
|
42
|
+
|
43
|
+
### `symbol` _(required)_
|
44
|
+
|
45
|
+
This is the name of the Phosphor Icon you want to use. For example `alarm`. [Full list of icons](https://phosphoricons.com)
|
46
|
+
|
47
|
+
### Options
|
48
|
+
|
49
|
+
* `:style` - Apply a specific style to the icon. Available options are `regular` (default), `bold`, `light`, `duotone`, `fill` and `thin`.
|
50
|
+
|
51
|
+
### Attributes
|
52
|
+
|
53
|
+
Once initialized, you can read a few properties from the icon.
|
54
|
+
|
55
|
+
#### `symbol`
|
56
|
+
|
57
|
+
Returns the string of the symbol name
|
58
|
+
|
59
|
+
```rb
|
60
|
+
icon = PhosphorIcons::Icon.new("alarm")
|
61
|
+
icon.symbol
|
62
|
+
# "alarm"
|
63
|
+
```
|
64
|
+
|
65
|
+
#### `style`
|
66
|
+
|
67
|
+
Returns the style of the icon
|
68
|
+
|
69
|
+
```rb
|
70
|
+
icon = PhosphorIcons::Icon.new("alarm", style: :bold)
|
71
|
+
icon.style
|
72
|
+
# "bold"
|
73
|
+
```
|
74
|
+
|
75
|
+
#### `path`
|
76
|
+
|
77
|
+
Path returns the string representation of the path of the icon.
|
78
|
+
|
79
|
+
```rb
|
80
|
+
icon = PhosphorIcons::Icon.new("alarm")
|
81
|
+
icon.path
|
82
|
+
# <path d="M128,32a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,32Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,208ZM61.66,29.66l-32,32A8,8,0,0,1,18.34,50.34l32-32A8,8,0,1,1,61.66,29.66Zm176,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,237.66,61.66ZM184,120a8,8,0,0,1,0,16H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48Z"/>
|
83
|
+
```
|
84
|
+
|
85
|
+
#### `options`
|
86
|
+
|
87
|
+
This is a hash of all the `options` that will be added to the output tag.
|
88
|
+
|
89
|
+
```rb
|
90
|
+
icon = PhosphorIcons::Icon.new("alarm")
|
91
|
+
icon.options
|
92
|
+
# {:class=>"phosphor-icon", :viewBox=>"0 0 256 256", :xmlns=>"http://www.w3.org/2000/svg", :fill=>"currentColor"}
|
93
|
+
```
|
94
|
+
|
95
|
+
### Methods
|
96
|
+
|
97
|
+
#### `to_svg`
|
98
|
+
|
99
|
+
Returns a string of the svg tag
|
100
|
+
|
101
|
+
```rb
|
102
|
+
icon = PhosphorIcons::Icon.new("alarm")
|
103
|
+
icon.to_svg
|
104
|
+
# <svg class="phosphor-icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M128,32a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,32Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,208ZM61.66,29.66l-32,32A8,8,0,0,1,18.34,50.34l32-32A8,8,0,1,1,61.66,29.66Zm176,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,237.66,61.66ZM184,120a8,8,0,0,1,0,16H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48Z"/></svg>
|
105
|
+
```
|
106
|
+
|
107
|
+
## Development
|
108
|
+
|
109
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
110
|
+
|
111
|
+
## Contributing
|
112
|
+
|
113
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/maful/ruby-phosphor-icons. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/maful/ruby-phosphor-icons/blob/main/CODE_OF_CONDUCT.md).
|
114
|
+
|
115
|
+
## License
|
116
|
+
|
117
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
118
|
+
|
119
|
+
## Code of Conduct
|
120
|
+
|
121
|
+
Everyone interacting in the PhosphorIcons project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/maful/ruby-phosphor-icons/blob/main/CODE_OF_CONDUCT.md).
|