moved icons into Material.Icon

This commit is contained in:
Lucas Payr 2021-01-25 07:54:23 +01:00
parent 686f89fafe
commit 6c1bada865
9 changed files with 37 additions and 83 deletions

View File

@ -4,7 +4,6 @@ import Data.Style exposing (Style)
import Element exposing (Element)
import Example.Button as Button
import Example.Dialog as Dialog
import Example.ExpansionPanel as ExpansionPanel
import Example.Icon as Icon
import Example.List as List
import Example.Modal as Modal
@ -343,7 +342,6 @@ init =
, Cmd.map Switch switchMsg
, Cmd.map Select selectMsg
, Cmd.map MultiSelect multiSelectMsg
, Cmd.map ExpansionPanel expansionPanelMsg
, Cmd.map Tab tabMsg
, Cmd.map SortTable sortTableMsg
, Cmd.map Modal modalMsg

View File

@ -24,7 +24,6 @@ import Widget
, ColumnStyle
, DialogStyle
, DividerStyle
, ExpansionPanelStyle
, ItemStyle
, ProgressIndicatorStyle
, RowStyle

View File

@ -3,7 +3,7 @@ module Example.List exposing (Model, Msg, init, subscriptions, update, view)
import Browser
import Element exposing (Element)
import Widget
import Widget exposing (ColumnStyle, DividerStyle,ExpansionItemStyle, ItemStyle, HeaderStyle,TextItemStyle,ExpansionPanelStyle)
import Widget exposing (ColumnStyle, DividerStyle,ExpansionItemStyle, ItemStyle, HeaderStyle,TextItemStyle)
import Widget.Style.Material as Material
import FeatherIcons
import Widget.Icon as Icon
@ -19,7 +19,6 @@ type alias Style style msg =
, insetHeader : ItemStyle (HeaderStyle msg)
, fullBleedHeader : ItemStyle (HeaderStyle msg)
, textItem : ItemStyle (TextItemStyle msg)
, expansionPanelItem : ItemStyle (ExpansionPanelStyle msg)
, expansionItem : ExpansionItemStyle msg
}
@ -33,7 +32,6 @@ materialStyle =
, insetHeader = Material.insetHeader Material.defaultPalette
, fullBleedHeader = Material.fullBleedHeader Material.defaultPalette
, textItem = Material.textItem Material.defaultPalette
, expansionPanelItem = Material.expansionPanelItem Material.defaultPalette
, expansionItem = Material.expansionItem Material.defaultPalette
}

View File

@ -15,25 +15,7 @@ type alias Style style msg =
materialStyle : Style {} msg
materialStyle =
{ sortTable =
{ elementTable = []
, content =
{ header = Material.textButton Material.defaultPalette
, ascIcon =
Material.expansionPanel Material.defaultPalette
|> .content
|> .panel
|> .content
|> .collapseIcon
, descIcon =
Material.expansionPanel Material.defaultPalette
|> .content
|> .panel
|> .content
|> .expandIcon
, defaultIcon = always Element.none
}
}
{ sortTable = Material.sortTable Material.defaultPalette
}

View File

@ -1,4 +1,4 @@
module View.Test exposing (button, dialog, expansionPanel, icon, list, modal, multiSelect, progressIndicator, select, sortTable, switch, tab, textInput)
module View.Test exposing (button, dialog, icon, list, modal, multiSelect, progressIndicator, select, sortTable, switch, tab, textInput)
import Data.Style exposing (Style)
import Element exposing (Element)
@ -276,28 +276,6 @@ multiSelect idle style =
]
expansionPanel : msg -> Style msg -> List ( String, Element msg )
expansionPanel idle style =
[ ( "Collapsed"
, { onToggle = always idle
, isExpanded = False
, icon = FeatherIcons.triangle |> Icon.elmFeather FeatherIcons.toHtml
, text = "Button"
, content = Element.text <| "Hidden Message"
}
|> Widget.expansionPanel style.expansionPanel
)
, ( "Expanded"
, { onToggle = always idle
, isExpanded = True
, icon = FeatherIcons.triangle |> Icon.elmFeather FeatherIcons.toHtml
, text = "Button"
, content = Element.text <| "Hidden Message"
}
|> Widget.expansionPanel style.expansionPanel
)
]
tab : msg -> Style msg -> List ( String, Element msg )
tab idle style =

