Skip to content

Commit

Permalink
web: make dashboard header sticky on mobile
Browse files Browse the repository at this point in the history
also add a lot of tests, use more elm-css

#2434

Signed-off-by: Jamie Klassen <cklassen@pivotal.io>
  • Loading branch information
Jamie Klassen committed Oct 18, 2018
1 parent 692dce4 commit 6ca695a
Show file tree
Hide file tree
Showing 15 changed files with 1,078 additions and 348 deletions.
3 changes: 1 addition & 2 deletions web/assets/css/dashboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
.dashboard-footer {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background: @base00;
text-align: right;
Expand Down Expand Up @@ -481,11 +482,9 @@

@media (max-width: 812px) {
.dashboard .dashboard-content {
padding-top: (84px * @scale * 2) + (60px * @scale);
}

.dashboard-footer {
position: inherit;
display: block;

.dashboard-legend {
Expand Down
2 changes: 0 additions & 2 deletions web/assets/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

@import "build.less";

@import "newtopbar.less";

@import "dashboard.less";
@import "dashboardhd.less";

Expand Down
190 changes: 0 additions & 190 deletions web/assets/css/newtopbar.less

This file was deleted.

1 change: 1 addition & 0 deletions web/elm/elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"elm-lang/navigation": "2.1.0 <= v < 3.0.0",
"elm-lang/svg": "2.0.0 <= v < 3.0.0",
"elm-lang/websocket": "1.0.2 <= v < 2.0.0",
"elm-lang/window": "1.0.1 <= v < 2.0.0",
"fapian/elm-html-aria": "1.2.2 <= v < 2.0.0",
"krisajenkins/remotedata": "4.3.0 <= v < 5.0.0",
"lukewestby/elm-http-builder": "5.0.0 <= v < 6.0.0",
Expand Down
11 changes: 7 additions & 4 deletions web/elm/src/Dashboard.elm
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ import Monocle.Optional
import Monocle.Lens
import MonocleHelpers exposing (..)
import NewTopBar
import NewTopBar.Styles as NTBS
import NoPipeline exposing (Msg, view)
import Regex exposing (HowMany(All), regex, replace)
import RemoteData
import Routes
import Simple.Fuzzy exposing (filter, match, root)
import Task
import Time exposing (Time)
import Window


type alias Ports =
Expand All @@ -41,7 +43,7 @@ type alias Ports =


type alias PinTeamConfig =
{ pageHeaderClass : String
{ pageHeaderHeight : Float
, pageBodyClass : String
, sectionHeaderClass : String
, sectionClass : String
Expand Down Expand Up @@ -123,7 +125,7 @@ init ports flags =
[ fetchData
, Cmd.map TopBarMsg topBarMsg
, pinTeamNames
{ pageHeaderClass = "module-topbar"
{ pageHeaderHeight = NTBS.pageHeaderHeight
, pageBodyClass = "dashboard"
, sectionClass = "dashboard-team-group"
, sectionHeaderClass = "dashboard-team-header"
Expand Down Expand Up @@ -384,13 +386,14 @@ subscriptions model =
, Mouse.clicks (\_ -> ShowFooter)
, Keyboard.presses KeyPressed
, Keyboard.downs KeyDowns
, Window.resizes (TopBarMsg << NewTopBar.ScreenResized)
]


view : Model -> Html Msg
view model =
Html.div [ class "page" ]
[ (Html.map TopBarMsg << Html.fromUnstyled) (NewTopBar.view model.topBar)
[ (Html.map TopBarMsg) (NewTopBar.view model.topBar)
, dashboardView model
]

Expand All @@ -410,7 +413,7 @@ dashboardView model =
[ Html.div [ class "dashboard-no-content", css [ Css.height (Css.pct 100) ] ] [ (Html.map (always Noop) << Html.fromUnstyled) NoPipeline.view ] ]

Ok substate ->
[ Html.div [ class "dashboard-content" ] (pipelinesView substate model.topBar.query ++ [ footerView substate ]) ]
[ Html.div [ class "dashboard-content" ] (pipelinesView substate (NewTopBar.query model.topBar) ++ [ footerView substate ]) ]
in
Html.div
[ classList [ ( "dashboard", True ), ( "dashboard-hd", model.highDensity ) ] ]
Expand Down
3 changes: 2 additions & 1 deletion web/elm/src/DashboardHd.elm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Html exposing (Html)
import Html.Attributes exposing (class, classList, id, href, src, attribute)
import Html.Attributes.Aria exposing (ariaLabel)
import Html.Events exposing (onMouseEnter)
import Html.Styled as HS
import Http
import Mouse
import NewTopBar
Expand Down Expand Up @@ -183,7 +184,7 @@ subscriptions model =
view : Model -> Html Msg
view model =
Html.div [ class "page" ]
[ Html.map TopBarMsg (NewTopBar.view model.topBar)
[ (Html.map TopBarMsg << HS.toUnstyled) (NewTopBar.view model.topBar)
, dashboardView model
]

Expand Down
6 changes: 6 additions & 0 deletions web/elm/src/MobileState.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module MobileState exposing (MobileState(..))


type MobileState
= Expanded
| Collapsed
Loading

0 comments on commit 6ca695a

Please sign in to comment.