Skip to content

Commit

Permalink
Update to new FontAwesome version, add semantic Icon layer for consis…
Browse files Browse the repository at this point in the history
…tency.
  • Loading branch information
Lattyware committed May 30, 2022
1 parent 08a61e6 commit a6035da
Show file tree
Hide file tree
Showing 43 changed files with 728 additions and 319 deletions.
2 changes: 1 addition & 1 deletion client/elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"elm-community/list-extra": "8.5.2",
"elm-community/random-extra": "3.2.0",
"fapian/elm-html-aria": "1.4.0",
"lattyware/elm-fontawesome": "5.0.0",
"lattyware/elm-fontawesome": "6.0.0",
"lattyware/elm-json-diff": "1.0.2",
"myrho/elm-round": "1.0.4",
"norpan/elm-html5-drag-drop": "3.1.4",
Expand Down
38 changes: 29 additions & 9 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"> 0.2%"
],
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.1",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@material/card": "^14.0.0",
"@material/mwc-button": "^0.26.1",
"@material/mwc-fab": "^0.26.1",
Expand Down
20 changes: 10 additions & 10 deletions client/src/elm/MassiveDecks/Card/Call/Editor.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ module MassiveDecks.Card.Call.Editor exposing
, view
)

import FontAwesome.Icon as Icon
import FontAwesome as Icon
import FontAwesome.Layering as Icon
import FontAwesome.Solid as Icon
import Html exposing (Html)
import Html.Attributes as HtmlA
import Html.Events as HtmlE
Expand All @@ -19,6 +18,7 @@ import MassiveDecks.Card.Parts as Parts exposing (Parts)
import MassiveDecks.Card.Parts.Part as Part
import MassiveDecks.Components.Form as Form
import MassiveDecks.Components.Form.Message as Message
import MassiveDecks.Icon as Icon
import MassiveDecks.Model exposing (Shared)
import MassiveDecks.Strings as Strings exposing (MdString)
import MassiveDecks.Strings.Languages as Lang
Expand Down Expand Up @@ -134,8 +134,8 @@ view wrap shared { parts, selected, error } =

inlineControls =
Html.p []
[ Button.view shared Button.Outlined Strings.AddText Strings.AddText (Icon.plus |> Icon.viewIcon) [ addAction (Parts.Text "..." Part.NoStyle) |> HtmlE.onClick ]
, Button.view shared Button.Outlined Strings.AddSlot Strings.AddSlot (Icon.plus |> Icon.viewIcon) [ addSlot |> HtmlE.onClick ]
[ Button.view shared Button.Outlined Strings.AddText Strings.AddText (Icon.add |> Icon.view) [ addAction (Parts.Text "..." Part.NoStyle) |> HtmlE.onClick ]
, Button.view shared Button.Outlined Strings.AddSlot Strings.AddSlot (Icon.add |> Icon.view) [ addSlot |> HtmlE.onClick ]
]

selectedPart =
Expand Down Expand Up @@ -180,7 +180,7 @@ view wrap shared { parts, selected, error } =
Html.nothing

viewError e =
Message.errorWithFix e [ { description = Strings.AddSlot, icon = Icon.plus, action = addSlot } ]
Message.errorWithFix e [ { description = Strings.AddSlot, icon = Icon.add, action = addSlot } ]
|> Message.view shared
in
Html.div [ HtmlA.class "call-editor" ]
Expand Down Expand Up @@ -243,17 +243,17 @@ controls wrap shared max selected =
index |> Maybe.andThen (\i -> Move i by |> wrap |> Maybe.justIf (test i))

generalControls =
[ IconButton.view shared Strings.Remove (Icon.minus |> Icon.present |> NeList.just) (index |> Maybe.map (Remove >> wrap))
, IconButton.view shared Strings.MoveLeft (Icon.arrowLeft |> Icon.present |> NeList.just) (move -1 ((<) 0))
, IconButton.view shared Strings.MoveRight (Icon.arrowRight |> Icon.present |> NeList.just) (move 1 ((>) max))
[ IconButton.view shared Strings.Remove (Icon.remove |> NeList.just) (index |> Maybe.map (Remove >> wrap))
, IconButton.view shared Strings.MoveLeft (Icon.left |> NeList.just) (move -1 ((<) 0))
, IconButton.view shared Strings.MoveRight (Icon.right |> NeList.just) (move 1 ((>) max))
]

setIfDifferent old updated new =
index |> Maybe.andThen (\i -> Set i (updated new) |> wrap |> Maybe.justIf (old /= new))

styleControls setStyle =
[ IconButton.view shared Strings.Normal (Icon.font |> Icon.present |> NeList.just) (setStyle Part.NoStyle)
, IconButton.view shared Strings.Emphasise (Icon.italic |> Icon.present |> NeList.just) (setStyle Part.Em)
[ IconButton.view shared Strings.Normal (Icon.normalText |> NeList.just) (setStyle Part.NoStyle)
, IconButton.view shared Strings.Emphasise (Icon.italicText |> NeList.just) (setStyle Part.Em)
]

transformControls setTransform =
Expand Down
7 changes: 3 additions & 4 deletions client/src/elm/MassiveDecks/Card/Source/BuiltIn.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module MassiveDecks.Card.Source.BuiltIn exposing
, methods
)

import FontAwesome.Icon as Icon
import FontAwesome.Solid as Icon
import FontAwesome as Icon
import Html as Html exposing (Html)
import Html.Attributes as HtmlA
import MassiveDecks.Card.Source.BuiltIn.Model exposing (..)
Expand Down Expand Up @@ -122,7 +121,7 @@ editor selected shared existing update _ _ =
, icon = Nothing
, primary = [ Html.text name ]
, secondary = Just secondary
, meta = Icon.check |> Icon.viewIcon |> Maybe.justIf (existing |> List.any matches)
, meta = Icon.accept |> Icon.view |> Maybe.justIf (existing |> List.any matches)
}
in
Html.div [ HtmlA.class "primary" ]
Expand Down Expand Up @@ -189,4 +188,4 @@ tooltip id renderTooltip =

logo : () -> Maybe (Html msg)
logo () =
Icon.massiveDecks |> Icon.viewIcon |> Just
Icon.massiveDecks |> Icon.view |> Just
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ module MassiveDecks.Card.Source.JsonAgainstHumanity exposing
, methods
)

