mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-20 04:01:40 +03:00
Merge pull request #896 from NoRedInk/tessalex/loading-preview
Tessalex/loading preview
This commit is contained in:
commit
f6a95ce85b
@ -5,7 +5,10 @@ module Nri.Ui.SortableTable.V2 exposing
|
|||||||
, invariantSort, simpleSort, combineSorters
|
, invariantSort, simpleSort, combineSorters
|
||||||
)
|
)
|
||||||
|
|
||||||
{-|
|
{-| TODO for next major version:
|
||||||
|
|
||||||
|
- make sure the "sort" feature is fully accessible
|
||||||
|
- use Nri.Ui.UiIcon.V1 sortArrow and Nri.Ui.UiIcon.V1 sortArrowDown icons for the sort indicators
|
||||||
|
|
||||||
@docs Column, Config, Sorter, State
|
@docs Column, Config, Sorter, State
|
||||||
@docs init, initDescending
|
@docs init, initDescending
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
module Nri.Ui.UiIcon.V1 exposing
|
module Nri.Ui.UiIcon.V1 exposing
|
||||||
( seeMore, openClose, download, sort, gear, flipper, sortArrow
|
( seeMore, openClose, download, sort, gear, flipper
|
||||||
, archive, unarchive
|
, archive, unarchive
|
||||||
, playInCircle, pauseInCircle, stopInCircle, skip
|
, playInCircle, pauseInCircle, stopInCircle, skip
|
||||||
, share, preview, copyToClipboard, gift
|
, share, preview, copyToClipboard, gift
|
||||||
@ -12,7 +12,7 @@ module Nri.Ui.UiIcon.V1 exposing
|
|||||||
, missingDocument, document, documents, newspaper, openBook, openBooks
|
, missingDocument, document, documents, newspaper, openBook, openBooks
|
||||||
, edit, pen, highlighter
|
, edit, pen, highlighter
|
||||||
, speechBalloon, mail
|
, speechBalloon, mail
|
||||||
, arrowTop, arrowRight, arrowDown, arrowLeft, arrowPointingRight, arrowPointingRightThick
|
, arrowTop, arrowRight, arrowDown, arrowLeft, arrowPointingRight, arrowPointingRightThick, sortArrow, sortArrowDown
|
||||||
, checkmark, checkmarkInCircle, x
|
, checkmark, checkmarkInCircle, x
|
||||||
, attention, exclamation
|
, attention, exclamation
|
||||||
, flag, star, starFilled, starOutline
|
, flag, star, starFilled, starOutline
|
||||||
@ -29,7 +29,7 @@ module Nri.Ui.UiIcon.V1 exposing
|
|||||||
|
|
||||||
{-| How to add new icons: <https://paper.dropbox.com/doc/How-to-create-a-new-SVG-icon-for-use-in-Elm--Ay9uhSLfGUAix0ERIiJ0Dm8dAg-8WNqtARdr4EgjmYEHPeYD>
|
{-| How to add new icons: <https://paper.dropbox.com/doc/How-to-create-a-new-SVG-icon-for-use-in-Elm--Ay9uhSLfGUAix0ERIiJ0Dm8dAg-8WNqtARdr4EgjmYEHPeYD>
|
||||||
|
|
||||||
@docs seeMore, openClose, download, sort, gear, flipper, sortArrow
|
@docs seeMore, openClose, download, sort, gear, flipper
|
||||||
@docs archive, unarchive
|
@docs archive, unarchive
|
||||||
@docs playInCircle, pauseInCircle, stopInCircle, skip
|
@docs playInCircle, pauseInCircle, stopInCircle, skip
|
||||||
@docs share, preview, copyToClipboard, gift
|
@docs share, preview, copyToClipboard, gift
|
||||||
@ -42,7 +42,7 @@ module Nri.Ui.UiIcon.V1 exposing
|
|||||||
@docs missingDocument, document, documents, newspaper, openBook, openBooks
|
@docs missingDocument, document, documents, newspaper, openBook, openBooks
|
||||||
@docs edit, pen, highlighter
|
@docs edit, pen, highlighter
|
||||||
@docs speechBalloon, mail
|
@docs speechBalloon, mail
|
||||||
@docs arrowTop, arrowRight, arrowDown, arrowLeft, arrowPointingRight, arrowPointingRightThick
|
@docs arrowTop, arrowRight, arrowDown, arrowLeft, arrowPointingRight, arrowPointingRightThick, sortArrow, sortArrowDown
|
||||||
@docs checkmark, checkmarkInCircle, x
|
@docs checkmark, checkmarkInCircle, x
|
||||||
@docs attention, exclamation
|
@docs attention, exclamation
|
||||||
@docs flag, star, starFilled, starOutline
|
@docs flag, star, starFilled, starOutline
|
||||||
@ -641,16 +641,30 @@ arrowPointingRight =
|
|||||||
|> Nri.Ui.Svg.V1.fromHtml
|
|> Nri.Ui.Svg.V1.fromHtml
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
sortArrow_ : List (Svg.Attribute msg) -> Svg.Svg msg
|
||||||
sortArrow : Nri.Ui.Svg.V1.Svg
|
sortArrow_ transforms =
|
||||||
sortArrow =
|
|
||||||
Svg.svg
|
Svg.svg
|
||||||
[ Attributes.width "100%"
|
([ Attributes.width "100%"
|
||||||
, Attributes.height "100%"
|
, Attributes.height "100%"
|
||||||
, Attributes.fill "currentcolor"
|
, Attributes.fill "currentcolor"
|
||||||
, Attributes.viewBox "0 0 8 6"
|
, Attributes.viewBox "0 0 8 6"
|
||||||
]
|
]
|
||||||
|
++ transforms
|
||||||
|
)
|
||||||
[ Svg.polygon [ Attributes.points "0 6 4 0 8 6 0 6" ] [] ]
|
[ Svg.polygon [ Attributes.points "0 6 4 0 8 6 0 6" ] [] ]
|
||||||
|
|
||||||
|
|
||||||
|
{-| -}
|
||||||
|
sortArrow : Nri.Ui.Svg.V1.Svg
|
||||||
|
sortArrow =
|
||||||
|
sortArrow_ []
|
||||||
|
|> Nri.Ui.Svg.V1.fromHtml
|
||||||
|
|
||||||
|
|
||||||
|
{-| -}
|
||||||
|
sortArrowDown : Nri.Ui.Svg.V1.Svg
|
||||||
|
sortArrowDown =
|
||||||
|
sortArrow_ [ Attributes.transform "rotate(180)" ]
|
||||||
|> Nri.Ui.Svg.V1.fromHtml
|
|> Nri.Ui.Svg.V1.fromHtml
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,14 @@ example =
|
|||||||
, state = init
|
, state = init
|
||||||
, update = update
|
, update = update
|
||||||
, subscriptions = subscriptions
|
, subscriptions = subscriptions
|
||||||
, preview = []
|
, preview =
|
||||||
|
[ Loading.spinningDots
|
||||||
|
|> Svg.withCss
|
||||||
|
[ Css.property "animation-name" "none" |> Css.important
|
||||||
|
, Css.alignSelf Css.center
|
||||||
|
]
|
||||||
|
|> Svg.toHtml
|
||||||
|
]
|
||||||
, view =
|
, view =
|
||||||
\ellieLinkConfig { showLoadingFadeIn, showLoading, showSpinners } ->
|
\ellieLinkConfig { showLoadingFadeIn, showLoading, showSpinners } ->
|
||||||
[ if showLoading then
|
[ if showLoading then
|
||||||
|
@ -7,10 +7,16 @@ module Examples.SortableTable exposing (Msg, State, example)
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
import Category exposing (Category(..))
|
import Category exposing (Category(..))
|
||||||
|
import Css exposing (..)
|
||||||
import Example exposing (Example)
|
import Example exposing (Example)
|
||||||
import Html.Styled as Html
|
import Html.Styled as Html exposing (..)
|
||||||
|
import Html.Styled.Attributes exposing (css)
|
||||||
|
import Nri.Ui.Colors.V1 as Colors
|
||||||
import Nri.Ui.Heading.V2 as Heading
|
import Nri.Ui.Heading.V2 as Heading
|
||||||
import Nri.Ui.SortableTable.V2 as SortableTable
|
import Nri.Ui.SortableTable.V2 as SortableTable
|
||||||
|
import Nri.Ui.Svg.V1 as Svg exposing (Svg)
|
||||||
|
import Nri.Ui.Table.V5 as Table
|
||||||
|
import Nri.Ui.UiIcon.V1 as UiIcon
|
||||||
|
|
||||||
|
|
||||||
type Column
|
type Column
|
||||||
@ -39,7 +45,59 @@ example =
|
|||||||
, state = init
|
, state = init
|
||||||
, update = update
|
, update = update
|
||||||
, subscriptions = \_ -> Sub.none
|
, subscriptions = \_ -> Sub.none
|
||||||
, preview = []
|
, preview =
|
||||||
|
let
|
||||||
|
header name =
|
||||||
|
div
|
||||||
|
[ css
|
||||||
|
[ Css.displayFlex
|
||||||
|
, Css.justifyContent Css.spaceBetween
|
||||||
|
, Css.alignItems Css.center
|
||||||
|
]
|
||||||
|
]
|
||||||
|
[ text name
|
||||||
|
, div
|
||||||
|
[ css
|
||||||
|
[ Css.displayFlex
|
||||||
|
, Css.flexDirection Css.column
|
||||||
|
, Css.marginTop (Css.px -4)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
[ renderPreviewArrow UiIcon.sortArrow
|
||||||
|
, renderPreviewArrow UiIcon.sortArrowDown
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
renderPreviewArrow : Svg -> Html msg
|
||||||
|
renderPreviewArrow arrow =
|
||||||
|
arrow
|
||||||
|
|> Svg.withColor Colors.gray75
|
||||||
|
|> Svg.withWidth (Css.px 12)
|
||||||
|
|> Svg.withHeight (Css.px 12)
|
||||||
|
|> Svg.toHtml
|
||||||
|
in
|
||||||
|
[ Table.view
|
||||||
|
[ Table.custom
|
||||||
|
{ header = header "X"
|
||||||
|
, view = .x >> Html.text
|
||||||
|
, width = px 50
|
||||||
|
, cellStyles = always []
|
||||||
|
}
|
||||||
|
, Table.custom
|
||||||
|
{ header = header "Y"
|
||||||
|
, view = .y >> Html.text
|
||||||
|
, width = px 50
|
||||||
|
, cellStyles = always []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
[ { x = "Row 1 X"
|
||||||
|
, y = "Row 1 Y"
|
||||||
|
}
|
||||||
|
, { x = "Row 2 X"
|
||||||
|
, y = "Row 2 Y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
, view =
|
, view =
|
||||||
\ellieLinkConfig { sortState } ->
|
\ellieLinkConfig { sortState } ->
|
||||||
let
|
let
|
||||||
|
@ -7,11 +7,15 @@ module Examples.TextArea exposing (Msg, State, example)
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
import Category exposing (Category(..))
|
import Category exposing (Category(..))
|
||||||
|
import Css
|
||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
import Example exposing (Example)
|
import Example exposing (Example)
|
||||||
import Html.Styled as Html
|
import Html.Styled as Html
|
||||||
|
import Html.Styled.Attributes as Attributes exposing (css)
|
||||||
import Nri.Ui.Checkbox.V5 as Checkbox
|
import Nri.Ui.Checkbox.V5 as Checkbox
|
||||||
|
import Nri.Ui.Colors.V1 as Colors
|
||||||
import Nri.Ui.Heading.V2 as Heading
|
import Nri.Ui.Heading.V2 as Heading
|
||||||
|
import Nri.Ui.InputStyles.V3 as InputStyles exposing (Theme(..))
|
||||||
import Nri.Ui.TextArea.V4 as TextArea
|
import Nri.Ui.TextArea.V4 as TextArea
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +46,29 @@ example =
|
|||||||
, subscriptions = \_ -> Sub.none
|
, subscriptions = \_ -> Sub.none
|
||||||
, categories = [ Inputs ]
|
, categories = [ Inputs ]
|
||||||
, keyboardSupport = []
|
, keyboardSupport = []
|
||||||
, preview = []
|
, preview =
|
||||||
|
[ Html.div [ css [ Css.position Css.relative ] ]
|
||||||
|
[ Html.textarea
|
||||||
|
[ css
|
||||||
|
[ InputStyles.input Standard False
|
||||||
|
, Css.minHeight (Css.px 100)
|
||||||
|
, Css.maxWidth (Css.px 140)
|
||||||
|
, Css.backgroundColor Colors.white |> Css.important
|
||||||
|
, Css.cursor Css.pointer |> Css.important
|
||||||
|
, Css.resize Css.none
|
||||||
|
]
|
||||||
|
, Attributes.class "override-sass-styles"
|
||||||
|
, Attributes.disabled True
|
||||||
|
, Attributes.id "preview-textarea"
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
, Html.label
|
||||||
|
[ css [ InputStyles.label Standard False ]
|
||||||
|
, Attributes.for "preview-textarea"
|
||||||
|
]
|
||||||
|
[ Html.text "Label" ]
|
||||||
|
]
|
||||||
|
]
|
||||||
, view =
|
, view =
|
||||||
\ellieLinkConfig state ->
|
\ellieLinkConfig state ->
|
||||||
[ Heading.h1 [] [ Html.text "Textarea controls" ]
|
[ Heading.h1 [] [ Html.text "Textarea controls" ]
|
||||||
|
@ -60,7 +60,6 @@ example =
|
|||||||
, ( "download", UiIcon.download )
|
, ( "download", UiIcon.download )
|
||||||
, ( "sort", UiIcon.sort )
|
, ( "sort", UiIcon.sort )
|
||||||
, ( "gear", UiIcon.gear )
|
, ( "gear", UiIcon.gear )
|
||||||
, ( "sortArrow", UiIcon.sortArrow )
|
|
||||||
]
|
]
|
||||||
, viewExampleSection "Archive & Unarchive"
|
, viewExampleSection "Archive & Unarchive"
|
||||||
[ ( "archive", UiIcon.archive )
|
[ ( "archive", UiIcon.archive )
|
||||||
@ -128,6 +127,8 @@ example =
|
|||||||
, ( "arrowLeft", UiIcon.arrowLeft )
|
, ( "arrowLeft", UiIcon.arrowLeft )
|
||||||
, ( "arrowPointingRight", UiIcon.arrowPointingRight )
|
, ( "arrowPointingRight", UiIcon.arrowPointingRight )
|
||||||
, ( "arrowPointingRightThick", UiIcon.arrowPointingRightThick )
|
, ( "arrowPointingRightThick", UiIcon.arrowPointingRightThick )
|
||||||
|
, ( "sortArrow", UiIcon.sortArrow )
|
||||||
|
, ( "sortArrowDown", UiIcon.sortArrowDown )
|
||||||
]
|
]
|
||||||
, viewExampleSection "Sticky things"
|
, viewExampleSection "Sticky things"
|
||||||
[ ( "checkmark", UiIcon.checkmark )
|
[ ( "checkmark", UiIcon.checkmark )
|
||||||
|
Loading…
Reference in New Issue
Block a user