mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-25 22:53:34 +03:00
Move Alert examples into Message examples
This commit is contained in:
parent
70d14f5429
commit
6e712bb79e
@ -5,7 +5,6 @@ import Css exposing (..)
|
||||
import Html.Styled as Html exposing (Html)
|
||||
import Html.Styled.Attributes as Attributes
|
||||
import Nri.Ui.Colors.V1 exposing (..)
|
||||
import Sort.Set as Set exposing (Set)
|
||||
|
||||
|
||||
type alias Example state msg =
|
||||
|
@ -2,7 +2,6 @@ module Examples exposing (Msg, State, all)
|
||||
|
||||
import Example exposing (Example)
|
||||
import Examples.Accordion as Accordion
|
||||
import Examples.Alert as Alert
|
||||
import Examples.AssignmentIcon as AssignmentIcon
|
||||
import Examples.BannerAlert as BannerAlert
|
||||
import Examples.Button as Button
|
||||
@ -20,6 +19,7 @@ import Examples.Icon as Icon
|
||||
import Examples.Loading as Loading
|
||||
import Examples.Logo as Logo
|
||||
import Examples.MasteryIcon as MasteryIcon
|
||||
import Examples.Message as Message
|
||||
import Examples.Modal as Modal
|
||||
import Examples.Page as Page
|
||||
import Examples.Pennant as Pennant
|
||||
@ -57,25 +57,6 @@ all =
|
||||
AccordionState childState ->
|
||||
Just childState
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
)
|
||||
, Alert.example
|
||||
|> Example.wrapMsg AlertMsg
|
||||
(\msg ->
|
||||
case msg of
|
||||
AlertMsg childMsg ->
|
||||
Just childMsg
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
)
|
||||
|> Example.wrapState AlertState
|
||||
(\msg ->
|
||||
case msg of
|
||||
AlertState childState ->
|
||||
Just childState
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
)
|
||||
@ -399,6 +380,25 @@ all =
|
||||
MasteryIconState childState ->
|
||||
Just childState
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
)
|
||||
, Message.example
|
||||
|> Example.wrapMsg MessageMsg
|
||||
(\msg ->
|
||||
case msg of
|
||||
MessageMsg childMsg ->
|
||||
Just childMsg
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
)
|
||||
|> Example.wrapState MessageState
|
||||
(\msg ->
|
||||
case msg of
|
||||
MessageState childState ->
|
||||
Just childState
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
)
|
||||
@ -730,7 +730,6 @@ all =
|
||||
|
||||
type State
|
||||
= AccordionState Accordion.State
|
||||
| AlertState Alert.State
|
||||
| AssignmentIconState AssignmentIcon.State
|
||||
| BannerAlertState BannerAlert.State
|
||||
| ButtonState Button.State
|
||||
@ -748,6 +747,7 @@ type State
|
||||
| LoadingState Loading.State
|
||||
| LogoState Logo.State
|
||||
| MasteryIconState MasteryIcon.State
|
||||
| MessageState Message.State
|
||||
| ModalState Modal.State
|
||||
| PageState Page.State
|
||||
| PennantState Pennant.State
|
||||
@ -769,7 +769,6 @@ type State
|
||||
|
||||
type Msg
|
||||
= AccordionMsg Accordion.Msg
|
||||
| AlertMsg Alert.Msg
|
||||
| AssignmentIconMsg AssignmentIcon.Msg
|
||||
| BannerAlertMsg BannerAlert.Msg
|
||||
| ButtonMsg Button.Msg
|
||||
@ -787,6 +786,7 @@ type Msg
|
||||
| LoadingMsg Loading.Msg
|
||||
| LogoMsg Logo.Msg
|
||||
| MasteryIconMsg MasteryIcon.Msg
|
||||
| MessageMsg Message.Msg
|
||||
| ModalMsg Modal.Msg
|
||||
| PageMsg Page.Msg
|
||||
| PennantMsg Pennant.Msg
|
||||
|
@ -1,10 +1,4 @@
|
||||
module Examples.Alert exposing (example, State, Msg)
|
||||
|
||||
{-|
|
||||
|
||||
@docs example, State, Msg
|
||||
|
||||
-}
|
||||
module Examples.Message exposing (Msg, State, example)
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Example exposing (Example)
|
||||
@ -17,46 +11,31 @@ type alias State =
|
||||
()
|
||||
|
||||
|
||||
{-| -}
|
||||
type alias Msg =
|
||||
()
|
||||
|
||||
|
||||
{-| -}
|
||||
example : Example State Msg
|
||||
example =
|
||||
{ name = "Nri.Ui.Alert.V4"
|
||||
{ name = "Nri.Ui.Message.V1"
|
||||
, categories = [ Messaging ]
|
||||
, state = ()
|
||||
, update = \_ state -> ( state, Cmd.none )
|
||||
, subscriptions = \_ -> Sub.none
|
||||
, view =
|
||||
\_ ->
|
||||
[ Heading.h3 [] [ Html.text "Markdown-supporting:" ]
|
||||
[ Heading.h3 [] [ Html.text "Message.tiny" ]
|
||||
, Alert.error "This is an **error**"
|
||||
, Alert.warning "This is a **warning**"
|
||||
, Alert.tip "This is a **tip**"
|
||||
, Alert.success "This is a **success**"
|
||||
, Html.hr [] []
|
||||
, Heading.h3 [] [ Html.text "Stacktraces-supporting:" ]
|
||||
, Heading.h3 [] [ Html.text "Message.internalError" ]
|
||||
, Alert.somethingWentWrong exampleRailsError
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
complexHtml : String -> Html.Html msg
|
||||
complexHtml name =
|
||||
Html.div []
|
||||
[ Html.p [] [ Html.text "We support more complex alerts as well." ]
|
||||
, Html.p [] [ Html.text "Like this, for example!" ]
|
||||
, Html.p [] [ Html.text ("I'm a " ++ name) ]
|
||||
]
|
||||
|
||||
|
||||
|
||||
-- INTERNAL
|
||||
|
||||
|
||||
exampleRailsError : String
|
||||
exampleRailsError =
|
||||
"""web : Completed 500 Internal Server Error in 273.5ms
|
Loading…
Reference in New Issue
Block a user