From 07b1bca45d693e38b7ab10c12029b45e3e06cdd0 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Mon, 21 Mar 2022 16:50:45 -0700 Subject: [PATCH 1/4] Use ControlView for Balloon example --- styleguide-app/Examples/Balloon.elm | 34 +++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/styleguide-app/Examples/Balloon.elm b/styleguide-app/Examples/Balloon.elm index 9d8a5842..35ccdc0d 100644 --- a/styleguide-app/Examples/Balloon.elm +++ b/styleguide-app/Examples/Balloon.elm @@ -10,6 +10,7 @@ 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) @@ -130,20 +131,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 [ " + ++ String.join ", " (List.map Tuple.first attrs) + ++ " ] " + ++ "\"" + ++ copy + ++ "\"" + } + ] + } + , Balloon.balloon + (List.map Tuple.second (Control.currentValue state.attributes)) + (text copy) ] From c42a99991081cfe8008b651c67e6ee719699e348 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Mon, 21 Mar 2022 16:51:25 -0700 Subject: [PATCH 2/4] Fix example code --- styleguide-app/Examples/Balloon.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/styleguide-app/Examples/Balloon.elm b/styleguide-app/Examples/Balloon.elm index 35ccdc0d..3fb4d931 100644 --- a/styleguide-app/Examples/Balloon.elm +++ b/styleguide-app/Examples/Balloon.elm @@ -143,9 +143,9 @@ view state = "Balloon.balloon [ " ++ String.join ", " (List.map Tuple.first attrs) ++ " ] " - ++ "\"" + ++ "(text \"" ++ copy - ++ "\"" + ++ "\")" } ] } From 904c13be5ce0d3afe79f80582691b6718172d1f8 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Mon, 21 Mar 2022 16:53:00 -0700 Subject: [PATCH 3/4] Add some new lines for better many-mod support --- styleguide-app/Examples/Balloon.elm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/styleguide-app/Examples/Balloon.elm b/styleguide-app/Examples/Balloon.elm index 3fb4d931..9a033ff8 100644 --- a/styleguide-app/Examples/Balloon.elm +++ b/styleguide-app/Examples/Balloon.elm @@ -140,10 +140,10 @@ view state = \attrs -> [ { sectionName = "Balloon" , code = - "Balloon.balloon [ " - ++ String.join ", " (List.map Tuple.first attrs) - ++ " ] " - ++ "(text \"" + "Balloon.balloon\n [ " + ++ String.join "\n , " (List.map Tuple.first attrs) + ++ "\n ] " + ++ "\n (text \"" ++ copy ++ "\")" } From 92445dfe51f337f267f40a88756862147ad853ce Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Mon, 21 Mar 2022 16:56:18 -0700 Subject: [PATCH 4/4] elm review --- styleguide-app/Examples/Balloon.elm | 2 -- 1 file changed, 2 deletions(-) diff --git a/styleguide-app/Examples/Balloon.elm b/styleguide-app/Examples/Balloon.elm index 9a033ff8..0274c5a2 100644 --- a/styleguide-app/Examples/Balloon.elm +++ b/styleguide-app/Examples/Balloon.elm @@ -7,13 +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