Merge pull request #875 from NoRedInk/bat/standardize-balloon

Bat/standardize balloon
This commit is contained in:
Antoine Dauguet 2022-03-24 10:50:45 +01:00 committed by GitHub
commit 128a7fe765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,12 +7,11 @@ module Examples.Balloon exposing (example, State, Msg)
-}
import Category exposing (Category(..))
import Css
import Debug.Control as Control exposing (Control)
import Debug.Control.Extra as ControlExtra
import Debug.Control.View as ControlView
import Example exposing (Example)
import Html.Styled exposing (Html, fromUnstyled, text)
import Html.Styled.Attributes exposing (css)
import Nri.Ui.Balloon.V1 as Balloon
@ -130,20 +129,25 @@ view state =
let
copy =
Control.currentValue state.copy
attributes =
Control.currentValue state.attributes
in
[ Control.view SetCopy state.copy |> fromUnstyled
, Control.view SetAttributes state.attributes |> fromUnstyled
, Html.Styled.code [ css [ Css.display Css.block, Css.margin2 (Css.px 20) Css.zero ] ]
[ text <|
"Balloon.balloon [ "
++ String.join ", " (List.map Tuple.first attributes)
++ " ] "
++ "\""
++ copy
++ "\""
]
, Balloon.balloon (List.map Tuple.second attributes) (text copy)
, ControlView.view
{ update = SetAttributes
, settings = state.attributes
, toExampleCode =
\attrs ->
[ { sectionName = "Balloon"
, code =
"Balloon.balloon\n [ "
++ String.join "\n , " (List.map Tuple.first attrs)
++ "\n ] "
++ "\n (text \""
++ copy
++ "\")"
}
]
}
, Balloon.balloon
(List.map Tuple.second (Control.currentValue state.attributes))
(text copy)
]