Adds separate version field

This commit is contained in:
Tessa Kelly 2020-09-09 11:43:10 -07:00
parent 1e484236a7
commit e431f736ce
38 changed files with 86 additions and 41 deletions

View File

@ -12,6 +12,7 @@ import Nri.Ui.Html.Attributes.V2 as AttributeExtras exposing (targetBlank)
type alias Example state msg =
{ name : String
, version : Int
, state : state
, update : msg -> state -> ( state, Cmd msg )
, subscriptions : state -> Sub msg
@ -29,6 +30,7 @@ wrapMsg :
-> Example state msg2
wrapMsg wrapMsg_ unwrapMsg example =
{ name = example.name
, version = example.version
, state = example.state
, update =
\msg2 state ->
@ -54,6 +56,7 @@ wrapState :
-> Example state2 msg
wrapState wrapState_ unwrapState example =
{ name = example.name
, version = example.version
, state = wrapState_ example.state
, update =
\msg state2 ->
@ -80,6 +83,10 @@ wrapState wrapState_ unwrapState example =
view : Bool -> Example state msg -> Html msg
view showFocusLink example =
let
fullName =
"Nri.Ui." ++ example.name ++ ".V" ++ String.fromInt example.version
in
Html.div
[ -- this class makes the axe accessibility checking output easier to parse
String.replace "." "-" example.name
@ -104,11 +111,12 @@ view showFocusLink example =
, marginBottom zero
]
[]
[ Html.a [ Attributes.href ("#/doodad/" ++ example.name) ] [ Html.text example.name ] ]
, String.replace "." "-" example.name
[ Html.a [ Attributes.href ("#/doodad/" ++ example.name) ] [ Html.text fullName ]
]
, String.replace "." "-" fullName
|> (++) "https://package.elm-lang.org/packages/NoRedInk/noredink-ui/latest/"
|> viewLink "Docs"
, String.replace "." "/" example.name
, String.replace "." "/" fullName
++ ".elm"
|> (++) "https://github.com/NoRedInk/noredink-ui/blob/master/src/"
|> viewLink "Source"

View File

@ -28,7 +28,8 @@ import Nri.Ui.Text.V4 as Text
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Accordion.V1"
{ name = "Accordion"
, version = 1
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -28,7 +28,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.AssignmentIcon.V2"
{ name = "AssignmentIcon"
, version = 2
, categories = [ Icons ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -23,7 +23,8 @@ import Nri.Ui.UiIcon.V1 as UiIcon
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Button.V10"
{ name = "Button"
, version = 10
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -30,7 +30,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Callout.V1"
{ name = "Callout"
, version = 1
, categories = [ Messaging ]
, atomicDesignType = Molecule
, keyboardSupport = []

View File

@ -35,7 +35,8 @@ type alias State =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Checkbox.V5"
{ name = "Checkbox"
, version = 5
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -28,7 +28,8 @@ import Nri.Ui.UiIcon.V1 as UiIcon
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.ClickableSvg.V1"
{ name = "ClickableSvg"
, version = 1
, categories = [ Buttons, Icons ]
, atomicDesignType = Molecule
, keyboardSupport = []

View File

@ -28,7 +28,8 @@ type State
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.ClickableText.V3"
{ name = "ClickableText"
, version = 3
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -35,7 +35,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Colors.V1"
{ name = "Colors"
, version = 1
, categories = [ Colors ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -22,7 +22,8 @@ import Nri.Ui.Confetti.V2 as Confetti
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Confetti.V2"
{ name = "Confetti"
, version = 2
, categories = [ Animations ]
, atomicDesignType = Molecule
, keyboardSupport = []

View File

@ -30,7 +30,8 @@ type alias State =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.DisclosureIndicator.V2"
{ name = "DisclosureIndicator"
, version = 2
, categories = [ Widgets ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -29,7 +29,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Divider.V2"
{ name = "Divider"
, version = 2
, categories = [ Layout ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -29,7 +29,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Fonts.V1"
{ name = "Fonts"
, version = 1
, categories = [ Text ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -29,7 +29,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Heading.V2"
{ name = "Heading"
, version = 2
, categories = [ Text, Layout ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -34,7 +34,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Icon.V5"
{ name = "Icon"
, version = 5
, categories = [ Icons ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -88,7 +88,8 @@ subscriptions { showLoadingFadeIn, showLoading, showSpinners } =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Loading.V1"
{ name = "Loading"
, version = 1
, categories = [ Pages ]
, atomicDesignType = Page
, keyboardSupport = []

View File

@ -29,7 +29,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Logo.V1"
{ name = "Logo"
, version = 1
, categories = [ Icons ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -28,7 +28,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.MasteryIcon.V1"
{ name = "MasteryIcon"
, version = 1
, categories = [ Icons ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -25,7 +25,8 @@ import Set exposing (Set)
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Menu.V1"
{ name = "Menu"
, version = 1
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -155,7 +155,8 @@ update msg state =
example : Example State Msg
example =
{ name = "Nri.Ui.Message.V2"
{ name = "Message"
, version = 2
, categories = [ Messaging ]
, atomicDesignType = Molecule
, keyboardSupport = []

View File

@ -108,7 +108,8 @@ controlCss =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Modal.V11"
{ name = "Modal"
, version = 11
, categories = [ Modals ]
, atomicDesignType = Organism
, keyboardSupport =

View File

@ -30,7 +30,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Page.V3"
{ name = "Page"
, version = 3
, categories = [ Pages ]
, atomicDesignType = Page
, keyboardSupport = []

View File

@ -31,7 +31,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Pennant.V2"
{ name = "Pennant"
, version = 2
, categories = [ Icons ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -30,7 +30,8 @@ import Nri.Ui.Text.V5 as Text
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.RadioButton.V1"
{ name = "RadioButton"
, version = 1
, state = init
, update = update
, subscriptions = subscriptions

View File

@ -31,7 +31,8 @@ import Task
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.SegmentedControl.V12"
{ name = "SegmentedControl"
, version = 12
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -20,7 +20,8 @@ import Nri.Ui.Select.V7 as Select
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Select.V7"
{ name = "Select"
, version = 7
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -36,7 +36,8 @@ type alias State =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Slide.V1"
{ name = "Slide"
, version = 1
, categories = [ Animations ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -34,7 +34,8 @@ type alias State =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.SlideModal.V2"
{ name = "SlideModal"
, version = 2
, categories = [ Modals ]
, atomicDesignType = Organism
, keyboardSupport = []

View File

@ -35,7 +35,8 @@ type alias State =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.SortableTable.V2"
{ name = "SortableTable"
, version = 2
, categories = [ Tables, Layout ]
, atomicDesignType = Molecule
, keyboardSupport = []

View File

@ -27,7 +27,8 @@ import Nri.Ui.UiIcon.V1 as UiIcon
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Svg.V1"
{ name = "Svg"
, version = 1
, categories = [ Icons ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -31,7 +31,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Table.V5"
{ name = "Table"
, version = 5
, state = ()
, update = \_ state -> ( state, Cmd.none )
, subscriptions = \_ -> Sub.none

View File

@ -102,7 +102,8 @@ update msg model =
example : Example State Msg
example =
{ name = "Nri.Ui.Tabs.V6"
{ name = "Tabs"
, version = 6
, categories = [ Layout ]
, atomicDesignType = Molecule
, keyboardSupport =
@ -143,7 +144,7 @@ allTabs : List (Tab Id Msg)
allTabs =
[ { id = First
, idString = "tab-0"
, spaHref = Just "/#/doodad/Nri.Ui.Tabs.V6"
, spaHref = Just "/#/doodad/Nri.Ui.Tabs.6"
, tabView = Tabs.viewTabDefault "Link example"
, panelView = Html.text "First Panel"
}

View File

@ -30,7 +30,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.Text.V4"
{ name = "Text"
, version = 4
, categories = [ Text ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -26,7 +26,8 @@ type alias Msg =
example : Example State Msg
example =
{ name = "Nri.Ui.Text.Writing.V1"
{ name = "Text.Writing"
, version = 1
, categories = [ Text ]
, atomicDesignType = Atom
, keyboardSupport = []

View File

@ -38,7 +38,8 @@ type alias State =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.TextArea.V4"
{ name = "TextArea"
, version = 4
, state = init
, update = update
, subscriptions = \_ -> Sub.none

View File

@ -52,7 +52,8 @@ type alias ExampleConfig =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.TextInput.V6"
{ name = "TextInput"
, version = 6
, categories = [ Inputs ]
, atomicDesignType = Molecule
, keyboardSupport = []

View File

@ -55,7 +55,8 @@ update msg model =
example : Example State Msg
example =
{ name = "Nri.Ui.Tooltip.V1"
{ name = "Tooltip"
, version = 1
, categories = [ Widgets ]
, atomicDesignType = Molecule
, keyboardSupport = []

View File

@ -27,7 +27,8 @@ type alias Msg =
{-| -}
example : Example State Msg
example =
{ name = "Nri.Ui.UiIcon.V1"
{ name = "UiIcon"
, version = 1
, categories = List.singleton Icons
, atomicDesignType = Atom
, keyboardSupport = []