Adds Vendor prefix module from monolith

This commit is contained in:
Tessa Kelly 2019-07-11 12:49:08 -07:00
parent 4a62b8271d
commit b54c5a2358
2 changed files with 58 additions and 10 deletions

View File

@ -0,0 +1,49 @@
module Nri.Ui.CssVendorPrefix.V1 exposing (property, value, complexProperty)
{-| Vendor prefixed css properties.
@docs property, value, complexProperty
-}
import Css
{-| Css vendor prefixes
-}
prefixes : List String
prefixes =
[ "-webkit-", "-moz-", "-o-", "-ms-", "" ]
{-| Same as Css.property but vendor prefixed.
-}
property : String -> String -> Css.Style
property prop value_ =
prefixes
|> List.map
(\prefix ->
Css.property (prefix ++ prop) value_
)
|> Css.batch
{-| Same as Css.property but vendor prefixed.
-}
value : String -> String -> Css.Style
value prop value_ =
prefixes
|> List.map
(\prefix ->
Css.property prop (prefix ++ value_)
)
|> Css.batch
{-| Used to build more complex Css styles
-}
complexProperty : (String -> Css.Style) -> Css.Style
complexProperty buildProp =
prefixes
|> List.map buildProp
|> Css.batch

View File

@ -3,19 +3,18 @@ module Nri.Ui.SortableTable.V1 exposing (Direction(..), arrow, arrowActive, arro
import Css exposing (..)
import Css.File exposing (Stylesheet, UniqueClass, stylesheet, uniqueClass)
import Css.Global exposing (Snippet, adjacentSiblings, children, class, descendants, each, everything, media, selector, withClass)
import Css.VendorPrefixed
import FlexBoxWithVendorPrefix as FlexBox
import Nri.Ui.Colors.V1
import Nri.Ui.CssVendorPrefix.V1 as CssVendorPrefix
sortHeader : UniqueClass
sortHeader =
uniqueClass
[ FlexBox.displayFlex
, FlexBox.alignItems FlexBox.center
, FlexBox.justifyContent FlexBox.spaceBetween
[ Css.displayFlex
, Css.alignItems Css.center
, Css.justifyContent Css.spaceBetween
, cursor pointer
, Css.VendorPrefixed.property "user-select" "none"
, CssVendorPrefix.property "user-select" "none"
]
@ -42,10 +41,10 @@ sortActive =
arrows : UniqueClass
arrows =
uniqueClass
[ FlexBox.displayFlex
, FlexBox.flexDirection FlexBox.column
, FlexBox.alignItems FlexBox.center
, FlexBox.justifyContent FlexBox.center
[ Css.displayFlex
, Css.flexDirection Css.column
, Css.alignItems Css.center
, Css.justifyContent Css.center
]