From fa8fd2003ecac241784e063d62a65f6f6f294bc5 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Thu, 7 May 2020 12:46:21 -0700 Subject: [PATCH] Begins adding styleguide example --- styleguide-app/Examples.elm | 22 +++++++++++++ styleguide-app/Examples/Menu.elm | 53 ++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 styleguide-app/Examples/Menu.elm diff --git a/styleguide-app/Examples.elm b/styleguide-app/Examples.elm index 09bffd75..8f700aa9 100644 --- a/styleguide-app/Examples.elm +++ b/styleguide-app/Examples.elm @@ -17,6 +17,7 @@ import Examples.Icon as Icon import Examples.Loading as Loading import Examples.Logo as Logo import Examples.MasteryIcon as MasteryIcon +import Examples.Menu as Menu import Examples.Message as Message import Examples.Modal as Modal import Examples.Page as Page @@ -340,6 +341,25 @@ all = MasteryIconState childState -> Just childState + _ -> + Nothing + ) + , Menu.example + |> Example.wrapMsg MenuMsg + (\msg -> + case msg of + MenuMsg childMsg -> + Just childMsg + + _ -> + Nothing + ) + |> Example.wrapState MenuState + (\msg -> + case msg of + MenuState childState -> + Just childState + _ -> Nothing ) @@ -705,6 +725,7 @@ type State | LoadingState Loading.State | LogoState Logo.State | MasteryIconState MasteryIcon.State + | MenuState Menu.State | MessageState Message.State | ModalState Modal.State | PageState Page.State @@ -742,6 +763,7 @@ type Msg | LoadingMsg Loading.Msg | LogoMsg Logo.Msg | MasteryIconMsg MasteryIcon.Msg + | MenuMsg Menu.Msg | MessageMsg Message.Msg | ModalMsg Modal.Msg | PageMsg Page.Msg diff --git a/styleguide-app/Examples/Menu.elm b/styleguide-app/Examples/Menu.elm new file mode 100644 index 00000000..ddb8773e --- /dev/null +++ b/styleguide-app/Examples/Menu.elm @@ -0,0 +1,53 @@ +module Examples.Menu exposing (Msg, State, example) + +{-| + +@docs Msg, State, example + +-} + +import Category exposing (Category(..)) +import Css +import Example exposing (Example) +import Html.Styled +import Html.Styled.Attributes +import Nri.Ui.Heading.V2 as Heading +import Nri.Ui.Menu.V1 as Meny + + +{-| -} +example : Example State Msg +example = + { name = "Nri.Ui.Menu.V1" + , state = init + , update = update + , subscriptions = \_ -> Sub.none + , categories = [ Widgets ] + , view = + \state -> + [] + } + + +{-| -} +init : State +init = + () + + +{-| -} +type alias State = + () + + +{-| -} +type Msg + = NoOp + + +{-| -} +update : Msg -> State -> ( State, Cmd Msg ) +update msg state = + case msg of + NoOp -> + ( state, Cmd.none )