From f75565cb1700a8be12ab9bfb6e4c1e5856b576c8 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Wed, 30 Mar 2022 11:01:16 -0700 Subject: [PATCH] Extract view example helper --- styleguide-app/Main.elm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/styleguide-app/Main.elm b/styleguide-app/Main.elm index 46de8668..55714c98 100644 --- a/styleguide-app/Main.elm +++ b/styleguide-app/Main.elm @@ -187,17 +187,8 @@ view_ model = Routes.Doodad doodad -> case List.head (examples (\m -> m.name == doodad)) of Just example -> - Html.div - [ css - [ maxWidth (Css.px 1400) - , margin auto - ] - ] - [ Example.view model.previousRoute - { packageDependencies = model.elliePackageDependencies } - example - |> Html.map (UpdateModuleStates example.name) - ] + viewExample model example + |> Html.map (UpdateModuleStates example.name) Nothing -> Page.notFound @@ -224,6 +215,15 @@ view_ model = ] +viewExample : Model -> Example a msg -> Html msg +viewExample model example = + Html.div [ css [ maxWidth (Css.px 1400), margin auto ] ] + [ Example.view model.previousRoute + { packageDependencies = model.elliePackageDependencies } + example + ] + + withSideNav : Route -> List (Html Msg) -> Html Msg withSideNav currentRoute content = Html.div