-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose SVG view function, update to 5.11.1.
- Loading branch information
Showing
8 changed files
with
480 additions
and
578 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module FontAwesome.Icon.Internal exposing (Icon) | ||
|
||
{-| Internal module to avoid a dependency cycle. | ||
-} | ||
|
||
|
||
{-| This must remain the same as the definition for `Icon.Icon`. | ||
-} | ||
type alias Icon = | ||
{ prefix : String | ||
, name : String | ||
, width : Int | ||
, height : Int | ||
, paths : List String | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module FontAwesome.Svg exposing (viewIcon) | ||
|
||
{-| Rendering icons for use in SVG. | ||
@docs viewIcon | ||
-} | ||
|
||
import FontAwesome.Icon exposing (Icon) | ||
import FontAwesome.Svg.Internal as Internal | ||
import Svg exposing (Svg) | ||
|
||
|
||
{-| View an icon as an SVG node. | ||
-} | ||
viewIcon : Icon -> Svg msg | ||
viewIcon = | ||
Internal.corePaths [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module FontAwesome.Svg.Internal exposing (corePath, corePaths) | ||
|
||
import FontAwesome.Icon.Internal exposing (Icon) | ||
import Svg exposing (Svg) | ||
import Svg.Attributes as SvgA | ||
|
||
|
||
corePaths : List (Svg.Attribute msg) -> Icon -> Svg msg | ||
corePaths attrs icon = | ||
case icon.paths of | ||
[] -> | ||
corePath attrs "" | ||
|
||
only :: [] -> | ||
corePath attrs only | ||
|
||
secondary :: primary :: _ -> | ||
Svg.g [ SvgA.class "fa-group" ] | ||
[ corePath (SvgA.class "fa-secondary" :: attrs) secondary | ||
, corePath (SvgA.class "fa-primary" :: attrs) primary | ||
] | ||
|
||
|
||
corePath : List (Svg.Attribute msg) -> String -> Svg msg | ||
corePath attrs d = | ||
Svg.path (SvgA.fill "currentColor" :: SvgA.d d :: attrs) [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters