diff --git a/.template-lintrc.js b/.template-lintrc.js index 199228f87ad..c6331e9310f 100644 --- a/.template-lintrc.js +++ b/.template-lintrc.js @@ -2,6 +2,4 @@ module.exports = { extends: ['octane', 'a11y'], - - pending: [{ moduleId: 'app/components/header', only: ['no-duplicate-landmark-elements'] }], }; diff --git a/app/components/footer.module.css b/app/components/footer.module.css index 9ba1cd9efb9..011ab30c63a 100644 --- a/app/components/footer.module.css +++ b/app/components/footer.module.css @@ -11,8 +11,6 @@ } .after-main-links { - composes: width-limit from '../styles/application.module.css'; - margin: 40px; text-align: center; diff --git a/app/components/header.hbs b/app/components/header.hbs index c515c3c00c5..f531e589ae7 100644 --- a/app/components/header.hbs +++ b/app/components/header.hbs @@ -1,161 +1,145 @@
-
- - -

crates.io

-
- -
- - - {{on-key 's' (focus '#cargo-desktop-search')}} - {{on-key 'S' (focus '#cargo-desktop-search')}} - {{on-key 'shift+s' (focus '#cargo-desktop-search')}} -
+ + +

crates.io

+
- -
- - - Menu +
+ {{#if this.session.currentUser}} + + + + {{ this.session.currentUser.name }} + - Browse All Crates - {{#if this.session.currentUser}} - Dashboard - Account Settings - Owner Invites - - - - {{else}} - - - - {{/if}} + Dashboard + Account Settings + Owner Invites + + + -
- -
- - -
+ {{#if this.session.loginTask.isRunning}} + + {{else}} + {{svg-jar "lock" local-class="login-icon"}} + {{/if}} + Log in with GitHub + + {{/if}} +
+ +
+ + + Menu + + + Browse All Crates + {{#if this.session.currentUser}} + Dashboard + Account Settings + Owner Invites + + + + {{else}} + + + + {{/if}} + +
\ No newline at end of file diff --git a/app/components/header.module.css b/app/components/header.module.css index b37d50a7fd0..2856c36babf 100644 --- a/app/components/header.module.css +++ b/app/components/header.module.css @@ -1,45 +1,69 @@ .header { - display: flex; - justify-content: center; + display: grid; width: 100%; + padding: 20px; + color: white; + + align-items: center; + grid-template: + "index-link . menu" auto + "search-form search-form search-form" auto + / auto 1fr auto; + + @media only screen and (min-width: 551px) { + grid-template: + "index-link search-form menu" auto + / auto 1fr auto; + } + + @media only screen and (min-width: 890px) { + grid-template: + "index-link search-form nav login" auto + / auto minmax(150px, 400px) minmax(220px, 1fr) auto; + } + + a { + color: white; + text-decoration: none; + + &:hover { + color: white; + } + } } .header-inner { - composes: width-limit from '../styles/application.module.css'; - display: grid; grid-template-columns: auto 1fr auto; align-items: center; - padding: 10px; - color: white; - a { - color: white; text-decoration: none; - &:hover { color: white; } - } } .index-link { + grid-area: index-link; display: flex; align-items: center; h1 { font-size: 24px; + margin: 0; } } .logo { width: 60px; height: auto; - margin-right: 10px; + margin: -10px 10px -10px -10px; } -.desktop-search-form { +.search-form { + grid-area: search-form; + margin-top: 15px; display: flex; flex-grow: 1; - @media only screen and (max-width: 820px) { - display: none; + @media only screen and (min-width: 551px) { + margin: 0 20px; } } @@ -48,8 +72,6 @@ input.search { border: none; color: black; width: 100%; - margin-left: 16px; - margin-right: 16px; padding: 5px 5px 5px 25px; background-color: white; background-image: url('/assets/search.png'); @@ -66,21 +88,6 @@ input.search { } } -.mobile-search { - display: none; - grid-row: 2; - grid-column: span 3; - margin: 0 10px 10px; - - input.search { - margin: 0; - } - - @media only screen and (max-width: 820px) { - display: block; - } -} - .search-label { position: absolute; left: -10000px; @@ -101,27 +108,34 @@ input.search { } .nav { - display: flex; + grid-area: nav; + display: none; align-items: center; text-align: right; margin-right: 5px; - @media only screen and (max-width: 900px) { - display: none; + @media only screen and (min-width: 890px) { + display: flex; } } -.menu { - text-align: right; - margin-right: 5px; - flex-grow: 2; +.login { display: none; - @media only screen and (max-width: 900px) { + @media only screen and (min-width: 890px) { display: block; } } +.menu { + grid-area: menu; + text-align: right; + + @media only screen and (min-width: 890px) { + display: none; + } +} + .menu-item-with-separator { border-top: 1px solid var(--gray-border); }