mirror of
https://github.com/Orasund/elm-ui-widgets.git
synced 2024-11-22 04:58:49 +03:00
removed unused code
This commit is contained in:
parent
07eae1e43f
commit
098e985d30
@ -2,9 +2,8 @@ module Page exposing (create, create2, demo, viewTile)
|
||||
|
||||
import Element exposing (Element)
|
||||
import UIExplorer exposing (Page)
|
||||
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||
import UIExplorer.Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||
import UIExplorer.Tile as Tile exposing (Context, Group, Position, Tile, TileMsg)
|
||||
import Widget.Material as Material exposing (Palette)
|
||||
import Widget.Material.Typography as Typography
|
||||
|
||||
|
||||
|
@ -8,10 +8,6 @@ import UIExplorer.Story as Story
|
||||
import UIExplorer.Tile exposing (Context, Tile)
|
||||
import Widget
|
||||
import Widget.Material as Material
|
||||
exposing
|
||||
( darkPalette
|
||||
, defaultPalette
|
||||
)
|
||||
|
||||
|
||||
{-| The title of this page
|
||||
|
@ -4,20 +4,14 @@ module Page.Select exposing (page)
|
||||
-}
|
||||
|
||||
import Element exposing (Element)
|
||||
import Element.Background as Background
|
||||
import Element.Font
|
||||
import Material.Icons as MaterialIcons exposing (offline_bolt)
|
||||
import Material.Icons as MaterialIcons
|
||||
import Material.Icons.Types exposing (Coloring(..))
|
||||
import Page
|
||||
import UIExplorer
|
||||
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||
import UIExplorer.Tile as Tile exposing (Context, Position, Tile, TileMsg)
|
||||
import Widget exposing (ButtonStyle)
|
||||
import Widget.Customize as Customize
|
||||
import Widget.Icon as Icon exposing (Icon)
|
||||
import Widget.Material as Material exposing (Palette)
|
||||
import Widget.Material.Color as MaterialColor
|
||||
import Widget.Material.Typography as Typography
|
||||
import UIExplorer.Tile as Tile exposing (Context, TileMsg)
|
||||
import Widget
|
||||
import Widget.Icon as Icon
|
||||
import Widget.Material as Material
|
||||
|
||||
|
||||
{-| The title of this page
|
||||
@ -51,7 +45,6 @@ viewFunctions =
|
||||
--Don't forget to change the title
|
||||
|> Page.viewTile "Widget.buttonRow "
|
||||
|
||||
|
||||
viewTogggleRow style selected options onSelect { palette } () =
|
||||
Widget.select
|
||||
{ selected = selected
|
||||
@ -64,7 +57,7 @@ viewFunctions =
|
||||
}
|
||||
--Don't forget to change the title
|
||||
|> Page.viewTile "Widget.toggleRow"
|
||||
|
||||
|
||||
viewWrappedRow style selected options onSelect { palette } () =
|
||||
Widget.select
|
||||
{ selected = selected
|
||||
@ -110,7 +103,7 @@ book =
|
||||
[ ( "Outlined", Material.outlinedButton )
|
||||
, ( "Text", Material.textButton )
|
||||
, ( "Chip", Material.chip )
|
||||
, ( "IconButton", Material.iconButton)
|
||||
, ( "IconButton", Material.iconButton )
|
||||
, ( "Toggle", Material.toggleButton )
|
||||
]
|
||||
)
|
||||
|
@ -3,22 +3,15 @@ module Page.Snackbar exposing (page)
|
||||
{-| This is an example Page. If you want to add your own pages, simple copy and modify this one.
|
||||
-}
|
||||
|
||||
import Browser
|
||||
import Element exposing (Element)
|
||||
import Element.Background as Background
|
||||
import Material.Icons as MaterialIcons
|
||||
import Material.Icons.Types exposing (Coloring(..))
|
||||
import Page
|
||||
import Time
|
||||
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||
import UIExplorer.Tile as Tile exposing (Context, Tile, TileMsg)
|
||||
import Widget exposing (ButtonStyle, ColumnStyle)
|
||||
import Widget.Customize as Customize
|
||||
import Widget.Icon as Icon
|
||||
import Widget
|
||||
import Widget.Material as Material
|
||||
import Widget.Material.Color as MaterialColor
|
||||
import Widget.Material.Typography as Typography
|
||||
import Widget.Snackbar as Snackbar exposing (Snackbar, SnackbarStyle)
|
||||
import Widget.Snackbar as Snackbar exposing (Snackbar)
|
||||
|
||||
|
||||
{-| The title of this page
|
||||
|
@ -3,20 +3,13 @@ module Page.SortTable exposing (page)
|
||||
{-| This is an example Page. If you want to add your own pages, simple copy and modify this one.
|
||||
-}
|
||||
|
||||
import Browser
|
||||
import Element exposing (Element)
|
||||
import Element.Background as Background
|
||||
import Material.Icons as MaterialIcons
|
||||
import Material.Icons.Types exposing (Coloring(..))
|
||||
import Page
|
||||
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||
import UIExplorer.Tile as Tile exposing (Context, Tile, TileMsg)
|
||||
import Widget exposing (SortTableStyle)
|
||||
import Widget.Customize as Customize
|
||||
import Widget.Icon as Icon
|
||||
import Widget
|
||||
import Widget.Material as Material
|
||||
import Widget.Material.Color as MaterialColor
|
||||
import Widget.Material.Typography as Typography
|
||||
|
||||
|
||||
{-| The title of this page
|
||||
|
@ -4,23 +4,12 @@ module Page.Switch exposing (page)
|
||||
-}
|
||||
|
||||
import Element exposing (Element)
|
||||
import Element.Background as Background
|
||||
import Material.Icons as MaterialIcons
|
||||
import Material.Icons.Types exposing (Coloring(..))
|
||||
import Page
|
||||
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||
import UIExplorer.Tile as Tile exposing (Context, Tile, TileMsg)
|
||||
import Widget
|
||||
import Widget.Customize as Customize
|
||||
import Widget.Icon as Icon
|
||||
import Widget.Material as Material
|
||||
exposing
|
||||
( containedButton
|
||||
, outlinedButton
|
||||
, textButton
|
||||
)
|
||||
import Widget.Material.Color as MaterialColor
|
||||
import Widget.Material.Typography as Typography
|
||||
|
||||
|
||||
{-| The title of this page
|
||||
|
@ -3,20 +3,15 @@ module Page.Tab exposing (page)
|
||||
{-| This is an example Page. If you want to add your own pages, simple copy and modify this one.
|
||||
-}
|
||||
|
||||
import Browser
|
||||
import Element exposing (Element)
|
||||
import Element.Background as Background
|
||||
import Material.Icons as MaterialIcons
|
||||
import Material.Icons.Types exposing (Coloring(..))
|
||||
import Page
|
||||
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||
import UIExplorer.Tile as Tile exposing (Context, Tile, TileMsg)
|
||||
import Widget exposing (TabStyle)
|
||||
import Widget.Customize as Customize
|
||||
import Widget
|
||||
import Widget.Icon as Icon
|
||||
import Widget.Material as Material
|
||||
import Widget.Material.Color as MaterialColor
|
||||
import Widget.Material.Typography as Typography
|
||||
|
||||
|
||||
{-| The title of this page
|
||||
|
@ -9,12 +9,8 @@ import Set exposing (Set)
|
||||
import UIExplorer.Story as Story
|
||||
import UIExplorer.Tile exposing (Context, Tile)
|
||||
import Widget
|
||||
import Widget.Icon as Icon exposing (Icon)
|
||||
import Widget.Icon as Icon
|
||||
import Widget.Material as Material
|
||||
exposing
|
||||
( darkPalette
|
||||
, defaultPalette
|
||||
)
|
||||
|
||||
|
||||
{-| The title of this page
|
||||
|
@ -36,14 +36,12 @@ import Browser.Events
|
||||
import Browser.Navigation
|
||||
import Element exposing (Element)
|
||||
import Element.Background
|
||||
import Element.Border
|
||||
import Element.Font
|
||||
import Element.Input
|
||||
import Element.Lazy
|
||||
import Element.Region
|
||||
import Html exposing (Html)
|
||||
import Html.Attributes
|
||||
import Html.Events
|
||||
import Json.Decode as Decode
|
||||
import Pixels exposing (Pixels)
|
||||
import Quantity exposing (Quantity)
|
||||
@ -356,7 +354,7 @@ pageSizeOptionWidth pageSizeOption =
|
||||
{-| -}
|
||||
type Model pageModel flags
|
||||
= FlagsParsed (SuccessModel pageModel flags)
|
||||
| FlagsDidNotParse { errorMessage : String }
|
||||
| FlagsDidNotParse String
|
||||
|
||||
|
||||
type alias SuccessModel pageModel flags =
|
||||
@ -469,7 +467,7 @@ init config (PageBuilder pages) flagsJson url key =
|
||||
)
|
||||
|
||||
Err error ->
|
||||
( FlagsDidNotParse { errorMessage = Decode.errorToString error }, Cmd.none )
|
||||
( FlagsDidNotParse (Decode.errorToString error), Cmd.none )
|
||||
|
||||
|
||||
expandPage : List String -> Set String -> Set String
|
||||
@ -636,7 +634,7 @@ view config pages model =
|
||||
FlagsParsed successModel ->
|
||||
viewSuccess config pages successModel
|
||||
|
||||
FlagsDidNotParse { errorMessage } ->
|
||||
FlagsDidNotParse errorMessage ->
|
||||
{ title = "Error"
|
||||
, body =
|
||||
[ Element.layoutWith { options = config.layoutOptions }
|
||||
@ -829,7 +827,7 @@ viewSidebar pages config model =
|
||||
{ text = "Dark Theme"
|
||||
, onPress = Just <| ChangeDarkTheme <| not <| model.darkThemeEnabled
|
||||
, icon =
|
||||
\{} ->
|
||||
\_ ->
|
||||
Widget.switch (Material.switch palette)
|
||||
{ description = "Toggle Theme"
|
||||
, onPress = Just <| ChangeDarkTheme <| not <| model.darkThemeEnabled
|
||||
@ -1078,7 +1076,7 @@ colorBlindOptionView dark isExpanded selectedColorBlindOption =
|
||||
optionGroupView : Bool -> Bool -> a -> List a -> (a -> String) -> (a -> msg) -> msg -> List (Item msg)
|
||||
optionGroupView dark isExpanded selectedItem items itemToString onPress toggleExpand =
|
||||
let
|
||||
selectedColor =
|
||||
_ =
|
||||
if dark then
|
||||
darkerGray
|
||||
|
||||
@ -1251,19 +1249,6 @@ contentSize model =
|
||||
}
|
||||
|
||||
|
||||
minimizeSidebarButton : Element (Msg pageMsg)
|
||||
minimizeSidebarButton =
|
||||
Element.Input.button
|
||||
[ Element.alignRight
|
||||
, Element.paddingXY 20 0
|
||||
, Element.height Element.fill
|
||||
, Element.Font.size 20
|
||||
]
|
||||
{ onPress = Just PressedToggleSidebar
|
||||
, label = Element.text "❮"
|
||||
}
|
||||
|
||||
|
||||
lightBlue : Element.Color
|
||||
lightBlue =
|
||||
Element.rgb255 176 208 225
|
||||
@ -1279,16 +1264,6 @@ gray =
|
||||
Element.rgb255 206 215 225
|
||||
|
||||
|
||||
mediumDarkGray : Element.Color
|
||||
mediumDarkGray =
|
||||
Element.rgb255 90 100 105
|
||||
|
||||
|
||||
darkGray : Element.Color
|
||||
darkGray =
|
||||
Element.rgb255 60 70 80
|
||||
|
||||
|
||||
darkerGray : Element.Color
|
||||
darkerGray =
|
||||
Element.rgb255 20 30 40
|
||||
@ -1298,57 +1273,11 @@ black =
|
||||
Element.rgb 0 0 0
|
||||
|
||||
|
||||
mix : Float -> Element.Color -> Element.Color -> Element.Color
|
||||
mix mixRatio color0 color1 =
|
||||
let
|
||||
a =
|
||||
Element.toRgb color0
|
||||
|
||||
b =
|
||||
Element.toRgb color1
|
||||
|
||||
mix_ getter =
|
||||
getter a * mixRatio + getter b * (1 - mixRatio)
|
||||
in
|
||||
Element.rgb (mix_ .red) (mix_ .green) (mix_ .blue)
|
||||
|
||||
|
||||
type ArrowKey
|
||||
= ArrowUp
|
||||
| ArrowDown
|
||||
|
||||
|
||||
onKey : (ArrowKey -> msg) -> Element.Attribute msg
|
||||
onKey msg =
|
||||
Element.htmlAttribute
|
||||
(Html.Events.custom "keyup"
|
||||
(Decode.field "key" Decode.string
|
||||
|> Decode.andThen
|
||||
(\key ->
|
||||
case key of
|
||||
"ArrowUp" ->
|
||||
Decode.succeed { message = msg ArrowUp, stopPropagation = True, preventDefault = True }
|
||||
|
||||
"ArrowDown" ->
|
||||
Decode.succeed { message = msg ArrowDown, stopPropagation = True, preventDefault = True }
|
||||
|
||||
_ ->
|
||||
Decode.fail "Not the up or down arrow key."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
pageGroupToString : List String -> String
|
||||
pageGroupToString =
|
||||
uiUrl []
|
||||
|
||||
|
||||
isGroupExpanded : Set String -> List String -> Bool
|
||||
isGroupExpanded expandedGroups pageGroup =
|
||||
Set.member (pageGroupToString pageGroup) expandedGroups
|
||||
|
||||
|
||||
type Either
|
||||
= TempLeaf String
|
||||
| Group { pageId : String, pageGroupHead : String, pageGroup : List String }
|
||||
@ -1402,21 +1331,6 @@ buildTree items =
|
||||
helper items
|
||||
|
||||
|
||||
mouseOverButtonColor buttonDepth =
|
||||
mix (0.92 ^ toFloat buttonDepth) gray black
|
||||
|
||||
|
||||
pageSelectedButtonColor dark buttonDepth =
|
||||
mix (0.92 ^ toFloat buttonDepth)
|
||||
(if dark then
|
||||
mediumDarkGray
|
||||
|
||||
else
|
||||
lightBlue
|
||||
)
|
||||
black
|
||||
|
||||
|
||||
viewSidebarLinksHelper :
|
||||
Bool
|
||||
-> { a | relativeUrlPath : List String }
|
||||
@ -1447,23 +1361,6 @@ viewSidebarLinksHelper dark config page expandedGroups path trees =
|
||||
)
|
||||
|
||||
|
||||
expanderArrow : Bool -> Element msg
|
||||
expanderArrow isExpanded =
|
||||
(if isExpanded then
|
||||
"▾"
|
||||
|
||||
else
|
||||
"▸"
|
||||
)
|
||||
|> Element.text
|
||||
|> Element.el
|
||||
[ Element.width <| Element.px 10
|
||||
, Element.Font.size 12
|
||||
, Element.moveUp 1
|
||||
, Element.moveLeft 1
|
||||
]
|
||||
|
||||
|
||||
{-| Group equal elements together using a custom equality function. Elements will be
|
||||
grouped in the same order as they appear in the original list. The same applies to
|
||||
elements within each group.
|
||||
@ -1493,66 +1390,6 @@ gatherWith testFn list =
|
||||
helper list []
|
||||
|
||||
|
||||
pageButton :
|
||||
Bool
|
||||
-> { a | relativeUrlPath : List String }
|
||||
-> List String
|
||||
-> { b | previous : Maybe (List String), next : Maybe (List String), current : List String }
|
||||
-> Element (Msg pageMsg)
|
||||
pageButton dark config selectedPage pageIds =
|
||||
let
|
||||
depth =
|
||||
List.length pageIds.current - 1
|
||||
in
|
||||
Element.el
|
||||
[ Element.width Element.fill ]
|
||||
(Element.link
|
||||
[ Element.paddingEach { left = 16, right = 8, top = 8, bottom = 8 }
|
||||
, Element.width Element.fill
|
||||
, onKey
|
||||
(\arrowKey ->
|
||||
case ( arrowKey, pageIds.previous, pageIds.next ) of
|
||||
( ArrowUp, Just previous, _ ) ->
|
||||
PressedChangePageHotkey previous
|
||||
|
||||
( ArrowDown, _, Just next ) ->
|
||||
PressedChangePageHotkey next
|
||||
|
||||
_ ->
|
||||
NoOp
|
||||
)
|
||||
, Element.htmlAttribute <| Html.Attributes.id <| pageGroupToString pageIds.current
|
||||
, if pageIds.current == selectedPage then
|
||||
Element.Background.color (pageSelectedButtonColor dark depth)
|
||||
|
||||
else
|
||||
Element.mouseOver [ mouseOverButtonColor depth |> Element.Background.color ]
|
||||
, focusAttributes dark
|
||||
]
|
||||
{ url = uiUrl config.relativeUrlPath pageIds.current
|
||||
, label =
|
||||
pageIds.current
|
||||
|> List.reverse
|
||||
|> List.head
|
||||
|> Maybe.withDefault ""
|
||||
|> Element.text
|
||||
|> List.singleton
|
||||
|> Element.paragraph []
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
focusAttributes dark =
|
||||
Element.focused
|
||||
[ Element.Background.color <|
|
||||
if dark then
|
||||
mediumDarkGray
|
||||
|
||||
else
|
||||
lightBlue
|
||||
]
|
||||
|
||||
|
||||
viewSidebarLinks :
|
||||
Bool
|
||||
-> PageBuilder pageModel pageMsg flags
|
||||
|
@ -1,8 +1,7 @@
|
||||
module UIExplorer.Story exposing (..)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Element exposing (Attribute, Element)
|
||||
import Element.Input as Input exposing (Label, Option, labelAbove, option, radio)
|
||||
import Element exposing (Element)
|
||||
import Element.Input as Input
|
||||
import SelectList exposing (SelectList)
|
||||
import UIExplorer.Tile as Tile exposing (Context)
|
||||
import Widget
|
||||
@ -262,7 +261,7 @@ storySetValue value model =
|
||||
| value = enforceRange state.min state.max intValue
|
||||
}
|
||||
|
||||
TextStoryModel storyLabel oldValue ->
|
||||
TextStoryModel storyLabel _ ->
|
||||
TextStoryModel storyLabel value
|
||||
|
||||
OptionListStoryModel storyLabel select ->
|
||||
@ -369,7 +368,7 @@ storyView context model =
|
||||
options
|
||||
|> SelectList.toList
|
||||
|> List.indexedMap (\i opt -> ( i, opt ))
|
||||
|> List.filter (\( i, opt ) -> selected == i)
|
||||
|> List.filter (\( i, _ ) -> selected == i)
|
||||
|> List.head
|
||||
|> Maybe.map (Tuple.second >> StorySelect label)
|
||||
}
|
||||
@ -399,7 +398,7 @@ storyView context model =
|
||||
|
||||
|
||||
storyTile : Maybe String -> List StoryInfo -> (List String -> a) -> Tile.Group StorySelectorModel StorySelectorMsg flags
|
||||
storyTile title stories storiesToValue =
|
||||
storyTile title stories _ =
|
||||
{ init =
|
||||
\_ ->
|
||||
( stories
|
||||
@ -435,7 +434,7 @@ build builder =
|
||||
|> Tile.linkGroup
|
||||
{ init = builder.tilelist.init
|
||||
, update =
|
||||
\msg ( selectorModel, model ) ->
|
||||
\msg ( _, model ) ->
|
||||
builder.tilelist.update msg model
|
||||
, subscriptions = Tuple.second >> builder.tilelist.subscriptions
|
||||
, views =
|
||||
|
@ -1,17 +1,13 @@
|
||||
module UIExplorer.Tile exposing (..)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Element exposing (Attribute, Element)
|
||||
import Element.Background as Background
|
||||
import Element.Font as Font
|
||||
import Markdown
|
||||
import SelectList exposing (SelectList)
|
||||
import UIExplorer exposing (Page, PageSize)
|
||||
import Widget exposing (Item)
|
||||
import Widget.Customize as Customize
|
||||
import Widget
|
||||
import Widget.Material as Material exposing (Palette)
|
||||
import Widget.Material.Color as MaterialColor
|
||||
import Widget.Material.Typography as Typography
|
||||
|
||||
|
||||
type Position
|
||||
|
Loading…
Reference in New Issue
Block a user