refactor ProgressIndicator from singleton record to Maybe Float

This commit is contained in:
chris 2020-08-12 10:48:31 -07:00
parent 103df0bf4e
commit b1d75d259b
4 changed files with 7 additions and 9 deletions

View File

@ -52,9 +52,7 @@ subscriptions _ =
-}
view : (Msg -> msg) -> Style style msg -> Model -> Element msg
view msgMapper style (MaybeProgress maybeProgress) =
Widget.circularProgressIndicator style.progressIndicator
{ maybeProgress = maybeProgress
}
Widget.circularProgressIndicator style.progressIndicator maybeProgress
main : Program () Model Msg

View File

@ -521,12 +521,12 @@ progressIndicator _ style =
|> List.map
(\completeness ->
( "Determinate Progress Indicator, completeness " ++ String.fromFloat completeness
, Widget.circularProgressIndicator style.progressIndicator { maybeProgress = Just completeness }
, Widget.circularProgressIndicator style.progressIndicator (Just completeness)
)
)
in
[ ( "Indeterminate Progress Indicator"
, Widget.circularProgressIndicator style.progressIndicator { maybeProgress = Nothing }
, Widget.circularProgressIndicator style.progressIndicator Nothing
)
]
++ determinateIndicators

View File

@ -6,7 +6,7 @@ import Widget.Style exposing (ProgressIndicatorStyle)
circularProgressIndicator :
ProgressIndicatorStyle msg
-> { maybeProgress : Maybe Float }
-> Maybe Float
-> Element msg
circularProgressIndicator style { maybeProgress } =
circularProgressIndicator style maybeProgress =
style.icon maybeProgress

View File

@ -641,14 +641,14 @@ If `maybeProgress` is set to `Just Float` (where the `Float` is proportion of co
-}
type alias ProgressIndicator =
{ maybeProgress : Maybe Float }
Maybe Float
{-| Displays a circular progress indicator
-}
circularProgressIndicator :
ProgressIndicatorStyle msg
-> { maybeProgress : Maybe Float }
-> Maybe Float
-> Element msg
circularProgressIndicator =
ProgressIndicator.circularProgressIndicator