'Rolf Sievers' via Elm Discuss
2016-10-03 13:03:56 UTC
Greetings everyone!
I am new to Elm and currently working on a small project using Font Awesome
icons. I moved those icons to a separate library and coaxed elm-package
into publishing it. The idea is to wrap the icons in an opaque Icon class.
To insert it in your view use toHtml : Icon -> Html msg. Wrapping icons in
an extra type has one key advantage: You can modify the intermediate icon
before turning it into Html.
import FontAwesome exposing (Icon, toHtml)import FontAwesome.Icons as Fa
import FontAwesome.Modifiers as FaMod
myIcon =
Fa.birthday_cake
|> FaMod.double
|> FaMod.rotate90
|> toHtml
The FontAwesome.Modifier exposes several Icon -> Icon functions which can
be applied in a piping style.
http://package.elm-lang.org/packages/roSievers/font-awesome/1.0.0/
I would love some feedback on my first package!
For comparison, there are two other libraries currently offering Font
Awesome as well.
jystic/elm-font-awesome
Gives vector graphics instead of html.
Fresheyeball <https://github.com/Fresheyeball>/elm-font-awesome
<https://github.com/Fresheyeball/elm-font-awesome>
Well, I totally didn't anticipate that. When I started writing this
announcement I wanted to copy in jystic/elm-font-awesome only to find out
that a new package had popped up.
From what I understand, this package skips the intermediate Icon type and
directly returns a Html msg. I.e. it has no parallel to
FontAwesome.Modifiers.
I am new to Elm and currently working on a small project using Font Awesome
icons. I moved those icons to a separate library and coaxed elm-package
into publishing it. The idea is to wrap the icons in an opaque Icon class.
To insert it in your view use toHtml : Icon -> Html msg. Wrapping icons in
an extra type has one key advantage: You can modify the intermediate icon
before turning it into Html.
import FontAwesome exposing (Icon, toHtml)import FontAwesome.Icons as Fa
import FontAwesome.Modifiers as FaMod
myIcon =
Fa.birthday_cake
|> FaMod.double
|> FaMod.rotate90
|> toHtml
The FontAwesome.Modifier exposes several Icon -> Icon functions which can
be applied in a piping style.
http://package.elm-lang.org/packages/roSievers/font-awesome/1.0.0/
I would love some feedback on my first package!
For comparison, there are two other libraries currently offering Font
Awesome as well.
jystic/elm-font-awesome
Gives vector graphics instead of html.
Fresheyeball <https://github.com/Fresheyeball>/elm-font-awesome
<https://github.com/Fresheyeball/elm-font-awesome>
Well, I totally didn't anticipate that. When I started writing this
announcement I wanted to copy in jystic/elm-font-awesome only to find out
that a new package had popped up.
From what I understand, this package skips the intermediate Icon type and
directly returns a Html msg. I.e. it has no parallel to
FontAwesome.Modifiers.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.