import FontAwesome.Icon as Icon
import FontAwesome.Solid as Icon
import FontAwesome as Icon
import Html as Html exposing (Html)
import Html.Attributes as HtmlA
import List.Extra as List
import MassiveDecks.Card.Source.JsonAgainstHumanity.Model exposing (..)
import MassiveDecks.Card.Source.Methods as Source
import MassiveDecks.Card.Source.Model as Source
import MassiveDecks.Components.Form.Message as Message exposing (Message)
import MassiveDecks.Icon as Icon
import MassiveDecks.Model exposing (..)
import MassiveDecks.Pages.Lobby.Configure.Decks.Model exposing (DeckOrError)
import MassiveDecks.Strings as Strings exposing (MdString)
Expand Down Expand Up @@ -107,7 +107,7 @@ editor selected shared existing update _ _ =
, icon = Nothing
, primary = [ Html.text d.name ]
, secondary = Nothing
, meta = Icon.check |> Icon.viewIcon |> Maybe.justIf (existing |> List.any matches)
, meta = Icon.accept |> Icon.view |> Maybe.justIf (existing |> List.any matches)
}
in
Html.span [ HtmlA.id "json-against-humanity-editor", HtmlA.class "primary" ]
Expand Down Expand Up @@ -151,4 +151,4 @@ tooltip givenId tooltipRender =

logo : () -> Maybe (Html msg)
logo () =
Icon.code |> Icon.viewIcon |> Just
Icon.jsonAgainstHumanity |> Icon.view |> Just
13 changes: 4 additions & 9 deletions client/src/elm/MassiveDecks/Card/Source/ManyDecks.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module MassiveDecks.Card.Source.ManyDecks exposing
, methods
)

import FontAwesome.Icon as Icon
import FontAwesome.Solid as Icon
import FontAwesome as Icon
import Html as Html exposing (Html)
import Html.Attributes as HtmlA
import Html.Events as HtmlE
Expand All @@ -13,6 +12,7 @@ import MassiveDecks.Card.Source.ManyDecks.Model exposing (..)
import MassiveDecks.Card.Source.Methods as Source
import MassiveDecks.Card.Source.Model as Source
import MassiveDecks.Components.Form.Message as Message exposing (Message)
import MassiveDecks.Icon as Icon
import MassiveDecks.Model exposing (..)
import MassiveDecks.Pages.Lobby.Configure.Decks.Model exposing (DeckOrError)
import MassiveDecks.Strings as Strings exposing (MdString)
Expand Down Expand Up @@ -127,7 +127,7 @@ tooltip dc tooltipRender =

content =
[ Html.p [ HtmlA.class "source-id" ]
[ logoInternal
[ Icon.manyDecks |> Icon.view
, Html.div [ HtmlA.class "many-decks-deck-code" ] [ dc |> toString |> Html.text ]
]
]
Expand All @@ -137,9 +137,4 @@ tooltip dc tooltipRender =

logo : () -> Maybe (Html msg)
logo () =
logoInternal |> Just


logoInternal : Html msg
logoInternal =
Icon.boxOpen |> Icon.viewIcon
Icon.manyDecks |> Icon.view |> Just
16 changes: 8 additions & 8 deletions client/src/elm/MassiveDecks/Components/Form/Message.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ module MassiveDecks.Components.Form.Message exposing
, warning
)

