diff --git a/flow-report/assets/styles.css b/flow-report/assets/styles.css index 276969c6a837..f8cbfe92fdbd 100644 --- a/flow-report/assets/styles.css +++ b/flow-report/assets/styles.css @@ -10,6 +10,7 @@ --category-summary-font-size: 18px; --gather-mode-icon-size: 16px; --half-base-spacing: calc(var(--base-spacing) / 2); + --separator-color: var(--color-gray-300); --sidebar-flow-step-navigation-font-size: 14px; --sidebar-selected-bg-color: #DDEEFF; --sidebar-summary-font-size: 14px; @@ -17,18 +18,58 @@ --summary-flow-step-label-font-size: 16px; --summary-subtitle-font-size: 16px; --summary-title-font-size: 32px; + --topbar-title-font-size: 14px; } .App { display: grid; - grid-template-areas: "side report"; + grid-template-areas: + "topbar topbar" + "sidebar content"; grid-template-columns: min-content auto; + grid-template-rows: min-content auto; height: 100vh; max-width: 100vw; font-size: var(--app-font-size); } +.App--collapsed { + grid-template-columns: 0px auto; +} +.App--collapsed .Sidebar { + display: none; +} + +.Topbar { + grid-area: topbar; + display: flex; + align-items: center; + border-bottom: 1px solid var(--separator-color); +} + +.Topbar__menu { + padding: var(--base-spacing); + cursor: pointer; + display: flex; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.Topbar__logo { + display: flex; + margin-right: var(--half-base-spacing); +} + +.Topbar__title { + font-size: var(--topbar-title-font-size); + font-weight: bold; +} .Content { + grid-area: content; overflow-y: auto; } @@ -51,11 +92,12 @@ .Separator { height: 1px; width: 100%; - background-color: var(--color-gray-300); + background-color: var(--separator-color); } .Sidebar { - border-right: 1px solid var(--color-gray-300); + grid-area: sidebar; + border-right: 1px solid var(--separator-color); } .Sidebar a { color: var(--color-gray-800); @@ -256,7 +298,7 @@ .SummaryFlowStep__divider--line { grid-column-end: span 5; height: 1px; - background-color: var(--color-gray-300); + background-color: var(--separator-color); } .SummaryCategory__null { diff --git a/flow-report/src/app.tsx b/flow-report/src/app.tsx index 5e56766a7709..b17ae1cadc3f 100644 --- a/flow-report/src/app.tsx +++ b/flow-report/src/app.tsx @@ -5,12 +5,14 @@ */ import {FunctionComponent} from 'preact'; +import {useState} from 'preact/hooks'; import {ReportRendererProvider} from './wrappers/report-renderer'; import {Sidebar} from './sidebar/sidebar'; import {Summary} from './summary/summary'; -import {FlowResultContext, useCurrentLhr} from './util'; +import {classNames, FlowResultContext, useCurrentLhr} from './util'; import {Report} from './wrappers/report'; +import {Topbar} from './topbar'; const Content: FunctionComponent = () => { const currentLhr = useCurrentLhr(); @@ -27,10 +29,12 @@ const Content: FunctionComponent = () => { }; export const App: FunctionComponent<{flowResult: LH.FlowResult}> = ({flowResult}) => { + const [collapsed, setCollapsed] = useState(false); return ( -
+
+ setCollapsed(c => !c)} />
diff --git a/flow-report/src/icons.tsx b/flow-report/src/icons.tsx index e06695e1116d..1ecc75398240 100644 --- a/flow-report/src/icons.tsx +++ b/flow-report/src/icons.tsx @@ -94,3 +94,14 @@ export const CpuIcon: FunctionComponent = () => { ); }; + +export const HamburgerIcon: FunctionComponent = () => { + return ( + + + + + + ); +}; + diff --git a/flow-report/src/topbar.tsx b/flow-report/src/topbar.tsx new file mode 100644 index 000000000000..a3ec52d93bbe --- /dev/null +++ b/flow-report/src/topbar.tsx @@ -0,0 +1,60 @@ +/** + * @license Copyright 2021 The Lighthouse Authors. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ + +import {FunctionComponent, JSX} from 'preact'; + +import {HamburgerIcon} from './icons'; + +/* eslint-disable max-len */ +const Logo: FunctionComponent = () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; +/* eslint-enable max-len */ + +export const Topbar: FunctionComponent<{onMenuClick: JSX.MouseEventHandler}> = +({onMenuClick}) => { + return ( +
+
+ +
+
+ +
+
Lighthouse User Flow Report
+
+ ); +};