UX: Retry "left-align title with content for sidebar (#18202)" (#18242)

Reverts #18241 and fixes issues with the original PR:

1. Remove an extraneous `margin-left: auto` from a grid cell (this was causing the buggy behavior in webkit)
2. Add `grid-area` name to `.extra-info-wrapper`
3. Account for `.wrap` padding
4. Remove unused css (`.header-row` and inner styles)
This commit is contained in:
Jarek Radosz 2022-09-13 21:45:31 +02:00 committed by GitHub
parent 2a3e138e12
commit 5ee760dc2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 40 deletions

View File

@ -2,16 +2,18 @@ import { createWidget } from "discourse/widgets/widget";
import hbs from "discourse/widgets/hbs-compiler"; import hbs from "discourse/widgets/hbs-compiler";
createWidget("header-contents", { createWidget("header-contents", {
tagName: "div.contents.clearfix", tagName: "div.contents",
template: hbs` template: hbs`
{{#if this.site.desktopView}} <div class="header-logo-wrapper">
{{#if this.siteSettings.enable_experimental_sidebar_hamburger}} {{#if this.site.desktopView}}
{{#if attrs.sidebarEnabled}} {{#if this.siteSettings.enable_experimental_sidebar_hamburger}}
{{sidebar-toggle attrs=attrs}} {{#if attrs.sidebarEnabled}}
{{sidebar-toggle attrs=attrs}}
{{/if}}
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/if}} {{home-logo attrs=attrs}}
{{home-logo attrs=attrs}} </div>
{{#if attrs.topic}} {{#if attrs.topic}}
{{header-topic-info attrs=attrs}} {{header-topic-info attrs=attrs}}
{{/if}} {{/if}}

View File

@ -19,33 +19,32 @@
height: 100%; height: 100%;
.contents { .contents {
display: flex; display: grid;
grid-template-areas: "logo-wrapper extra-info panel";
grid-template-columns: auto 1fr auto;
align-items: center; align-items: center;
height: 100%; height: 100%;
.header-row { .has-sidebar-page & {
width: 100%; // 10px is a .wrap padding
grid-template-columns:
.logo-wrapper { minmax(calc(var(--d-sidebar-width) - 10px), auto)
float: left; 1fr auto;
}
.auth-buttons {
float: right;
margin-top: 0.4em;
.login-button,
.signup-button {
padding: 8px 14px;
}
}
} }
} }
} }
.header-logo-wrapper {
grid-area: logo-wrapper;
display: flex;
align-items: center;
}
.title { .title {
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
a, a,
a:visited { a:visited {
color: var(--header_primary); color: var(--header_primary);
@ -61,10 +60,10 @@
} }
.panel { .panel {
grid-area: panel;
position: relative; position: relative;
display: flex; display: flex;
flex: 0 0 auto; flex: 0 0 auto;
margin-left: auto;
align-items: center; align-items: center;
} }
@ -212,6 +211,8 @@
} }
.header-sidebar-toggle { .header-sidebar-toggle {
grid-area: hamburger;
button { button {
margin-right: 1em; margin-right: 1em;
box-sizing: content-box; // matches other header icons box-sizing: content-box; // matches other header icons
@ -242,6 +243,7 @@
// topic info in the header // topic info in the header
.extra-info-wrapper { .extra-info-wrapper {
grid-area: extra-info;
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
@ -249,6 +251,7 @@
padding: 0 1.5em 0 0.5em; padding: 0 1.5em 0 0.5em;
// we need to hide overflow in both to truncate the title in a flexbox // we need to hide overflow in both to truncate the title in a flexbox
overflow: hidden; overflow: hidden;
.extra-info { .extra-info {
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;

View File

@ -199,19 +199,3 @@ body.has-sidebar-page {
padding-left: 0; padding-left: 0;
} }
} }
@media (prefers-reduced-motion: no-preference) {
body.sidebar-animate {
#main-outlet-wrapper {
// grid-template-columns transition supported in Firefox, Chrome support coming summer 2022
transition-property: grid-template-columns, max-width;
transition-timing-function: var(--d-sidebar-animation-ease);
transition-duration: var(--d-sidebar-animation-time);
}
.d-header-wrap .wrap {
transition: max-width var(--d-sidebar-animation-time)
var(--d-sidebar-animation-ease);
}
}
}