Add default outline option
This commit is contained in:
@ -99,9 +99,11 @@ defmodule Heroicons do
|
||||
<Heroicons.<%= func %> class="w-4 h-4" />
|
||||
<Heroicons.<%= func %> solid />
|
||||
<Heroicons.<%= func %> mini />
|
||||
<Heroicons.<%= func %> outline />
|
||||
```
|
||||
"""
|
||||
attr :rest, :global, doc: "the arbitrary HTML attributes for the svg container"
|
||||
attr :outline, :boolean, default: true
|
||||
attr :solid, :boolean, default: false
|
||||
attr :mini, :boolean, default: false
|
||||
|
||||
|
586
lib/heroicons.ex
586
lib/heroicons.ex
File diff suppressed because it is too large
Load Diff
@ -34,10 +34,20 @@ defmodule HeroiconsTest do
|
||||
|
||||
class = "w-2"
|
||||
|
||||
assert render_component(&Heroicons.cake/1, %{mini: true, class: "w-2"}) ==
|
||||
assert render_component(&Heroicons.cake/1, %{mini: true, class: class}) ==
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"#{class}\">\n <path d=\"M6.75.98l-.884.883a1.25 1.25 0 101.768 0L6.75.98zM13.25.98l-.884.883a1.25 1.25 0 101.768 0L13.25.98zM10 .98l.884.883a1.25 1.25 0 11-1.768 0L10 .98zM7.5 5.75a.75.75 0 00-1.5 0v.464c-1.179.305-2 1.39-2 2.622v.094c.1-.02.202-.038.306-.051A42.869 42.869 0 0110 8.5c1.93 0 3.83.129 5.694.379.104.013.206.03.306.051v-.094c0-1.232-.821-2.317-2-2.622V5.75a.75.75 0 00-1.5 0v.318a45.645 45.645 0 00-1.75-.062V5.75a.75.75 0 00-1.5 0v.256c-.586.01-1.17.03-1.75.062V5.75zM4.505 10.365A41.377 41.377 0 0110 10c1.863 0 3.697.124 5.495.365C16.967 10.562 18 11.838 18 13.28v.693a3.72 3.72 0 01-1.665-.393 5.222 5.222 0 00-4.67 0 3.722 3.722 0 01-3.33 0 5.222 5.222 0 00-4.67 0A3.72 3.72 0 012 13.972v-.693c0-1.441 1.033-2.716 2.505-2.914zM15.665 14.921a5.22 5.22 0 002.335.551V16.5a1.5 1.5 0 01-1.5 1.5h-13A1.5 1.5 0 012 16.5v-1.028c.8 0 1.6-.183 2.335-.551a3.722 3.722 0 013.33 0c1.47.735 3.2.735 4.67 0a3.722 3.722 0 013.33 0z\"/>\n</svg>"
|
||||
end
|
||||
|
||||
test "outline" do
|
||||
assert render_component(&Heroicons.cake/1, %{outline: true}) ==
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 8.25v-1.5m0 1.5c-1.355 0-2.697.056-4.024.166C6.845 8.51 6 9.473 6 10.608v2.513m6-4.87c1.355 0 2.697.055 4.024.165C17.155 8.51 18 9.473 18 10.608v2.513m-3-4.87v-1.5m-6 1.5v-1.5m12 9.75l-1.5.75a3.354 3.354 0 01-3 0 3.354 3.354 0 00-3 0 3.354 3.354 0 01-3 0 3.354 3.354 0 00-3 0 3.354 3.354 0 01-3 0L3 16.5m15-3.38a48.474 48.474 0 00-6-.37c-2.032 0-4.034.125-6 .37m12 0c.39.049.777.102 1.163.16 1.07.16 1.837 1.094 1.837 2.175v5.17c0 .62-.504 1.124-1.125 1.124H4.125A1.125 1.125 0 013 20.625v-5.17c0-1.08.768-2.014 1.837-2.174A47.78 47.78 0 016 13.12M12.265 3.11a.375.375 0 11-.53 0L12 2.845l.265.265zm-3 0a.375.375 0 11-.53 0L9 2.845l.265.265zm6 0a.375.375 0 11-.53 0L15 2.845l.265.265z\"/>\n</svg>"
|
||||
|
||||
class = "w-2"
|
||||
|
||||
assert render_component(&Heroicons.cake/1, %{outline: true, class: class}) ==
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"#{class}\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 8.25v-1.5m0 1.5c-1.355 0-2.697.056-4.024.166C6.845 8.51 6 9.473 6 10.608v2.513m6-4.87c1.355 0 2.697.055 4.024.165C17.155 8.51 18 9.473 18 10.608v2.513m-3-4.87v-1.5m-6 1.5v-1.5m12 9.75l-1.5.75a3.354 3.354 0 01-3 0 3.354 3.354 0 00-3 0 3.354 3.354 0 01-3 0 3.354 3.354 0 00-3 0 3.354 3.354 0 01-3 0L3 16.5m15-3.38a48.474 48.474 0 00-6-.37c-2.032 0-4.034.125-6 .37m12 0c.39.049.777.102 1.163.16 1.07.16 1.837 1.094 1.837 2.175v5.17c0 .62-.504 1.124-1.125 1.124H4.125A1.125 1.125 0 013 20.625v-5.17c0-1.08.768-2.014 1.837-2.174A47.78 47.78 0 016 13.12M12.265 3.11a.375.375 0 11-.53 0L12 2.845l.265.265zm-3 0a.375.375 0 11-.53 0L9 2.845l.265.265zm6 0a.375.375 0 11-.53 0L15 2.845l.265.265z\"/>\n</svg>"
|
||||
end
|
||||
|
||||
test "raises on mix styles" do
|
||||
assert_raise ArgumentError, "expected either mini or solid, but got both.", fn ->
|
||||
render_component(&Heroicons.cake/1, %{mini: true, solid: true})
|
||||
@ -69,11 +79,13 @@ defmodule HeroiconsTest do
|
||||
<Heroicons.academic_cap class="w-4 h-4" />
|
||||
<Heroicons.academic_cap solid />
|
||||
<Heroicons.academic_cap mini />
|
||||
<Heroicons.academic_cap outline />
|
||||
```
|
||||
|
||||
## Attributes
|
||||
|
||||
* `rest` (`:global`) - the arbitrary HTML attributes for the svg container.
|
||||
* `outline` (`:boolean`) - Defaults to `true`.
|
||||
* `solid` (`:boolean`) - Defaults to `false`.
|
||||
* `mini` (`:boolean`) - Defaults to `false`.
|
||||
"""
|
||||
|
Reference in New Issue
Block a user