mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-18 11:11:38 +03:00
prefer explicit type to bool
This commit is contained in:
parent
7f879bf48c
commit
e7824d451d
@ -212,7 +212,7 @@ customButton attributes config content =
|
|||||||
in
|
in
|
||||||
Nri.Ui.styled Html.button
|
Nri.Ui.styled Html.button
|
||||||
"Nri-Button-V3-CustomButton"
|
"Nri-Button-V3-CustomButton"
|
||||||
(buttonStyles config.size config.width buttonStyle False)
|
(buttonStyles config.size config.width buttonStyle Button)
|
||||||
([ onClick config.onClick
|
([ onClick config.onClick
|
||||||
, Attributes.disabled disabled
|
, Attributes.disabled disabled
|
||||||
, Attributes.type_ "button"
|
, Attributes.type_ "button"
|
||||||
@ -261,7 +261,7 @@ copyToClipboard assets config =
|
|||||||
in
|
in
|
||||||
Nri.Ui.styled Html.button
|
Nri.Ui.styled Html.button
|
||||||
"Nri-Ui-Button-V3-copyToClipboard"
|
"Nri-Ui-Button-V3-copyToClipboard"
|
||||||
(buttonStyles config.size config.width (styleToColorPalette config.style) False)
|
(buttonStyles config.size config.width (styleToColorPalette config.style) Button)
|
||||||
[ Widget.label "Copy URL to clipboard"
|
[ Widget.label "Copy URL to clipboard"
|
||||||
, attribute "data-clipboard-text" config.copyText
|
, attribute "data-clipboard-text" config.copyText
|
||||||
, widthStyle config.width
|
, widthStyle config.width
|
||||||
@ -341,7 +341,7 @@ toggleButton config =
|
|||||||
in
|
in
|
||||||
Nri.Ui.styled Html.button
|
Nri.Ui.styled Html.button
|
||||||
"Nri-Ui-Button-V3-toggleButton"
|
"Nri-Ui-Button-V3-toggleButton"
|
||||||
(buttonStyles Medium Nothing SecondaryColors False
|
(buttonStyles Medium Nothing SecondaryColors Button
|
||||||
++ toggledStyles
|
++ toggledStyles
|
||||||
)
|
)
|
||||||
(if config.pressed then
|
(if config.pressed then
|
||||||
@ -490,7 +490,7 @@ linkBase : List (Attribute msg) -> LinkConfig -> Html msg
|
|||||||
linkBase extraAttrs config =
|
linkBase extraAttrs config =
|
||||||
Nri.Ui.styled Html.a
|
Nri.Ui.styled Html.a
|
||||||
"Nri-Button-V3-linkBase"
|
"Nri-Button-V3-linkBase"
|
||||||
(buttonStyles config.size config.width (styleToColorPalette config.style) True
|
(buttonStyles config.size config.width (styleToColorPalette config.style) Anchor
|
||||||
++ [ whiteSpace noWrap
|
++ [ whiteSpace noWrap
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -535,12 +535,12 @@ styleToColorPalette style =
|
|||||||
PremiumColors
|
PremiumColors
|
||||||
|
|
||||||
|
|
||||||
buttonStyles : ButtonSize -> Maybe Int -> ColorPalette -> Bool -> List Style
|
buttonStyles : ButtonSize -> Maybe Int -> ColorPalette -> ElementType -> List Style
|
||||||
buttonStyles size width colorPalette isLink =
|
buttonStyles size width colorPalette elementType =
|
||||||
List.concat
|
List.concat
|
||||||
[ buttonStyle
|
[ buttonStyle
|
||||||
, colorStyle colorPalette
|
, colorStyle colorPalette
|
||||||
, sizeStyle size width isLink
|
, sizeStyle size width elementType
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -730,8 +730,13 @@ colorStyle colorPalette =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
sizeStyle : ButtonSize -> Maybe Int -> Bool -> List Style
|
type ElementType
|
||||||
sizeStyle size width isLink =
|
= Anchor
|
||||||
|
| Button
|
||||||
|
|
||||||
|
|
||||||
|
sizeStyle : ButtonSize -> Maybe Int -> ElementType -> List Style
|
||||||
|
sizeStyle size width elementType =
|
||||||
let
|
let
|
||||||
config =
|
config =
|
||||||
case size of
|
case size of
|
||||||
@ -780,10 +785,12 @@ sizeStyle size width isLink =
|
|||||||
]
|
]
|
||||||
|
|
||||||
lineHeightPx =
|
lineHeightPx =
|
||||||
if isLink then
|
case elementType of
|
||||||
config.height
|
Anchor ->
|
||||||
else
|
config.height
|
||||||
config.lineHeight
|
|
||||||
|
Button ->
|
||||||
|
config.lineHeight
|
||||||
in
|
in
|
||||||
[ fontSize (px config.fontSize)
|
[ fontSize (px config.fontSize)
|
||||||
, borderRadius (px 8)
|
, borderRadius (px 8)
|
||||||
|
Loading…
Reference in New Issue
Block a user