hide label on inline. No one is asking for this and it looks awful

This commit is contained in:
Alex Perkins 2021-11-21 12:23:24 -05:00
parent 3bfb389c9b
commit f5865855f3
2 changed files with 57 additions and 17 deletions

View File

@ -331,7 +331,7 @@ type alias InternalConfig value msg =
, isLocked : Bool , isLocked : Bool
, showPennant : Bool , showPennant : Bool
, id : String , id : String
, disclosureIdAndElement : Maybe ( String, Html msg ) , disclosureIdAndElement : Maybe ( String, List (Html msg) )
} }
@ -394,7 +394,7 @@ internalConfig label config eventsAndValues =
Nothing Nothing
( (_ :: _) as childNodes, True ) -> ( (_ :: _) as childNodes, True ) ->
Just <| ( disclosureId, div [ id disclosureId ] childNodes ) Just <| ( disclosureId, childNodes )
} }
_ -> _ ->
@ -517,9 +517,18 @@ viewBlock config =
config.premiumMsg config.premiumMsg
] ]
] ]
, viewJust , case config.disclosureIdAndElement of
Tuple.second Just ( id_, childNodes ) ->
config.disclosureIdAndElement div
[ id id_
, css
[ display inlineBlock
]
]
childNodes
Nothing ->
text ""
] ]
@ -622,9 +631,25 @@ viewInline config =
else else
[ css [ verticalAlign middle ] ] [ css [ verticalAlign middle ] ]
) )
[ Html.text config.label [ Html.span
, viewJust [ css <|
(\premiumMsg -> if config.hideLabel then
[ Css.height <| px 1
, Css.width <| px 1
, overflow Css.hidden
, margin <| px -1
, padding <| px 0
, border <| px 0
, display inlineBlock
, textIndent <| px 1
]
else
[]
]
[ Html.text config.label ]
, case ( config.hideLabel, config.premiumMsg ) of
( False, Just premiumMsg ) ->
ClickableSvg.button "Premium" ClickableSvg.button "Premium"
Pennant.premiumFlag Pennant.premiumFlag
[ ClickableSvg.onClick premiumMsg [ ClickableSvg.onClick premiumMsg
@ -632,13 +657,17 @@ viewInline config =
, ClickableSvg.exactHeight 24 , ClickableSvg.exactHeight 24
, ClickableSvg.css [ marginLeft (px 8) ] , ClickableSvg.css [ marginLeft (px 8) ]
] ]
)
config.premiumMsg _ ->
text ""
] ]
] ]
, viewJust , case config.disclosureIdAndElement of
Tuple.second Just ( id_, childNodes ) ->
config.disclosureIdAndElement span [ id id_ ] childNodes
Nothing ->
text ""
] ]

View File

@ -116,7 +116,7 @@ viewVanilla state =
, RadioButton.disclosure , RadioButton.disclosure
[ span [ span
[ Attributes.id "cats-description" ] [ Attributes.id "cats-description" ]
[ Text.mediumBody [ Text.plaintext "Cats kind of do their own thing" ] ] [ Text.smallBody [ Text.plaintext "Cats kind of do their own thing" ] ]
] ]
, RadioButton.block , RadioButton.block
] ]
@ -151,16 +151,27 @@ viewVanilla state =
, RadioButton.view , RadioButton.view
(selectionToString Robots) (selectionToString Robots)
[ RadioButton.premium [ RadioButton.premium
{ teacherPremiumLevel = PremiumLevel.Premium { teacherPremiumLevel = PremiumLevel.PremiumWithWriting
, contentPremiumLevel = PremiumLevel.PremiumWithWriting , contentPremiumLevel = PremiumLevel.Premium
} }
, RadioButton.value Robots , RadioButton.value Robots
, RadioButton.name "pets" , RadioButton.name "pets"
, RadioButton.selectedValue state.selectedValue , RadioButton.selectedValue state.selectedValue
, RadioButton.onSelect Select , RadioButton.onSelect Select
, RadioButton.valueToString selectionToString , RadioButton.valueToString selectionToString
, RadioButton.showPennant <| OpenModal "pets-robots"
, RadioButton.inline , RadioButton.inline
, RadioButton.showPennant <| OpenModal "pets-robots"
, if state.selectedValue == Just Robots then
RadioButton.hiddenLabel
else
RadioButton.none
, RadioButton.disclosure
[ Text.smallBody
[ Text.plaintext "With apologies to Karel Čapek"
, Text.css [ Css.display Css.inlineBlock ]
]
]
] ]
, p , p
[ Attributes.id "dogs-description" ] [ Attributes.id "dogs-description" ]