mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-28 18:24:04 +03:00
Merge pull request #57 from NoRedInk/add-custom-button
Add custom button
This commit is contained in:
commit
5c203314c6
@ -11,6 +11,7 @@ module Nri.Ui.Button.V2
|
|||||||
, button
|
, button
|
||||||
, buttonDeprecated
|
, buttonDeprecated
|
||||||
, copyToClipboard
|
, copyToClipboard
|
||||||
|
, customButton
|
||||||
, delete
|
, delete
|
||||||
, link
|
, link
|
||||||
, linkExternal
|
, linkExternal
|
||||||
@ -178,6 +179,13 @@ This button will be Disabled if the button state is:
|
|||||||
-}
|
-}
|
||||||
button : ButtonConfig msg -> ButtonContent -> Html msg
|
button : ButtonConfig msg -> ButtonContent -> Html msg
|
||||||
button config content =
|
button config content =
|
||||||
|
customButton [] config content
|
||||||
|
|
||||||
|
|
||||||
|
{-| Exactly the same as button but you can pass in a list of attributes
|
||||||
|
-}
|
||||||
|
customButton : List (Html.Attribute msg) -> ButtonConfig msg -> ButtonContent -> Html msg
|
||||||
|
customButton attributes config content =
|
||||||
let
|
let
|
||||||
buttonStyle =
|
buttonStyle =
|
||||||
case content.state of
|
case content.state of
|
||||||
@ -220,12 +228,14 @@ button config content =
|
|||||||
True
|
True
|
||||||
in
|
in
|
||||||
Html.button
|
Html.button
|
||||||
[ buttonClass config.size config.width buttonStyle
|
([ buttonClass config.size config.width buttonStyle
|
||||||
, onClick config.onClick
|
, onClick config.onClick
|
||||||
, Html.Attributes.disabled disabled
|
, Html.Attributes.disabled disabled
|
||||||
, Html.Attributes.type_ "button"
|
, Html.Attributes.type_ "button"
|
||||||
, widthStyle config.width
|
, widthStyle config.width
|
||||||
]
|
]
|
||||||
|
++ attributes
|
||||||
|
)
|
||||||
[ viewLabel content.icon content.label ]
|
[ viewLabel content.icon content.label ]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user