Closed mpizenberg closed 6 years ago
Yep, this API looks good to me. I'll just outline all use-cases after change:
Resize icon:
Icon.download
|> Icon.sized 16
Default attributes:
Icon.download
|> Svg.svg Icon.defaultAttributes
Let's think a bit, and go with this if there's no other ideas.
Yes that is indeed the way I use it. It may be good to ask others of your known users what they think about it since it is a breaking API change.
In particular, it is a bit cumbersome if you need to add classes and change size like:
Icon.download
|> svg (class "feather-download" :: width ... :: height ... :: Icon.defaultAttributes)
I find HttpBuilder
-like API very nice, e.g. using withX
and toY
methods, e.g.:
-- default
Icon.download
|> Icon.toHtml []
-- sized 10
Icon.download
|> Icon.withSize 10
|> Icon.toHtml []
-- with custom class
Icon.download
|> Icon.withClass "icon-download"
|> Icon.toHtml []
-- with combination of things
Icon.download
|> Icon.withSize 10
|> Icon.withClass "icon-download"
|> Icon.toHtml [ onClick Download ]
@mpizenberg fancy a review? https://github.com/1602/elm-feather/pull/4
done :)
In order to test some layout, I've been using few feather icons. In my tests, I needed to have better control of the icons attributes, namely:
I kept the
stroke "currentColor"
attribute even if some my want to have a better control of this also. Thanks to your other tool elm-feather-icons, I've generated the icons I was interested in and modified the API by exposing theList Svg
and helper functions as follows:This is just an example way of giving control back to user. There might be better options than what I propose here.