A music player that connects to your cloud/distributed storage.
at main 980 B view raw
1module ContextMenu exposing (ContextMenu(..), Item(..), ItemProperties, anyItem, coordinates, justAnItem) 2 3import Coordinates exposing (Coordinates) 4import Material.Icons.Types exposing (Coloring) 5import Svg exposing (Svg) 6 7 8 9-- 🌳 10 11 12type ContextMenu msg 13 = ContextMenu (List (Item msg)) Coordinates 14 15 16type Item msg 17 = Item (ItemProperties msg) 18 | Divider 19 20 21type alias ItemProperties msg = 22 { icon : Int -> Coloring -> Svg msg 23 , label : String 24 , msg : msg 25 , active : Bool 26 } 27 28 29 30-- 🔱 31 32 33anyItem : (ItemProperties msg -> Bool) -> ContextMenu msg -> Bool 34anyItem fn (ContextMenu items _) = 35 List.any 36 (\item -> 37 case item of 38 Item props -> 39 fn props 40 41 Divider -> 42 False 43 ) 44 items 45 46 47coordinates : ContextMenu msg -> Coordinates 48coordinates (ContextMenu _ c) = 49 c 50 51 52justAnItem : ItemProperties msg -> Maybe (Item msg) 53justAnItem = 54 Just << Item