NoRedInk/noredink-ui/34.4.0

NOTE: the latest version is 35.9.3

Nri.Ui.Message.V4

Changes from V3:

  • adds statusRole
  • removes alertDialogRole
  • moves custom attributes and role to a div containing the icon and text
  • makes this div programmatically focusable

Patch changes:

  • adds notMobileCss, mobileCss, quizEngineMobileCss
  • adds hideIconForMobile and hideIconFor
  • use Shadows
  • use internal Content module
  • make the tiny Message's icon size smaller

Changes from V2:

- adds helpers: `custom`,`css`,`icon`,`testId`,`id`

View

somethingWentWrong : String -> Html msg

Shows an appropriate error message for when something unhandled happened.

view maybeDetailedErrorMessage =
    viewMaybe Message.somethingWentWrong maybeDetailedErrorMessage
view : List (Attribute msg) -> Html msg
view =
    Message.view
        [ Message.tip
        , Message.markdown "Don't tip too much, or your waitress will **fall over**!"
        ]
type Attribute msg

Construct an Attribute using a helper like onDismiss or alert.

icon : Svg -> Attribute msg
custom : List (Attribute Never) -> Attribute msg

Use this helper to add custom attributes.

Do NOT use this helper to add css styles, as they may not be applied the way you want/expect if underlying styles change. Instead, please use the css helper.

testId : String -> Attribute msg
id : String -> Attribute msg

CSS

hideIconFor : MediaQuery -> Attribute msg
css : List Style -> Attribute msg
notMobileCss : List Style -> Attribute msg

Equivalent to:

Message.css
    [ Css.Media.withMedia [ Nri.Ui.MediaQuery.V1.notMobile ] styles ]
mobileCss : List Style -> Attribute msg

Equivalent to:

Message.css
    [ Css.Media.withMedia [ Nri.Ui.MediaQuery.V1.mobile ] styles ]
quizEngineMobileCss : List Style -> Attribute msg

Equivalent to:

Message.css
    [ Css.Media.withMedia [ Nri.Ui.MediaQuery.V1.quizEngineMobile ] styles ]

Size

Shows a tiny alert message. We commonly use these for validation errors and small hints to users.

Message.view [ Message.tiny ]

This is the default size for a Message.

Shows a large alert or callout message. We commonly use these for highlighted tips, instructions, or asides in page copy.

Message.view [ Message.large ]

Content

paragraph : String -> Attribute msg

Provide a plain-text string that will be put into a paragraph tag, with the default margin removed.

plaintext : String -> Attribute msg

Provide a plain-text string.

markdown : String -> Attribute msg

Provide a string that will be rendered as markdown.

html : List (Html msg) -> Attribute msg

Provide a list of custom HTML.

httpError : Error -> Attribute msg

Provide an HTTP error, which will be translated to user-friendly text.

codeDetails : String -> Attribute msg

Details for Engineers

Will be rendered in a closed details box

Theme

This is the default theme for a Message.

{ color : Color
, backgroundColor : Color
}
-> Attribute msg

Role

Use this attribute when a user's immediate attention on the Message is required.

For example, use this attribute when:

  • An invalid value was entered into a form field
  • The user's login session is about to expire
  • The connection to the server was lost, local changes will not be saved

-- Excerpted from Using the alert role MDN docs

Use this attribute when a user's immediate attention on the Message is NOT required.

This means that a status Message has a lower priority than an alert Message.

Actions

onDismiss : msg -> Attribute msg

Adds a dismiss ("X" icon) to a message which will produce the given msg when clicked.

Modules