phosphor_icons 0.1.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4df513626e0433a5543cfe4d3072e7fef44cbb7a240ba3254b6d3a923c089856
4
- data.tar.gz: 63ae690f3ed7a5d7b4b36c07dfa6dfb4232683eddd63729dfa23caa02794e260
3
+ metadata.gz: 7c8180d026cf26cafca6e51f0e3bcc0ba59e29e766f41fa834c5231ebd6bbe70
4
+ data.tar.gz: 600147895d61c593990214f25a8af6e0d432a9b0a71857388ac5a87bc6b689f5
5
5
  SHA512:
6
- metadata.gz: 40da2668ec567983f5fe147ba4255f43c94a2fa58a3bd0142ae470ec0825010b54ed8f065dc8c67125e0dc727d08efa11a3b1aac8ba50eca69a7ea53621b1240
7
- data.tar.gz: 77d76be65eb64bfae8355e4216e5b6c58ce2642b1ccdc1f502f213591ecbe4dd159ce3a4a2358e7912bc9f296a4345f27af6c0cd6f4863d45749c17361df02d7
6
+ metadata.gz: 4d3b6fa323531dc01692250db257c2fad143d065cf7fb621ccc0e15e45b9d0767fe443105d838c86fb3451e50e5d67ac84ad9c0843a49ef675198adcf602b837
7
+ data.tar.gz: b4a663991c0d8fdc83641ea313be72c3bc612ca50dad88e4d718001e7278131004b2843b1dc34f3889214e7cbf0fc7d1d9ba459bac533518987410a9d31de32c
data/README.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  # Ruby Phosphor Icons
6
6
 
7
+ <a href="https://github.com/maful/ruby-phosphor-icons/actions?query=workflow%3ACI">
8
+ <img src="https://github.com/maful/ruby-phosphor-icons/actions/workflows/ci.yml/badge.svg" alt="Tests">
9
+ </a>
10
+ <a href="https://rubygems.org/gems/phosphor_icons">
11
+ <img src="https://img.shields.io/gem/v/phosphor_icons" alt="Latest Stable Version">
12
+ </a>
13
+
7
14
  A gem to easily include [Phosphor Icons](https://phosphoricons.com) in your Ruby and Rails apps.
8
15
 
9
16
  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/).
@@ -20,6 +27,12 @@ Install the gem and add to the application's Gemfile by executing:
20
27
  bundle add phosphor_icons
21
28
  ```
22
29
 
30
+ or add this in your Gemfile
31
+
32
+ ```rb
33
+ gem "phosphor_icons"
34
+ ```
35
+
23
36
  ## Usage
24
37
 
25
38
  ```ruby
@@ -27,13 +40,14 @@ require "phosphor_icons"
27
40
 
28
41
  icon = PhosphorIcons::Icon.new("alarm")
29
42
  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>
43
+ # <svg class="phosphor-icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="24" height="24"><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
44
  ```
32
45
 
33
46
  If you are using Ruby on Rails, you can use `phosphor_icon` helper in your views directly
34
47
 
35
48
  ```erb
36
- <%= phosphor_icon "alarm", class: "h-5 w-5 %>
49
+ <%= phosphor_icon "alarm", class: "h-5 w-5" %>
50
+ <%= phosphor_icon "x", height: 48 %>
37
51
  ```
38
52
 
39
53
  ## Documentation
@@ -47,6 +61,8 @@ This is the name of the Phosphor Icon you want to use. For example `alarm`. [Ful
47
61
  ### Options
48
62
 
49
63
  * `:style` - Apply a specific style to the icon. Available options are `regular` (default), `bold`, `light`, `duotone`, `fill` and `thin`.
64
+ * `:height` - When setting the height to a number, the icon will scale to that size. For example, passing `24`, will calculate the width based on the icon's natural size.
65
+ * `:width` - When setting the width to a number, the icon will scale to that size. For example, passing `24`, will calculate the width based on the icon's natural size.
50
66
 
51
67
  ### Attributes
52
68
 
@@ -89,7 +105,27 @@ This is a hash of all the `options` that will be added to the output tag.
89
105
  ```rb
90
106
  icon = PhosphorIcons::Icon.new("alarm")
91
107
  icon.options
92
- # {:class=>"phosphor-icon", :viewBox=>"0 0 256 256", :xmlns=>"http://www.w3.org/2000/svg", :fill=>"currentColor"}
108
+ # {:class=>"phosphor-icon", :viewBox=>"0 0 256 256", :xmlns=>"http://www.w3.org/2000/svg", :fill=>"currentColor", :width=>24, :height=>24}
109
+ ```
110
+
111
+ #### `width`
112
+
113
+ Width is the icon's true width.
114
+
115
+ ```rb
116
+ icon = PhosphorIcons::Icon.new("alarm", width: 24)
117
+ icon.height
118
+ # 24
119
+ ```
120
+
121
+ #### `height`
122
+
123
+ Height is the icon's true height.
124
+
125
+ ```rb
126
+ icon = PhosphorIcons::Icon.new("alarm", height: 24)
127
+ icon.height
128
+ # 24
93
129
  ```
94
130
 
95
131
  ### Methods
@@ -101,7 +137,7 @@ Returns a string of the svg tag
101
137
  ```rb
102
138
  icon = PhosphorIcons::Icon.new("alarm")
103
139
  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>
140
+ # <svg class="phosphor-icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="24" height="24"><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
141
  ```
106
142
 
107
143
  ## Development