Generally, clickable svgs are square

This commit is contained in:
Tessa Kelly 2022-03-04 10:31:17 -08:00
parent 0eefc2a714
commit 44aa1b4d4d
2 changed files with 24 additions and 6 deletions

View File

@ -3,7 +3,7 @@ module Nri.Ui.ClickableSvg.V2 exposing
, Attribute
, onClick
, href, linkSpa, linkExternal, linkWithMethod, linkWithTracking, linkExternalWithTracking
, exactWidth, exactHeight
, exactSize, exactWidth, exactHeight
, disabled
, withBorder
, primary, secondary, danger, dangerSecondary
@ -34,7 +34,7 @@ module Nri.Ui.ClickableSvg.V2 exposing
## Sizing
@docs exactWidth, exactHeight
@docs exactSize, exactWidth, exactHeight
## State
@ -189,6 +189,26 @@ large =
set (\attributes -> { attributes | size = Large })
{-| Set the size in `px` for the element's width and height.
Equivalent to:
[ exactWidth inPx
, exactHeight inPx
]
-}
exactSize : Int -> Attribute msg
exactSize inPx =
set
(\attributes ->
{ attributes
| width = Just (toFloat inPx)
, height = Just (toFloat inPx)
}
)
{-| Define a size in `px` for the element's total width.
-}
exactWidth : Int -> Attribute msg

View File

@ -269,8 +269,6 @@ initSettings =
(ControlExtra.list
|> ControlExtra.listItem "disabled"
(Control.map ClickableSvg.disabled (Control.bool False))
|> ControlExtra.optionalListItem "exactWidth"
(Control.map ClickableSvg.exactWidth (ControlExtra.int 40))
|> ControlExtra.optionalListItem "exactHeight"
(Control.map ClickableSvg.exactHeight (ControlExtra.int 20))
|> ControlExtra.optionalListItem "exactSize"
(Control.map ClickableSvg.exactSize (ControlExtra.int 36))
)