11module Main.View.Page.Recipe exposing (..)
22
3- import Html exposing (Html , a , code , div , h5 , span , text )
4- import Html.Attributes exposing (attribute , class , href , id , style , title )
3+ import Html exposing (Html , a , button , code , div , h5 , span , text )
4+ import Html.Attributes exposing (attribute , class , disabled , href , id , style , title )
55import Main.Config exposing (..)
66import Main.Config.App exposing (..)
77import Main.Helpers.AppUrl exposing (..)
@@ -18,50 +18,13 @@ import Main.View.Page.App exposing (..)
1818
1919viewPageRecipeOptions : Model -> PageRecipeOptions -> Html Update
2020viewPageRecipeOptions model pageRecipeOptions =
21- let
22- routeRecipeOptions =
23- pageRecipeOptions. pageRecipeOptions_route
24-
25- routePagePrev =
26- Route_RecipeOptions
27- { routeRecipeOptions
28- | routeRecipeOptions_page = Just ( pageRecipeOptions. pageRecipeOptions_page - 1 )
29- }
30-
31- routePageNext =
32- Route_RecipeOptions
33- { routeRecipeOptions
34- | routeRecipeOptions_page = Just ( pageRecipeOptions. pageRecipeOptions_page + 1 )
35- }
36- in
3721 div []
38- [ div [ class " list-group" ]
22+ [ viewPageRecipePageNavigators pageRecipeOptions
23+ , div [ class " list-group" ]
3924 ( model. model_RecipeOptions. modelRecipeOptions_filtered
4025 |> List . map ( viewPageRecipeOption model pageRecipeOptions)
4126 )
42- , div [ class " d-flex justify-content-center align-items-center" ]
43- [ if 1 < pageRecipeOptions. pageRecipeOptions_page then
44- Html . button
45- [ class " btn"
46- , onClick ( Update_Route routePagePrev)
47- ]
48- [ text " Prev" ]
49-
50- else
51- text " "
52- , text ( pageRecipeOptions. pageRecipeOptions_page |> String . fromInt)
53- , text " / "
54- , text ( pageRecipeOptions. pageRecipeOptions_LastPage |> String . fromInt)
55- , if pageRecipeOptions. pageRecipeOptions_page < pageRecipeOptions. pageRecipeOptions_LastPage then
56- Html . button
57- [ class " btn"
58- , onClick ( Update_Route routePageNext)
59- ]
60- [ text " Next" ]
61-
62- else
63- text " "
64- ]
27+ , viewPageRecipePageNavigators pageRecipeOptions
6528 ]
6629
6730
@@ -122,3 +85,62 @@ viewRecipeOptionsLink =
12285 , onClick ( Update_Route onClickRoute)
12386 ]
12487 [ text " Options" ]
88+
89+
90+ viewPageRecipePageNavigators : PageRecipeOptions -> Html Update
91+ viewPageRecipePageNavigators pageRecipeOptions =
92+ let
93+ routeRecipeOptions =
94+ pageRecipeOptions. pageRecipeOptions_route
95+
96+ routePagePrev =
97+ Route_RecipeOptions
98+ { routeRecipeOptions
99+ | routeRecipeOptions_page = Just ( pageRecipeOptions. pageRecipeOptions_page - 1 )
100+ }
101+
102+ routePageNext =
103+ Route_RecipeOptions
104+ { routeRecipeOptions
105+ | routeRecipeOptions_page = Just ( pageRecipeOptions. pageRecipeOptions_page + 1 )
106+ }
107+ in
108+ div [ class " d-flex justify-content-center align-items-center my-2" ]
109+ [ if 1 < pageRecipeOptions. pageRecipeOptions_page then
110+ button
111+ [ class " btn me-2 focus-ring"
112+ , onClick ( Update_Route routePagePrev)
113+ ]
114+ [ text " Prev" ]
115+
116+ else
117+ button
118+ [ class " btn me-2 border-0"
119+ , disabled True
120+ ]
121+ [ text " Prev" ]
122+ , span
123+ [ style " width" " 2rem"
124+ , style " text-align" " center"
125+ ]
126+ [ text ( pageRecipeOptions. pageRecipeOptions_page |> String . fromInt) ]
127+ , text " /"
128+ , span
129+ [ style " width" " 2rem"
130+ , style " text-align" " center"
131+ ]
132+ [ text ( pageRecipeOptions. pageRecipeOptions_LastPage |> String . fromInt) ]
133+ , if pageRecipeOptions. pageRecipeOptions_page < pageRecipeOptions. pageRecipeOptions_LastPage then
134+ button
135+ [ class " btn ms-2 focus-ring"
136+ , onClick ( Update_Route routePageNext)
137+ ]
138+ [ text " Next" ]
139+
140+ else
141+ button
142+ [ class " btn ms-2 border-0"
143+ , disabled True
144+ ]
145+ [ text " Next" ]
146+ ]
0 commit comments