NoRedInk/noredink-ui/12.21.0

NOTE: the latest version is 35.9.3

Nri.Ui.Message.V1

tiny : Theme -> Content msg -> Html msg

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

import Nri.Ui.Message.V1 as Message


view =
    Message.tiny Message.Tip (Message.Markdown "Don't tip too much, or your waitress will **fall over**!")

NOTE: When using a Custom theme, tiny ignores the custom backgroundColor.

large : Theme -> Content msg -> Html msg

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

import Nri.Ui.Message.V1 as Message


view =
    Message.large Message.Tip (Message.Plain "Two out of two parents agree: NoRedInk sounds like a fun place to work.")
type Theme
= Error
| Alert
| Tip
| Success
| Custom
{ color : Color
, backgroundColor : Color
, icon : Svg
}

Error / Alert / Tip / Success

type Content msg
= Plain String
| Markdown String
| Html (List (Html msg))

Prefer using the simplest variant that meets your needs.

  • Plain: provide a plain-text string
  • Markdown: provide a string that will be rendered as markdown
  • Html: provide custom HTML
mapContent : (a -> b) -> Content a -> Content b

Transform the messages produced by some Content.

PRIVATE

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

somethingWentWrong : String -> Html msg

Shows an appropriate error message for when something unhandled happened.

import Nri.Ui.Message.V1 as Message


view maybeDetailedErrorMessage =
    viewMaybe Message.somethingWentWrong maybeDetailedErrorMessage