Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report: header sticks to top #1121

Merged
merged 3 commits into from
Dec 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions lighthouse-core/report/styles/report.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ span, div, p, section, header, h1, h2, li, ul {
--heading-line-height: 32px;
--subitem-indent: 24px;
--max-line-length: none;

--report-width: 1280px;
--report-menu-width: 280px;
--report-header-height: 58px;
}

:root[data-report-context="devtools"] {
Expand Down Expand Up @@ -78,6 +82,11 @@ html, body {
height: 100%;
}

/* When deep linking to a section, bump the heading down so it's not covered by the top nav. */
:target.aggregations {
padding-top: calc(var(--report-header-height) + var(--heading-line-height)) !important;
}

a {
color: #15c;
}
Expand Down Expand Up @@ -108,7 +117,7 @@ body {
.report {
width: 100%;
margin: 0 auto;
max-width: 1280px;
max-width: var(--report-width);
background: #FFF;
box-shadow: 0 0 6px 0 rgba(0,0,0,0.26);
}
Expand Down Expand Up @@ -164,26 +173,30 @@ body {
}

.report-body__content {
margin-left: 22%;
margin-left: var(--report-menu-width);
position: relative;
}

.report-body__aggregations-container {
padding-top: var(--report-header-height);
}

.report-body__menu-container {
height: 100%;
width: 100%;
min-width: 230px;
max-width: 1280px;
max-width: var(--report-width);
position: fixed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u add will-change to this one as well?

Copy link
Contributor Author

@ebidel ebidel Dec 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

I was curious about the layout of the app. It seems really funky to use pos fixed, transforms, and negative margins. What's up with that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the negative margins comes from @paullewis. tbh I've never used that technique and am not sure why we do it like that. :)

will-change: transform;
left: 50%;
transform: translateX(-50%);
top: 0;
pointer-events: none;
}

.menu {
width: 22%;
width: var(--report-menu-width);
background: #FFFFFF;
min-width: 185px;
height: 100%;
top: 0;
left: 0;
Expand Down Expand Up @@ -307,15 +320,20 @@ body {
}

.report-body__header {
height: 58px;
height: var(--report-header-height);
border-bottom: 1px solid #EBEBEB;
background: #FAFAFA;
margin-left: 22%;
margin-left: var(--report-menu-width);
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
padding: 0 var(--heading-line-height);
position: fixed;
will-change: transform;
z-index: 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do me a solid and add will-change: transform on here as well? for lo-dpi chrome desktop users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

max-width: calc( var(--report-width) - var(--report-menu-width));
width: calc(100vw - var(--report-menu-width));
}

.report-section__title {
Expand Down Expand Up @@ -449,7 +467,7 @@ body {

.footer {
margin-top: 40px;
margin-left: 22%;
margin-left: var(--report-menu-width);
height: 130px;
line-height: 90px;
text-align: center;
Expand All @@ -474,14 +492,17 @@ body {
height: 27px;
}

.aggregations__header {
position: relative;
}

.aggregations__header > h1 {
font-size: var(--heading-font-size);
font-weight: normal;
line-height: var(--heading-line-height);
}

.aggregations {
position: relative;
padding: var(--heading-line-height);
padding-left: calc(var(--heading-line-height) + var(--gutter-width) + var(--gutter-gap));
}
Expand All @@ -498,8 +519,8 @@ body {

.section-result {
position: absolute;
top: var(--heading-line-height);
left: var(--heading-line-height);
top: 0;
left: calc((var(--gutter-width) + var(--gutter-gap)) * -1);
width: var(--gutter-width);

display: flex;
Expand All @@ -516,7 +537,6 @@ body {
text-align: center;
padding: 4px 8px;
border-radius: 2px;
margin-top: calc((var(--heading-line-height) - var(--heading-font-size) - 6px) / 2);
}

.section-result__points {
Expand Down
33 changes: 16 additions & 17 deletions lighthouse-core/report/templates/report-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ <h1 class="menu__header-title">Lighthouse</h1>
</div>
</div>

<div>
<div class="report-body__aggregations-container">
{{#each aggregations}}
<section class="js-breakdown aggregations">
<header class="aggregations__header" id="{{nameToLink this.name}}">
<section class="js-breakdown aggregations" id="{{nameToLink this.name}}">
<header class="aggregations__header">
<h1>{{ this.name }}</h1>
<p class="aggregations__desc">{{ this.description }}</p>
{{#if this.scored}}
<div class="section-result">
<span class="section-result__score score-{{ getTotalScoreRating this }}-bg">
<span class="section-result__points">{{ getTotalScore this }}</span>
<span class="section-result__divider">/</span>
<span class="section-result__total">100</span>
</span>
</div>
{{/if}}
</header>
<p class="aggregations__desc">{{ this.description }}</p>
{{#if this.scored}}
<div class="section-result">
<span class="section-result__score score-{{ getTotalScoreRating this }}-bg">
<span class="section-result__points">{{ getTotalScore this }}</span>
<span class="section-result__divider">/</span>
<span class="section-result__total">100</span>
</span>
</div>
{{/if}}

<div class="js-report-by-user-feature">
{{#each this.score as |aggregation|}}
Expand All @@ -85,13 +85,12 @@ <h1>{{ this.name }}</h1>
{{#if aggregation.name }}
<header class="aggregation__header">
<h2>{{ aggregation.name }}</h2>
{{#if aggregation.description }}
<p class="aggregation__desc">{{{ aggregation.description }}}</p>
{{/if}}
</header>
{{/if}}

{{#if aggregation.description }}
<p class="aggregation__desc">{{{ aggregation.description }}}</p>
{{/if}}

<ul class="subitems">
{{#each aggregation.subItems as |subItem| }}
<li class="subitem {{#if subItem.comingSoon}}--coming-soon{{/if}} {{#if (shouldShowHelpText subItem.score)}}--show-help{{/if}}">
Expand Down