module UI exposing ( Element , text , column , row , button , image ) {-| Cross-platform UI primitives. The `platform` type parameter stays polymorphic for elements that work everywhere. Platform-specific elements live in the `Mobile` and `Desktop` modules and constrain the parameter. -} import UI.Attribute exposing (Attribute) type Element platform msg = Text { attributes : Array (Attribute platform msg) , content : String } | Column { attributes : Array (Attribute platform msg) , children : Array (Element platform msg) } | Row { attributes : Array (Attribute platform msg) , children : Array (Element platform msg) } | Button { attributes : Array (Attribute platform msg) , onPress : msg , label : Element platform msg } | Image { attributes : Array (Attribute platform msg) , source : String } text : Array (Attribute platform msg) -> String -> Element platform msg text attributes content = Text { attributes = attributes, content = content } column : Array (Attribute platform msg) -> Array (Element platform msg) -> Element platform msg column attributes children = Column { attributes = attributes, children = children } row : Array (Attribute platform msg) -> Array (Element platform msg) -> Element platform msg row attributes children = Row { attributes = attributes, children = children } button : Array (Attribute platform msg) -> { onPress : msg, label : Element platform msg } -> Element platform msg button attributes config = Button { attributes = attributes , onPress = config.onPress , label = config.label } image : Array (Attribute platform msg) -> String -> Element platform msg image attributes source = Image { attributes = attributes, source = source }