octicons 17.12.0 → 18.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +99 -1
- data/lib/build/data.json +1 -1
- data/lib/build/svg/issue-tracked-by-16.svg +1 -1
- data/lib/build/svg/issue-tracked-by-24.svg +1 -1
- data/lib/build/svg/issue-tracks-16.svg +1 -0
- data/lib/build/svg/issue-tracks-24.svg +1 -0
- data/lib/build/svg/shield-slash-24.svg +1 -0
- data/lib/octicons/version.rb +1 -1
- metadata +5 -4
- data/lib/build/svg/issue-tracked-in-16.svg +0 -1
- data/lib/build/svg/issue-tracked-in-24.svg +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc68ffeef66286d0987ebc17f5d4518be09a1d3235662b10d4099c2f1428d3b6
|
4
|
+
data.tar.gz: e510e50cd05d3cf017e537af2859cf5ea7097e95c93cfdc1be97aad33393d878
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b5a0585fb05fa7e6d0c180651646a44161f8547748f769beb4dc6c3a3ce0ea13258d79bc44008240a6e9c65f5aa94cfe2d2701d9f2b5fa6fdaf277bf1f8064
|
7
|
+
data.tar.gz: e3ed4c9bf98105b6a6f54aef8a17f869fd82c288a8a49177a9f40e161abef6ff61a37f6161c1d31fc360ef62493d6f97f99088bed2e5d95c5680e9873b98fead
|
data/README.md
CHANGED
@@ -2,4 +2,102 @@
|
|
2
2
|
|
3
3
|
[![Gem version](https://img.shields.io/gem/v/octicons.svg)](https://rubygems.org/gems/octicons)
|
4
4
|
|
5
|
-
|
5
|
+
## Install
|
6
|
+
|
7
|
+
Add this to your `Gemfile`
|
8
|
+
|
9
|
+
```rb
|
10
|
+
gem 'octicons'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then `bundle install`.
|
14
|
+
|
15
|
+
If using a framework like Rails, please follow the [installation instructions](https://primer.style/view-components/#installation) in the [Primer ViewComponents](https://primer.style/view-components) documentation.
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```rb
|
20
|
+
require 'octicons'
|
21
|
+
icon = Octicons::Octicon.new("x")
|
22
|
+
icon.to_svg
|
23
|
+
# <svg class="octicon octicon-x" viewBox="0 0 16 16" width="16" height="16" version="1.1" "aria-hidden"="true"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
|
24
|
+
```
|
25
|
+
|
26
|
+
## Documentation
|
27
|
+
|
28
|
+
The `Octicon` class takes two arguments. The first is the symbol of the icon, and the second is a hash of arguments representing html attributes
|
29
|
+
|
30
|
+
### `symbol` _(required)_
|
31
|
+
|
32
|
+
This is the name of the octicon you want to use. For example `alert`. [Full list of icons](/)
|
33
|
+
|
34
|
+
### Options
|
35
|
+
|
36
|
+
* `:height` - When setting the height to a number, the icon will scale to that size. For example, passing `32`, will calculate the width based on the icon's natural size.
|
37
|
+
* `:width` - When setting the width to a number, the icon will scale to that size. For example, passing `32`, will calculate the width based on the icon's natural size.
|
38
|
+
|
39
|
+
If both `:width, :height` are passed into the options hash, then the icon will be sized exactly at those dimensions.
|
40
|
+
|
41
|
+
### Attributes
|
42
|
+
|
43
|
+
Once initialized, you can read a few properties from the icon.
|
44
|
+
|
45
|
+
#### `symbol`
|
46
|
+
|
47
|
+
Returns the string of the symbol name
|
48
|
+
|
49
|
+
```rb
|
50
|
+
icon = Octicons::Octicon.new("x")
|
51
|
+
icon.symbol
|
52
|
+
# "x"
|
53
|
+
```
|
54
|
+
|
55
|
+
#### `path`
|
56
|
+
|
57
|
+
Path returns the string representation of the path of the icon.
|
58
|
+
|
59
|
+
```rb
|
60
|
+
icon = Octicons::Octicon.new("x")
|
61
|
+
icon.path
|
62
|
+
# <path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path>
|
63
|
+
```
|
64
|
+
|
65
|
+
#### `options`
|
66
|
+
|
67
|
+
This is a hash of all the `options` that will be added to the output tag.
|
68
|
+
|
69
|
+
```rb
|
70
|
+
icon = Octicons::Octicon.new("x")
|
71
|
+
icon.options
|
72
|
+
# {:class=>"octicon octicon-x", :viewBox=>"0 0 12 16", :version=>"1.1", :width=>12, :height=>16, :"aria-hidden"=>"true"}
|
73
|
+
```
|
74
|
+
|
75
|
+
#### `width`
|
76
|
+
|
77
|
+
Width is the icon's true width. Based on the svg view box width. _Note, this doesn't change if you scale it up with size options, it only is the natural width of the icon_
|
78
|
+
|
79
|
+
#### `height`
|
80
|
+
|
81
|
+
Height is the icon's true height. Based on the svg view box height. _Note, this doesn't change if you scale it up with size options, it only is the natural height of the icon_
|
82
|
+
|
83
|
+
#### `keywords`
|
84
|
+
|
85
|
+
Returns an array of keywords for the icon. The data comes from the [data file in lib](../data.json). Consider contributing more aliases for the icons.
|
86
|
+
|
87
|
+
```rb
|
88
|
+
icon = Octicons::Octicon.new("x")
|
89
|
+
icon.keywords
|
90
|
+
# ["remove", "close", "delete"]
|
91
|
+
```
|
92
|
+
|
93
|
+
### Methods
|
94
|
+
|
95
|
+
#### `to_svg`
|
96
|
+
|
97
|
+
Returns a string of the svg tag
|
98
|
+
|
99
|
+
```rb
|
100
|
+
icon = Octicons::Octicon.new("x")
|
101
|
+
icon.to_svg
|
102
|
+
# <svg class="octicon octicon-x" viewBox="0 0 16 16" width="16" height="16" version="1.1" "aria-hidden"="true"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
|
103
|
+
```
|