Something went wrong. Try again.
A music player that connects to your cloud/distributed storage. forked from tokono.ma/diffuse
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455module ContextMenu exposing (ContextMenu(..), Item(..), ItemProperties, anyItem, coordinates, justAnItem)
import Coordinates exposing (Coordinates)import Material.Icons.Types exposing (Coloring)import Svg exposing (Svg)
-- 🌳
type ContextMenu msg = ContextMenu (List (Item msg)) Coordinates
type Item msg = Item (ItemProperties msg) | Divider
type alias ItemProperties msg = { icon : Int -> Coloring -> Svg msg , label : String , msg : msg , active : Bool }
-- 🔱
anyItem : (ItemProperties msg -> Bool) -> ContextMenu msg -> BoolanyItem fn (ContextMenu items _) = List.any (\item -> case item of Item props -> fn props
Divider -> False ) items
coordinates : ContextMenu msg -> Coordinatescoordinates (ContextMenu _ c) = c
justAnItem : ItemProperties msg -> Maybe (Item msg)justAnItem = Just << Item