import FontAwesome as Icon exposing (Icon)
import FontAwesome.Attributes as Icon
import FontAwesome.Icon as Icon exposing (Icon)
import FontAwesome.Solid as Icon
import Html exposing (Html)
import Html.Attributes as HtmlA
import MassiveDecks.Icon as Icon
import MassiveDecks.Model exposing (..)
import MassiveDecks.Models.MdError as MdError exposing (MdError)
import MassiveDecks.Strings exposing (MdString)
Expand All @@ -28,7 +28,7 @@ import Svg.Attributes as Svg

type alias Fix msg =
{ description : MdString
, icon : Icon
, icon : Icon Icon.WithoutId
, action : msg
}

Expand Down Expand Up @@ -120,21 +120,21 @@ internalMessage shared { severity, description, fixes } =
( class, icon ) =
case severity of
Info ->
( "info", Icon.infoCircle )
( "info", Icon.info )

Warning ->
( "warning", Icon.exclamationTriangle )
( "warning", Icon.warning )

Error ->
( "inline-error", Icon.exclamationCircle )
( "inline-error", Icon.bug )
in
Html.span [ HtmlA.class class ]
[ Icon.viewStyled [ Icon.fw, Svg.class "message-type-icon" ] icon
[ icon |> Icon.styled [ Icon.fw, Svg.class "message-type-icon" ] |> Icon.view
, Html.span [] [ description |> Lang.html shared ]
, Html.ul [ HtmlA.class "fixes" ] (fixes |> List.map (viewFix shared))
]


viewFix : Shared -> Fix msg -> Html msg
viewFix shared { icon, description, action } =
Html.li [] [ IconButton.view shared description (icon |> Icon.present |> NeList.just) (Just action) ]
Html.li [] [ IconButton.view shared description (icon |> NeList.just) (Just action) ]
6 changes: 3 additions & 3 deletions client/src/elm/MassiveDecks/Components/Menu.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module MassiveDecks.Components.Menu exposing
, view
)

import FontAwesome.Icon exposing (Icon)
import FontAwesome as Icon exposing (Icon)
import Html exposing (Html)
import Html.Attributes as HtmlA
import Html.Attributes.Aria as HtmlA
Expand Down Expand Up @@ -45,14 +45,14 @@ open isOpen =

{-| Convenience function for a menu button.
-}
button : Icon -> MdString -> MdString -> Maybe msg -> Part msg
button : Icon Icon.WithoutId -> MdString -> MdString -> Maybe msg -> Part msg
button icon text description action =
Button (Item icon text description) action


{-| Convenience function for a menu link.
-}
link : Icon -> MdString -> MdString -> Maybe String -> Part msg
link : Icon Icon.WithoutId -> MdString -> MdString -> Maybe String -> Part msg
link icon text description href =
Link (Item icon text description) href

Expand Down
4 changes: 2 additions & 2 deletions client/src/elm/MassiveDecks/Components/Menu/Model.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module MassiveDecks.Components.Menu.Model exposing
, State(..)
)

import FontAwesome.Icon exposing (Icon)
import FontAwesome as Icon exposing (Icon)
import MassiveDecks.Strings exposing (MdString)


Expand All @@ -28,7 +28,7 @@ type Part msg
{-| A menu item
-}
type alias Item =
{ icon : Icon
{ icon : Icon Icon.WithoutId
, text : MdString
, description : MdString
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/elm/MassiveDecks/Error/Overlay.elm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module MassiveDecks.Error.Overlay exposing (init, update, view)

import FontAwesome.Icon as Icon
import FontAwesome.Solid as Icon
import FontAwesome as Icon
import Html exposing (Html)
import Html.Attributes as HtmlA
import MassiveDecks.Error as Error
import MassiveDecks.Error.Messages exposing (..)
import MassiveDecks.Error.Model as Error
import MassiveDecks.Icon as Icon
import MassiveDecks.Messages as Global
import MassiveDecks.Model exposing (Shared)
import MassiveDecks.Pages.Route exposing (Route)
Expand All @@ -32,11 +32,11 @@ view shared route model =
[ Html.div [ HtmlA.class "actions" ]
[ IconButton.view shared
Strings.Close
(Icon.times |> Icon.present |> NeList.just)
(Icon.close |> NeList.just)
(Clear |> Global.ErrorMsg |> Just)
, IconButton.view shared
Strings.Refresh
(Icon.redo |> Icon.present |> NeList.just)
(Icon.redo |> NeList.just)
(Just Global.Refresh)
]
, Card.view [ HtmlA.class "help" ]
Expand Down
Loading

0 comments on commit a6035da

Please sign in to comment.