Made widget types match functions (#1)

This commit is contained in:
Lucas Payr 2020-08-11 08:02:38 +02:00
parent bce6ede71d
commit ab4114f682

View File

@ -2,12 +2,13 @@ module Widget exposing
( Button, TextButton, iconButton, textButton, button
, Select, selectButton, select
, MultiSelect, multiSelect
, Dialog, modal, dialog
, ExpansionPanel, expansionPanel
, DialogV2, modal, dialog
, ExpansionPanelV2, expansionPanel
, row, column, buttonRow, buttonColumn
, SortTable, Column, sortTable, floatColumn, intColumn, stringColumn, unsortableColumn
, TextInput, textInput
, Tab, tab
, Dialog, ExpansionPanel
)
{-| This module contains different stateless view functions. No wiring required.
@ -65,7 +66,7 @@ You can create you own widgets by sticking widgets types together.
[Open in Ellie](https://ellie-app.com/9p5Rdz625TZa1)
@docs Dialog, modal, dialog
@docs DialogV2, modal, dialog
# Expansion Panel
@ -74,7 +75,7 @@ You can create you own widgets by sticking widgets types together.
[Open in Ellie](https://ellie-app.com/9p5Rv5jfVdFa1)
@docs ExpansionPanel, expansionPanel
@docs ExpansionPanelV2, expansionPanel
# List
@ -112,6 +113,11 @@ You can create you own widgets by sticking widgets types together.
@docs Tab, tab
# DEPRECATED
@docs Dialog, ExpansionPanel
-}
import Element exposing (Attribute, Element, Length)
@ -162,7 +168,12 @@ iconButton :
}
-> Element msg
iconButton =
Button.iconButton
let
fun : ButtonStyle msg -> Button msg -> Element msg
fun =
Button.iconButton
in
fun
{-| A button with just text and not icon.
@ -176,7 +187,12 @@ textButton :
}
-> Element msg
textButton style { text, onPress } =
Button.textButton style
let
fun : ButtonStyle msg -> TextButton msg -> Element msg
fun =
Button.textButton
in
fun style
{ text = text
, onPress = onPress
}
@ -193,7 +209,12 @@ button :
}
-> Element msg
button =
Button.button
let
fun : ButtonStyle msg -> Button msg -> Element msg
fun =
Button.button
in
fun
@ -272,7 +293,10 @@ multiSelect =
----------------------------------------------------------}
{-| Dialog widget type
{-| DEPRECATED
Use `DialogV2` instead
-}
type alias Dialog msg =
{ title : Maybe String
@ -282,6 +306,16 @@ type alias Dialog msg =
}
{-| Dialog widget type
-}
type alias DialogV2 msg =
{ title : Maybe String
, text : String
, accept : Maybe (TextButton msg)
, dismiss : Maybe (TextButton msg)
}
{-| A modal.
Technical Remark:
@ -306,7 +340,12 @@ dialog :
}
-> List (Attribute msg)
dialog =
Dialog.dialog
let
fun : DialogStyle msg -> DialogV2 msg -> List (Attribute msg)
fun =
Dialog.dialog
in
fun
@ -315,7 +354,10 @@ dialog =
----------------------------------------------------------}
{-| Expansion Panel widget type
{-| DEPRECATED
Use `ExpansionPanelV2` instead
-}
type alias ExpansionPanel msg =
{ onToggle : Bool -> msg
@ -328,6 +370,17 @@ type alias ExpansionPanel msg =
}
{-| Expansion Panel widget type
-}
type alias ExpansionPanelV2 msg =
{ onToggle : Bool -> msg
, icon : Element Never
, text : String
, content : Element msg
, isExpanded : Bool
}
{-| An expansion Panel
-}
expansionPanel :
@ -341,7 +394,12 @@ expansionPanel :
}
-> Element msg
expansionPanel =
ExpansionPanel.expansionPanel
let
fun : ExpansionPanelStyle msg -> ExpansionPanelV2 msg -> Element msg
fun =
ExpansionPanel.expansionPanel
in
fun
@ -374,7 +432,12 @@ textInput :
}
-> Element msg
textInput =
TextInput.textInput
let
fun : TextInputStyle msg -> TextInput msg -> Element msg
fun =
TextInput.textInput
in
fun
@ -515,7 +578,12 @@ sortTable :
}
-> Element msg
sortTable =
SortTable.sortTable
let
fun : SortTableStyle msg -> SortTable a msg -> Element msg
fun =
SortTable.sortTable
in
fun
@ -542,4 +610,9 @@ tab :
}
-> Element msg
tab =
Tab.tab
let
fun : TabStyle msg -> Tab msg -> Element msg
fun =
Tab.tab
in
fun