Skip to content

Commit

Permalink
Add chevron icons for togglable titles
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuanianji committed Oct 11, 2023
1 parent 4dc9fda commit b431b76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
14 changes: 9 additions & 5 deletions src/Lib/Views.elm
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,24 @@ unselectable =

togglableTitle : List (Attribute msg) -> { label : String, activeWhen : Bool, onClick : msg } -> Element msg
togglableTitle attrs { label, activeWhen, onClick } =
Element.el
([ Font.size 32
, Font.color <|
let
( fontColor, icon ) =
if activeWhen then
Colours.grey
( Colours.grey, FeatherIcons.chevronDown )

else
Colours.greyAlpha 0.5
( Colours.greyAlpha 0.5, FeatherIcons.chevronRight )
in
Element.el
([ Font.size 32
, Font.color fontColor
, Font.bold
, Events.onClick onClick
, unselectable
, Element.pointer
, Element.mouseOver
[ Font.color <| Colours.lightGrey ]
, Element.onLeft (Util.viewIcon [ Element.scale 1.25, Font.bold, Element.centerY, Element.paddingXY 8 0 ] icon)
]
++ attrs
)
Expand Down
13 changes: 7 additions & 6 deletions src/Views/VM.elm
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,13 @@ view : Model -> Element Msg
view model =
let
title =
Lib.Views.togglableTitle
[ Element.paddingEach { eachZero | bottom = 16 } ]
{ label = "Execute Program on VM"
, activeWhen = True
, onClick = NoOp
}
Element.el
[ Font.size 32
, Font.color Colours.grey
, Font.bold
, Element.paddingEach { eachZero | bottom = 16 }
]
(Element.text "Execute Program on VM")

totalSize =
Element.paragraph
Expand Down

0 comments on commit b431b76

Please sign in to comment.