View File

@ -1,9 +1,10 @@
module Internal.Material.Icon exposing (icon)
module Internal.Material.Icon exposing (icon,expand_less,expand_more)
import Element exposing (Element)
import Svg exposing (Svg)
import Svg.Attributes
import Color exposing (Color)
import Widget.Icon exposing (Icon)
icon : {viewBox:String,size:Int,color:Color} -> List (Svg Never) -> Element Never
icon {viewBox,size,color} =
@ -20,3 +21,30 @@ icon {viewBox,size,color} =
]
>> Element.html
>> Element.el []
expand_less : Icon
expand_less { size, color } =
icon {viewBox = "0 0 48 48"
, size = size
, color = color
}
[ Svg.path
[ Svg.Attributes.d "M24 16L12 28l2.83 2.83L24 21.66l9.17 9.17L36 28z"
]
[]
]
expand_more : Icon
expand_more { size, color } =
icon {viewBox = "0 0 48 48"
, size = size
, color = color
}
[ Svg.path
[ Svg.Attributes.d "M33.17 17.17L24 26.34l-9.17-9.17L12 20l12 12 12-12z"
]
[]
]

View File

@ -23,7 +23,6 @@ import Widget.Icon exposing (Icon)
import Widget.Style.Material.Color as MaterialColor
import Widget.Style.Material.Typography as Typography
fullBleedDivider : Palette -> ItemStyle (DividerStyle msg)
fullBleedDivider _ =
{ element =
@ -239,37 +238,12 @@ textItem _ =
}
expand_less : Icon
expand_less { size, color } =
Icon.icon {viewBox = "0 0 48 48"
, size = size
, color = color
}
[ Svg.path
[ Svg.Attributes.d "M24 16L12 28l2.83 2.83L24 21.66l9.17 9.17L36 28z"
]
[]
]
expand_more : Icon
expand_more { size, color } =
Icon.icon {viewBox = "0 0 48 48"
, size = size
, color = color
}
[ Svg.path
[ Svg.Attributes.d "M33.17 17.17L24 26.34l-9.17-9.17L12 20l12 12 12-12z"
]
[]
]
expansionItem : Palette -> ExpansionItemStyle msg
expansionItem palette =
{ item = textItem palette
, expandIcon = expand_more
, collapseIcon = expand_less
, expandIcon = Icon.expand_more
, collapseIcon = Icon.expand_less
}

View File

@ -2,18 +2,17 @@ module Internal.Material.SortTable exposing (sortTable)
import Element
import Internal.Material.Button as Button
import Internal.Material.ExpansionPanel as ExpansionPanel
import Internal.Material.Palette exposing (Palette)
import Internal.SortTable exposing (SortTableStyle)
import Internal.Material.Icon as Icon
sortTable : Palette -> SortTableStyle msg
sortTable palette =
{ elementTable = []
, content =
{ header = Button.textButton palette
, ascIcon = ExpansionPanel.expand_less
, descIcon = ExpansionPanel.expand_more
, ascIcon = Icon.expand_less
, descIcon = Icon.expand_more
, defaultIcon = always Element.none
}
}

View File

@ -123,13 +123,11 @@ Note that you might want to checkout the [file on GitHub](https://github.com/Ora
import Color exposing (Color)
import Internal.Button exposing (ButtonStyle)
import Internal.Dialog exposing (DialogStyle)
import Internal.ExpansionPanel exposing (ExpansionPanelStyle)
import Internal.Item exposing (DividerStyle, ExpansionItemStyle, HeaderStyle, ItemStyle, TextItemStyle)
import Internal.List exposing (ColumnStyle, RowStyle)
import Internal.Material.Button as Button
import Internal.Material.Chip as Chip
import Internal.Material.Dialog as Dialog
import Internal.Material.ExpansionPanel as ExpansionPanel
import Internal.Material.Item as Item
import Internal.Material.Layout as Layout
import Internal.Material.List as List