Improve docs

This commit is contained in:
Max Veytsman
2021-11-12 12:02:26 -05:00
parent e3b30e6259
commit 97b3e4ceca
2 changed files with 21 additions and 13 deletions

View File

@ -1,18 +1,25 @@
defmodule Heroicons do
@moduledoc """
This library provides functions and components for every [Heroicon](https://github.com/tailwindlabs/heroicons).
This library provides Phoenix Components for every [Heroicon](https://github.com/tailwindlabs/heroicons).
See `Heroicons.Outline` and `Heroicons.Solid` for the two styles of icon.
Heroicons are provided as functions in `Heroicons.Outline` and `Heroicons.Solid`,
and as `Phoenix.Component`s in `Heroicons.Components.Outline` and `Heroicons.Components.Solid`.
## Examples
<Heroicons.Outline.adjustments />
Note that components require your project to have `:phoenix_live_view` as a dependency.
<Heroicons.Solid.arrow_circle_right class="w-6 h-6" />
Functions are also provided but deprecated
<%= Heroicons.Outline.adjustments() %>
<%= Heroicons.Solid.arrow_circle_right(class: "w-6 h-6") />
Heroicons are designed by [Steve Schoger](https://twitter.com/steveschoger)
"""
defmodule Outline do
@moduledoc """
Outline style icons drawn with a stroke, packaged as functions.
Outline style icons drawn with a stroke, packaged as Phoenix Components.
For primary navigation and marketing sections, designed to be rendered at 24x24.
"""
@ -22,7 +29,7 @@ defmodule Heroicons do
defmodule Solid do
@moduledoc """
Solid style icons drawn with fills, packaged as functions.
Solid style icons drawn with fills, packaged as Phoenix Components.
For buttons, form elements, and to support text, designed to be rendered at 20x20.
"""

View File

@ -24,16 +24,19 @@ defmodule Heroicons.Generator do
doc = """
![](assets/#{Path.relative_to(path, :code.priv_dir(:heroicons))}) {: width=24px}
Use as a `Phoenix.Component`
<.#{name}>
## Examples
<.#{name} class="h-6 w-6 text-gray-500">
Use as a `Phoenix.Component`
<.#{name} />
<.#{name} class="h-6 w-6 text-gray-500" />
Can also be used as a function (deprecated)
<%= #{name}() %>
<%= #{name}() %>
<%= #{name}(class: "h-6 w-6 text-gray-500") %>
<%= #{name}(class: "h-6 w-6 text-gray-500") %>
"""
quote do
@ -62,8 +65,6 @@ defmodule Heroicons.Generator do
"please use <.#{unquote(name)} class=\"...\" /> inside HEEx templates instead"
)
# opts = Keyword.merge(unquote(default_attrs), opts)
attrs =
for {k, v} <- opts do
safe_k =