github.com/simpleiot/simpleiot@v0.18.3/frontend/src/UI/Layout.elm (about) 1 module UI.Layout exposing (layout) 2 3 import Element exposing (..) 4 import Gen.Route as Route exposing (Route) 5 import UI.Form as Form 6 import UI.Style as Style 7 8 9 layout : 10 { onSignOut : msg 11 , email : Maybe String 12 , error : Maybe String 13 } 14 -> Element msg 15 -> Element msg 16 layout options child = 17 column [ spacing 32, padding 20, width (fill |> maximum 1280), height fill, centerX ] 18 [ row 19 [ width fill, spacing 20 ] 20 [ link ( "SIOT", Route.Home_ ) 21 , el [ alignRight ] <| 22 case options.email of 23 Just email_ -> 24 Form.button 25 { label = "sign out " ++ email_ 26 , color = Style.colors.blue 27 , onPress = options.onSignOut 28 } 29 30 Nothing -> 31 Element.none 32 ] 33 , viewError options.error 34 , child 35 ] 36 37 38 link : ( String, Route ) -> Element msg 39 link ( label, route ) = 40 Element.link Style.link 41 { label = text label 42 , url = Route.toHref route 43 } 44 45 46 viewError : Maybe String -> Element msg 47 viewError error = 48 case error of 49 Just err -> 50 el Style.error (el [ centerX ] (text err)) 51 52 Nothing -> 53 none