noredink-ui/styleguide-app/Examples/Page.elm

67 lines
1.7 KiB
Elm
Raw Normal View History

2020-04-01 02:00:29 +03:00
module Examples.Page exposing (example, State, Msg)
2018-05-01 18:34:16 +03:00
{-|
2020-04-01 02:00:29 +03:00
@docs example, State, Msg
2018-05-01 18:34:16 +03:00
-}
import Category exposing (Category(..))
2018-05-01 18:34:16 +03:00
import Css
import Css.Global exposing (Snippet, adjacentSiblings, children, class, descendants, each, everything, media, selector, withClass)
2020-03-31 23:33:05 +03:00
import Example exposing (Example)
import Html.Styled as Html exposing (Html)
import Nri.Ui.Heading.V2 as Heading
import Nri.Ui.Page.V3 as Page
2018-05-01 18:34:16 +03:00
{-| -}
2020-04-01 02:00:29 +03:00
type alias State =
2020-04-03 20:10:26 +03:00
()
2020-04-01 02:00:29 +03:00
{-| -}
2020-04-03 20:10:26 +03:00
type alias Msg =
String
2020-04-01 02:00:29 +03:00
{-| -}
example : Example State Msg
2020-03-31 23:33:05 +03:00
example =
{ name = "Nri.Ui.Page.V3"
2020-03-31 23:33:05 +03:00
, categories = List.singleton Pages
2020-04-03 20:10:26 +03:00
, state = ()
, update =
\msg model ->
let
_ =
Debug.log "Clicked: " msg
in
( model, Cmd.none )
, subscriptions = \_ -> Sub.none
2020-03-31 23:33:05 +03:00
, view =
2020-04-03 20:10:26 +03:00
\_ ->
2020-03-31 23:33:05 +03:00
[ Css.Global.global
2020-04-14 02:14:51 +03:00
[ selector "[data-page-container]"
2020-03-31 23:33:05 +03:00
[ Css.displayFlex
, Css.flexWrap Css.wrap
]
]
2020-03-31 23:33:05 +03:00
, Heading.h3 [] [ Html.text "Page: Not Found, recovery text: ReturnTo" ]
, Page.notFound
2020-04-03 20:10:26 +03:00
{ link = "Page.notFound ReturnTo"
2020-03-31 23:33:05 +03:00
, recoveryText = Page.ReturnTo "the main page"
}
, Heading.h3 [] [ Html.text "Page: Broken, recovery text: Reload" ]
, Page.broken
2020-04-03 20:10:26 +03:00
{ link = "Page.broken Reload"
2020-03-31 23:33:05 +03:00
, recoveryText = Page.Reload
}
, Heading.h3 [] [ Html.text "Page: No Permission, recovery text: Custom" ]
, Page.noPermission
2020-04-03 20:10:26 +03:00
{ link = "Page.noPermission Custom"
2020-03-31 23:33:05 +03:00
, recoveryText = Page.Custom "Hit the road, Jack"
}
]
2018-05-01 18:34:16 +03:00
}