Adds fullheight to controls

since the container doesn't have a min height, the Container doesn't stretch in the example
This commit is contained in:
Tessa Kelly 2021-10-21 17:23:59 -07:00
parent 6dec2ee268
commit d096fa6b3a
2 changed files with 21 additions and 4 deletions

View File

@ -11,8 +11,18 @@ module Nri.Ui.Container.V2 exposing
- adds optional default spacing?
- document changes from V1 (e.g., how to upgrade from V1)
Common NoRedInk Containers
# Common NoRedInk Containers
# Changelog
## Changes from V1
- fullHeight accepts a bool value
# Documentation
## View
@ -70,9 +80,9 @@ paddingPx padding =
{-| Makes the container occupy the full height of the parent.
-}
fullHeight : Attribute msg
fullHeight =
Attribute <| \config -> { config | fullHeight = True }
fullHeight : Bool -> Attribute msg
fullHeight fullHeight_ =
Attribute <| \config -> { config | fullHeight = fullHeight_ }
{-| Use this helper to add custom attributes.

View File

@ -82,6 +82,7 @@ init =
{ control =
ControlExtra.list
|> ControlExtra.optionalListItem "paddingPx" controlMaybePaddingPx
|> ControlExtra.optionalListItem "fullHeight" controlMaybeFullHeight
|> ControlExtra.listItem "content" controlContent
}
@ -92,6 +93,12 @@ controlMaybePaddingPx =
Control.map Container.paddingPx (ControlExtra.float 20)
controlMaybeFullHeight : Control (Maybe (Container.Attribute msg))
controlMaybeFullHeight =
Control.maybe False <|
Control.map Container.fullHeight (Control.bool False)
controlContent : Control (Container.Attribute msg)
controlContent =
Control.choice