mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-28 01:45:20 +03:00
🎨 Pull Category out into its own module
This commit is contained in:
parent
f4a37acf76
commit
2b87eb84df
156
styleguide-app/Category.elm
Normal file
156
styleguide-app/Category.elm
Normal file
@ -0,0 +1,156 @@
|
||||
module Category exposing
|
||||
( Category(..)
|
||||
, fromString
|
||||
, forDisplay, forId
|
||||
)
|
||||
|
||||
{-|
|
||||
|
||||
@docs Category
|
||||
@docs fromString
|
||||
@docs forDisplay, forId
|
||||
|
||||
-}
|
||||
|
||||
|
||||
{-| -}
|
||||
type Category
|
||||
= Tables
|
||||
| Inputs
|
||||
| Buttons
|
||||
| Icons
|
||||
| Widgets
|
||||
| Layout
|
||||
| Messaging
|
||||
| Modals
|
||||
| Colors
|
||||
| Text
|
||||
| Pages
|
||||
| Animations
|
||||
|
||||
|
||||
{-| Used for route changes
|
||||
-}
|
||||
fromString : String -> Result String Category
|
||||
fromString string =
|
||||
case string of
|
||||
"Tables" ->
|
||||
Ok Tables
|
||||
|
||||
"Inputs" ->
|
||||
Ok Inputs
|
||||
|
||||
"Widgets" ->
|
||||
Ok Widgets
|
||||
|
||||
"Layout" ->
|
||||
Ok Layout
|
||||
|
||||
"Buttons" ->
|
||||
Ok Buttons
|
||||
|
||||
"Icons" ->
|
||||
Ok Icons
|
||||
|
||||
"Messaging" ->
|
||||
Ok Messaging
|
||||
|
||||
"Modals" ->
|
||||
Ok Modals
|
||||
|
||||
"Colors" ->
|
||||
Ok Colors
|
||||
|
||||
"Text" ->
|
||||
Ok Text
|
||||
|
||||
"Pages" ->
|
||||
Ok Pages
|
||||
|
||||
"Animations" ->
|
||||
Ok Animations
|
||||
|
||||
_ ->
|
||||
Err "Invalid String"
|
||||
|
||||
|
||||
{-| -}
|
||||
forDisplay : Category -> String
|
||||
forDisplay category =
|
||||
case category of
|
||||
Tables ->
|
||||
"Tables"
|
||||
|
||||
Inputs ->
|
||||
"Inputs"
|
||||
|
||||
Widgets ->
|
||||
"Widgets"
|
||||
|
||||
Layout ->
|
||||
"Layout"
|
||||
|
||||
Buttons ->
|
||||
"Buttons and Links"
|
||||
|
||||
Icons ->
|
||||
"Icons"
|
||||
|
||||
Messaging ->
|
||||
"Alerts and Messages"
|
||||
|
||||
Modals ->
|
||||
"Modals"
|
||||
|
||||
Colors ->
|
||||
"Colors"
|
||||
|
||||
Text ->
|
||||
"Text and Fonts"
|
||||
|
||||
Pages ->
|
||||
"Error Pages"
|
||||
|
||||
Animations ->
|
||||
"Animations"
|
||||
|
||||
|
||||
{-| -}
|
||||
forId : Category -> String
|
||||
forId category =
|
||||
case category of
|
||||
Tables ->
|
||||
"tables"
|
||||
|
||||
Inputs ->
|
||||
"inputs"
|
||||
|
||||
Widgets ->
|
||||
"widgets"
|
||||
|
||||
Layout ->
|
||||
"layout"
|
||||
|
||||
Buttons ->
|
||||
"buttons-and-links"
|
||||
|
||||
Icons ->
|
||||
"icons"
|
||||
|
||||
Messaging ->
|
||||
"alerts-and-messages"
|
||||
|
||||
Modals ->
|
||||
"modals"
|
||||
|
||||
Colors ->
|
||||
"colors"
|
||||
|
||||
Text ->
|
||||
"text-and-fonts"
|
||||
|
||||
Pages ->
|
||||
"error-pages"
|
||||
|
||||
Animations ->
|
||||
"animations"
|
@ -9,11 +9,12 @@ module Examples.Accordion exposing
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css exposing (..)
|
||||
import Dict exposing (Dict)
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Accordion.V1 as Accordion
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Fonts.V1 as Fonts
|
||||
|
@ -6,8 +6,9 @@ module Examples.Alert exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Html.Styled as Html
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Alert.V4 as Alert
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
||||
|
@ -6,8 +6,9 @@ module Examples.AssignmentIcon exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Examples.IconExamples as IconExamples
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.AssignmentIcon.V1 as AssignmentIcon
|
||||
import Nri.Ui.Icon.V5 as Icon
|
||||
|
||||
|
@ -6,10 +6,11 @@ module Examples.BannerAlert exposing (example, State, init, Msg, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled exposing (a, div, h3, pre, text)
|
||||
import Html.Styled.Attributes as Attributes
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.BannerAlert.V6 as BannerAlert
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Fonts.V1 as Fonts
|
||||
|
@ -6,11 +6,12 @@ module Examples.Button exposing (Msg, State, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css exposing (middle, verticalAlign)
|
||||
import Debug.Control as Control exposing (Control)
|
||||
import Html.Styled exposing (..)
|
||||
import Html.Styled.Attributes exposing (css, id)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample, ModuleMessages)
|
||||
import ModuleExample exposing (ModuleExample, ModuleMessages)
|
||||
import Nri.Ui.Button.V10 as Button
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.Svg.V1 as Svg exposing (Svg)
|
||||
|
@ -6,10 +6,11 @@ module Examples.Callout exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes exposing (href, title)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Callout.V1 as Callout exposing (callout)
|
||||
|
||||
|
||||
|
@ -6,10 +6,11 @@ module Examples.Checkbox exposing (Msg, State, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled as Html exposing (..)
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Checkbox.V5 as Checkbox
|
||||
import Nri.Ui.Data.PremiumLevel as PremiumLevel exposing (PremiumLevel(..))
|
||||
import Nri.Ui.PremiumCheckbox.V6 as PremiumCheckbox
|
||||
|
@ -16,13 +16,14 @@ module Examples.ClickableSvg exposing
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Color exposing (Color)
|
||||
import Css
|
||||
import Examples.IconExamples as IconExamples
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes as Attributes
|
||||
import Html.Styled.Events as Events
|
||||
import ModuleExample exposing (Category(..), ModuleExample, ModuleMessages)
|
||||
import ModuleExample exposing (ModuleExample, ModuleMessages)
|
||||
import Nri.Ui.ClickableSvg.V1 as ClickableSvg
|
||||
import Nri.Ui.Colors.Extra exposing (fromCssColor, toCssColor)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
|
@ -6,11 +6,12 @@ module Examples.ClickableText exposing (Msg, State, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css exposing (middle, verticalAlign)
|
||||
import Debug.Control as Control exposing (Control)
|
||||
import Html.Styled exposing (..)
|
||||
import Html.Styled.Attributes exposing (css, id)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample, ModuleMessages)
|
||||
import ModuleExample exposing (ModuleExample, ModuleMessages)
|
||||
import Nri.Ui.ClickableText.V3 as ClickableText
|
||||
import Nri.Ui.Svg.V1 as Svg exposing (Svg)
|
||||
import Nri.Ui.Text.V4 as Text
|
||||
|
@ -6,11 +6,12 @@ module Examples.Colors exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Color exposing (highContrast)
|
||||
import Css
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes as Attributes exposing (css)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Colors.Extra
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
@ -6,11 +6,12 @@ module Examples.DisclosureIndicator exposing (Msg, State, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import Html.Styled.Events exposing (onClick)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Button.V8 as Button
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.DisclosureIndicator.V2 as DisclosureIndicator
|
||||
|
@ -6,8 +6,9 @@ module Examples.Dropdown exposing (Msg, State, Value, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Html.Styled
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Dropdown.V2
|
||||
|
||||
|
||||
|
@ -6,9 +6,10 @@ module Examples.Fonts exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Fonts.V1 as Fonts
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
||||
|
@ -6,9 +6,10 @@ module Examples.Heading exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled as Html
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
||||
|
@ -6,11 +6,12 @@ module Examples.Icon exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Css.Global
|
||||
import Html.Styled as Html exposing (Html)
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.AssetPath as AssetPath exposing (Asset(..))
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
@ -6,9 +6,10 @@ module Examples.Logo exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Examples.IconExamples as IconExamples
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Logo.V1 as Logo
|
||||
|
||||
|
@ -6,8 +6,9 @@ module Examples.MasteryIcon exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Examples.IconExamples as IconExamples
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.MasteryIcon.V1 as MasteryIcon
|
||||
|
||||
|
@ -7,11 +7,12 @@ module Examples.Modal exposing (Msg, State, example, init, update, subscriptions
|
||||
-}
|
||||
|
||||
import Accessibility.Styled as Html exposing (Html, div, h3, h4, p, span, text)
|
||||
import Category exposing (Category(..))
|
||||
import Css exposing (..)
|
||||
import Css.Global
|
||||
import Html as Root
|
||||
import Html.Styled.Attributes as Attributes
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Button.V10 as Button
|
||||
import Nri.Ui.Checkbox.V5 as Checkbox
|
||||
import Nri.Ui.ClickableText.V3 as ClickableText
|
||||
|
@ -6,10 +6,11 @@ module Examples.Page exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Css.Global exposing (Snippet, adjacentSiblings, children, class, descendants, each, everything, media, selector, withClass)
|
||||
import Html.Styled as Html exposing (Html)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.Page.V3 as Page
|
||||
|
||||
|
@ -6,10 +6,11 @@ module Examples.Pennant exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css exposing (..)
|
||||
import Html.Styled as Html exposing (Html)
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Fonts.V1 as Fonts
|
||||
import Nri.Ui.Pennant.V2 as Pennant
|
||||
import Nri.Ui.Svg.V1 as Svg
|
||||
|
@ -17,11 +17,12 @@ module Examples.SegmentedControl exposing
|
||||
-}
|
||||
|
||||
import Accessibility.Styled
|
||||
import Category exposing (Category(..))
|
||||
import Debug.Control as Control exposing (Control)
|
||||
import Html.Styled as Html exposing (Html)
|
||||
import Html.Styled.Attributes as Attr
|
||||
import Html.Styled.Events as Events
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.SegmentedControl.V8 as SegmentedControl
|
||||
import Nri.Ui.Svg.V1 as Svg exposing (Svg)
|
||||
|
@ -16,10 +16,11 @@ module Examples.Select exposing
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled
|
||||
import Html.Styled.Attributes
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.Select.V7 as Select
|
||||
|
||||
|
@ -7,11 +7,12 @@ module Examples.Slide exposing (Msg, State, example, init, update)
|
||||
-}
|
||||
|
||||
import Accessibility.Styled as Html
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import Html.Styled.Keyed as Keyed
|
||||
import List.Zipper as Zipper exposing (Zipper)
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Button.V8 as Button
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Slide.V1 as Slide
|
||||
|
@ -7,10 +7,11 @@ module Examples.SlideModal exposing (Msg, State, example, init, update)
|
||||
-}
|
||||
|
||||
import Accessibility.Styled as Html exposing (Html, div, h3, p, text)
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled exposing (fromUnstyled)
|
||||
import Html.Styled.Attributes exposing (css)
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Button.V8 as Button
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.SlideModal.V2 as SlideModal
|
||||
|
@ -6,8 +6,9 @@ module Examples.SortableTable exposing (Msg, State, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Html.Styled as Html
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.SortableTable.V1 as SortableTable
|
||||
|
||||
|
@ -16,13 +16,14 @@ module Examples.Svg exposing
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Color exposing (Color)
|
||||
import Css
|
||||
import Examples.IconExamples as IconExamples
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes as Attributes
|
||||
import Html.Styled.Events as Events
|
||||
import ModuleExample exposing (Category(..), ModuleExample, ModuleMessages)
|
||||
import ModuleExample exposing (ModuleExample, ModuleMessages)
|
||||
import Nri.Ui.Colors.Extra exposing (fromCssColor, toCssColor)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
@ -4,9 +4,10 @@ module Examples.Table exposing (Msg, State, example, init, update)
|
||||
@docs Msg, State, example, init, update
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Css exposing (..)
|
||||
import Html.Styled as Html
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Button.V5 as Button
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
@ -9,9 +9,10 @@ module Examples.Tabs exposing
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Html.Styled as Html
|
||||
import List.Zipper
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Tabs.V4 as Tabs
|
||||
|
||||
|
||||
|
@ -6,9 +6,10 @@ module Examples.Text exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Html.Styled as Html
|
||||
import Html.Styled.Attributes as Attributes
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.Text.V4 as Text
|
||||
|
||||
|
@ -4,8 +4,9 @@ module Examples.Text.Writing exposing (example)
|
||||
@docs example
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Html.Styled exposing (text)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Text.Writing.V1 as TextWriting
|
||||
|
||||
|
||||
|
@ -6,9 +6,10 @@ module Examples.TextArea exposing (Msg, State, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Dict exposing (Dict)
|
||||
import Html.Styled as Html
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.AssetPath exposing (Asset(..))
|
||||
import Nri.Ui.Checkbox.V5 as Checkbox
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
|
@ -6,9 +6,10 @@ module Examples.TextInput exposing (Msg, State, example, init, update)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Dict exposing (Dict)
|
||||
import Html.Styled as Html
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.TextInput.V5 as TextInput
|
||||
|
||||
|
@ -7,9 +7,10 @@ module Examples.Tooltip exposing (example, init, update, State, Msg)
|
||||
-}
|
||||
|
||||
import Accessibility.Styled as Html
|
||||
import Category exposing (Category(..))
|
||||
import Css
|
||||
import Html.Styled.Attributes exposing (css, href)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.Text.V4 as Text
|
||||
import Nri.Ui.Tooltip.V1 as Tooltip
|
||||
|
@ -6,8 +6,9 @@ module Examples.UiIcon exposing (example)
|
||||
|
||||
-}
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Examples.IconExamples as IconExamples
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.UiIcon.V1 as UiIcon
|
||||
|
||||
|
@ -2,12 +2,13 @@ module Main exposing (init, main)
|
||||
|
||||
import Browser exposing (Document, UrlRequest(..))
|
||||
import Browser.Navigation exposing (Key)
|
||||
import Category exposing (Category(..))
|
||||
import Css exposing (..)
|
||||
import Html as RootHtml
|
||||
import Html.Attributes
|
||||
import Html.Styled as Html exposing (Html, img)
|
||||
import Html.Styled.Attributes as Attributes exposing (..)
|
||||
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample, categoryForDisplay, categoryForId)
|
||||
import ModuleExample as ModuleExample exposing (ModuleExample)
|
||||
import Nri.Ui.Colors.V1 as Colors
|
||||
import Nri.Ui.Css.VendorPrefixed as VendorPrefixed
|
||||
import Nri.Ui.Fonts.V1 as Fonts
|
||||
@ -123,11 +124,11 @@ view_ model =
|
||||
[ Html.styled Html.section
|
||||
[ sectionStyles ]
|
||||
[]
|
||||
[ Heading.h2 [] [ Html.text (categoryForDisplay category) ]
|
||||
[ Heading.h2 [] [ Html.text (Category.forDisplay category) ]
|
||||
, nriThemedModules model.moduleStates
|
||||
|> List.filter (\doodad -> category == doodad.category)
|
||||
|> List.map (ModuleExample.view True)
|
||||
|> Html.div [ id (categoryForId category) ]
|
||||
|> Html.div [ id (Category.forId category) ]
|
||||
|> Html.map UpdateModuleStates
|
||||
]
|
||||
]
|
||||
@ -176,7 +177,7 @@ navigation route =
|
||||
navLink category =
|
||||
categoryLink (isActive category)
|
||||
("#category/" ++ Debug.toString category)
|
||||
(categoryForDisplay category)
|
||||
(Category.forDisplay category)
|
||||
|
||||
toNavLi element =
|
||||
Html.li
|
||||
|
@ -1,13 +1,6 @@
|
||||
module ModuleExample exposing
|
||||
( Category(..)
|
||||
, ModuleExample
|
||||
, ModuleMessages
|
||||
, categoryForDisplay
|
||||
, categoryForId
|
||||
, categoryFromString
|
||||
, view
|
||||
)
|
||||
module ModuleExample exposing (ModuleExample, ModuleMessages, view)
|
||||
|
||||
import Category exposing (Category)
|
||||
import Css exposing (..)
|
||||
import Html.Styled as Html exposing (Html, img)
|
||||
import Html.Styled.Attributes as Attributes
|
||||
@ -29,146 +22,6 @@ type alias ModuleMessages moduleMsg parentMsg =
|
||||
}
|
||||
|
||||
|
||||
type Category
|
||||
= Tables
|
||||
| Inputs
|
||||
| Buttons
|
||||
| Icons
|
||||
| Widgets
|
||||
| Layout
|
||||
| Messaging
|
||||
| Modals
|
||||
| Colors
|
||||
| Text
|
||||
| Pages
|
||||
| Animations
|
||||
|
||||
|
||||
{-| Used for route changes
|
||||
-}
|
||||
categoryFromString : String -> Result String Category
|
||||
categoryFromString string =
|
||||
case string of
|
||||
"Tables" ->
|
||||
Ok Tables
|
||||
|
||||
"Inputs" ->
|
||||
Ok Inputs
|
||||
|
||||
"Widgets" ->
|
||||
Ok Widgets
|
||||
|
||||
"Layout" ->
|
||||
Ok Layout
|
||||
|
||||
"Buttons" ->
|
||||
Ok Buttons
|
||||
|
||||
"Icons" ->
|
||||
Ok Icons
|
||||
|
||||
"Messaging" ->
|
||||
Ok Messaging
|
||||
|
||||
"Modals" ->
|
||||
Ok Modals
|
||||
|
||||
"Colors" ->
|
||||
Ok Colors
|
||||
|
||||
"Text" ->
|
||||
Ok Text
|
||||
|
||||
"Pages" ->
|
||||
Ok Pages
|
||||
|
||||
"Animations" ->
|
||||
Ok Animations
|
||||
|
||||
_ ->
|
||||
Err "Invalid String"
|
||||
|
||||
|
||||
categoryForDisplay : Category -> String
|
||||
categoryForDisplay category =
|
||||
case category of
|
||||
Tables ->
|
||||
"Tables"
|
||||
|
||||
Inputs ->
|
||||
"Inputs"
|
||||
|
||||
Widgets ->
|
||||
"Widgets"
|
||||
|
||||
Layout ->
|
||||
"Layout"
|
||||
|
||||
Buttons ->
|
||||
"Buttons and Links"
|
||||
|
||||
Icons ->
|
||||
"Icons"
|
||||
|
||||
Messaging ->
|
||||
"Alerts and Messages"
|
||||
|
||||
Modals ->
|
||||
"Modals"
|
||||
|
||||
Colors ->
|
||||
"Colors"
|
||||
|
||||
Text ->
|
||||
"Text and Fonts"
|
||||
|
||||
Pages ->
|
||||
"Error Pages"
|
||||
|
||||
Animations ->
|
||||
"Animations"
|
||||
|
||||
|
||||
categoryForId : Category -> String
|
||||
categoryForId category =
|
||||
case category of
|
||||
Tables ->
|
||||
"tables"
|
||||
|
||||
Inputs ->
|
||||
"inputs"
|
||||
|
||||
Widgets ->
|
||||
"widgets"
|
||||
|
||||
Layout ->
|
||||
"layout"
|
||||
|
||||
Buttons ->
|
||||
"buttons-and-links"
|
||||
|
||||
Icons ->
|
||||
"icons"
|
||||
|
||||
Messaging ->
|
||||
"alerts-and-messages"
|
||||
|
||||
Modals ->
|
||||
"modals"
|
||||
|
||||
Colors ->
|
||||
"colors"
|
||||
|
||||
Text ->
|
||||
"text-and-fonts"
|
||||
|
||||
Pages ->
|
||||
"error-pages"
|
||||
|
||||
Animations ->
|
||||
"animations"
|
||||
|
||||
|
||||
view : Bool -> ModuleExample msg -> Html msg
|
||||
view showFocusLink { name, content } =
|
||||
Html.div
|
||||
|
@ -1,5 +1,6 @@
|
||||
module NriModules exposing (ModuleStates, Msg, init, nriThemedModules, subscriptions, update)
|
||||
|
||||
import Category exposing (Category(..))
|
||||
import Examples.Accordion
|
||||
import Examples.Alert
|
||||
import Examples.AssignmentIcon
|
||||
@ -36,7 +37,7 @@ import Examples.Tooltip
|
||||
import Examples.UiIcon
|
||||
import Html exposing (Html, img)
|
||||
import Html.Attributes exposing (..)
|
||||
import ModuleExample exposing (Category(..), ModuleExample)
|
||||
import ModuleExample exposing (ModuleExample)
|
||||
import Url exposing (Url)
|
||||
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
module Routes exposing (Route(..), fromLocation)
|
||||
|
||||
import Browser.Navigation as Navigation
|
||||
import ModuleExample exposing (categoryFromString)
|
||||
import Category
|
||||
import Parser exposing ((|.), (|=), Parser)
|
||||
import Url exposing (Url)
|
||||
|
||||
|
||||
type Route
|
||||
= Doodad String
|
||||
| Category ModuleExample.Category
|
||||
| Category Category.Category
|
||||
| All
|
||||
|
||||
|
||||
@ -30,9 +30,9 @@ restOfPath =
|
||||
Parser.getChompedString (Parser.chompWhile (always True))
|
||||
|
||||
|
||||
category : String -> Parser ModuleExample.Category
|
||||
category : String -> Parser Category.Category
|
||||
category string =
|
||||
case categoryFromString string of
|
||||
case Category.fromString string of
|
||||
Ok c ->
|
||||
Parser.succeed c
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user