From 21991758aa0de8b5f2b12b0e102db3b73f0b11f9 Mon Sep 17 00:00:00 2001 From: Paul Adam Davis Date: Sat, 22 Nov 2014 01:06:18 +0000 Subject: [PATCH] Cleanup layout Sass Continues on from #4441 - Reformats the layout Sass files (comments, white space) - DRY up small chunks of CSS to make it more comprehensible --- core/client/assets/sass/layouts/about.scss | 121 ++++++----- core/client/assets/sass/layouts/auth.scss | 108 +++++----- core/client/assets/sass/layouts/content.scss | 150 ++++++++----- core/client/assets/sass/layouts/default.scss | 78 ++++--- core/client/assets/sass/layouts/editor.scss | 197 ++++++++++-------- core/client/assets/sass/layouts/error.scss | 27 ++- core/client/assets/sass/layouts/settings.scss | 166 +++++---------- core/client/assets/sass/layouts/setup.scss | 50 ++++- core/client/assets/sass/layouts/tags.scss | 74 +++---- core/client/assets/sass/layouts/user.scss | 140 ++++++++----- core/client/assets/sass/layouts/users.scss | 11 - core/client/templates/settings/users/user.hbs | 2 +- 12 files changed, 619 insertions(+), 505 deletions(-) diff --git a/core/client/assets/sass/layouts/about.scss b/core/client/assets/sass/layouts/about.scss index 46f8f33e0b80..de0a1b2db08e 100644 --- a/core/client/assets/sass/layouts/about.scss +++ b/core/client/assets/sass/layouts/about.scss @@ -1,13 +1,43 @@ -// +// ------------------------------------------------------------ // About Ghost -// -------------------------------------------------- // Slug: /ghost/settings/about +// +// Styles for the About Ghost page, detailing environment & top +// contributors. +// +// * Wrapper +// * Logo & Version +// * Environment & Get Involved +// * Contributors +// * Credits & Copyright +// ------------------------------------------------------------ -.settings-about { +// +// Wrapper +// -------------------------------------------------- + +.settings-about { h1 { letter-spacing: 0; } +} + + +// +// Logo & Version +// -------------------------------------------------- + +.about-ghost-intro { + @media (max-width: 550px) { + padding-top: 40px; + } + + h1 { + margin-top: -6px; + margin-bottom: -21px; + font-feature-settings: normal; + } .ghost_logo { position: relative; @@ -22,49 +52,33 @@ }; } + .version { + font-weight: 300; + font-size: 1.8rem; + position: relative; + top: -3px; + left: -9px; + color: $blue; + } + h1 + p { margin-top: 1px; color: $midgrey; } - -} - - -// -// App Details -// -------------------------------------------------- +}//.about-ghost-intro // Special case to hide the desktop page header, because // in this instance the Ghost logo replaces it. -.settings-view-about { - @media (min-width: 901px) { - .settings-view-header { - display: none; - } +@media (min-width: 901px) { + .settings-view-about .settings-view-header { + display: none; } } -.about-ghost-intro { - h1 { - margin-top: -6px; - margin-bottom: -21px; - font-feature-settings: normal; - - .version { - font-weight: 300; - font-size: 1.8rem; - position: relative; - top: -3px; - left: -9px; - color: $blue; - } - } - - @media (max-width: 550px) { - padding-top: 40px; - } -} +// +// Environment & Get Involved +// -------------------------------------------------- .about-environment-help { margin-top: 35px; @@ -77,6 +91,7 @@ margin: 2px 0 0 0; line-height: 1.6; } + dt, dd { width: auto; float: left; @@ -84,9 +99,11 @@ margin: 0; font-feature-settings: normal; } + dt { margin-right: 5px; } + .about-environment-detail { text-transform: capitalize; } @@ -106,7 +123,6 @@ padding-top: 9px; padding-bottom: 9px; min-height: 32px; - background: #A1ADB3; color: #fff; @@ -117,19 +133,19 @@ &:nth-child(1) { margin-bottom: 11px; } - } - -} // .about-help +}//.about-help @media (min-width: 501px) { .about-environment-help { max-width: 430px; } + .about-environment { float: left; width: calc(100% - 190px); } + .about-help { float: right; width: 170px; @@ -152,6 +168,7 @@ a { display: block; + position: relative; @media (min-width: 601px) { margin-right: 9px; @@ -162,13 +179,6 @@ margin-bottom: 6px; } - img { - width: 100%; - display: block; - border-radius: 100%; - } - - position: relative; &:before { opacity: 0; content: attr(title); @@ -184,6 +194,7 @@ font-size: 1rem; pointer-events: none; } + &:after { opacity: 0; content: ''; @@ -194,6 +205,7 @@ transition: opacity 0.15s ease-in-out; @include triangle(8px, $darkgrey, "down"); } + &:hover { &:before, &:after { @@ -201,11 +213,14 @@ } } - } - - } // li - -} // .top-contributors + img { + width: 100%; + display: block; + border-radius: 100%; + } + }//a + }//li +}//.top-contributors // @@ -245,6 +260,7 @@ &:visited { color: inherit; } + &:hover, &:focus, &:active { @@ -252,5 +268,4 @@ color: $blue; } } - -} // .about-copyright +}//.about-copyright \ No newline at end of file diff --git a/core/client/assets/sass/layouts/auth.scss b/core/client/assets/sass/layouts/auth.scss index 526c95a234fc..fe9c79b823ae 100644 --- a/core/client/assets/sass/layouts/auth.scss +++ b/core/client/assets/sass/layouts/auth.scss @@ -1,10 +1,19 @@ +// ------------------------------------------------------------ +// Authentication +// Slug: /ghost/[signin/signup/forgotten/reset] // -// Auth -// -------------------------------------------------- -// Slug: /ghost/signin/ +// Styles for the authentication pages +// +// * Auth colours & wrappers +// * Sign In +// * Signup & Reset +// * Forgot Password +// ------------------------------------------------------------ + + +// +// Auth colours & wrappers // -------------------------------------------------- -// Covers styles for all auth screens, login, signup -// forgot password, and so on. .ghost-login, .ghost-signup, @@ -28,27 +37,28 @@ margin: 0; position: relative; transition: background ease 0.25s; + &:focus { border: none; background: lighten($darkgrey, 15%); } } + // Changes the default Webkit yellow autofill colour to grey input:-webkit-autofill { -webkit-box-shadow: 0 0 0px 1000px $lightgrey inset !important; } - -} +}//.ghost-login, .ghost-signup, .ghost-forgotten, .ghost-reset .login-box, .signup-box, .forgotten-box, .reset-box { + display: table; max-width: 530px; height: 90%; margin: 0 auto; padding: 0; - display: table; @media (max-width: 630px) { max-width: 264px; @@ -59,6 +69,7 @@ // // Sign In +// Slug: /ghost/signin/ // -------------------------------------------------- .login-form { @@ -82,6 +93,14 @@ } } + .email-wrap { + margin-right: 3px; + + @media (max-width: 630px) { + margin-right: 0; + } + } + .email, .password { display: inline-block; @@ -91,19 +110,6 @@ @media (max-width: 630px) { width: 264px; - } - } // .email, .password - - .email-wrap { - margin-right: 3px; - @media (max-width: 630px) { - margin-right: 0; - } - } // .email-wrap - - @media (max-width: 630px) { - .email, - .password { border-radius: 2px; } } @@ -119,19 +125,15 @@ button { width: 85px; - height: 36px; - margin:0 0 0 10px; - padding: 0.5em 1.37em; - min-height: 30px; - min-width: 80px; - box-shadow: rgba(255,255,255,0.15) 0 1px 0 inset; + height: 37px; + margin-left: 10px; @media (max-width: 630px) { margin: 0; width: 100%; margin-bottom: 1em; } - } // button + } .meta { clear: both; @@ -146,13 +148,14 @@ color: lighten($midgrey, 5%); text-decoration: none; } - } // a - -} // .login-form + } +}//.login-form // -// Signup / Reset +// Signup & Reset +// Slug: /ghost/signup +// Slug: /ghost/reset/t0k3n // -------------------------------------------------- .signup-form, @@ -166,8 +169,7 @@ width: 264px; } - div { // Yes. Really. - // TODO: Same here as above + .password-wrap { position: relative; margin: 0 0 1em 0; background: lighten($darkgrey, 10%); @@ -187,28 +189,28 @@ .name-wrap { position: relative; border-radius: 2px; + } - .name { - border-radius: 2px; - } + .name { + border-radius: 2px; } .email-wrap { position: relative; border-radius: 2px; + } - .email { - border-radius: 2px; - } + .email { + border-radius: 2px; } .password-wrap { position: relative; border-radius: 2px; + } - .password { - border-radius: 2px; - } + .password { + border-radius: 2px; } button { @@ -220,12 +222,12 @@ min-width: 80px; box-shadow: rgba(255,255,255,0.15) 0 1px 0 inset; } - -} // .signup-form, .reset-form +}//.signup-form, .reset-form // // Forgot Password +// Slug: /ghost/forgotten // -------------------------------------------------- .forgotten-form { @@ -240,21 +242,15 @@ float: left; border-radius: 2px; width: 100%; - } // .email-wrap + } .email { padding: 8px 10px; border-radius: 2px; - } // .email + } button { width: 100%; - height: 36px; - margin: 0 0 1em 0; - padding: 0.5em 1.37em; - min-height: 30px; - min-width: 80px; - box-shadow: rgba(255,255,255,0.15) 0 1px 0 inset; - } // button - -} // .forgotten-form \ No newline at end of file + height: 37px; + } +}//.forgotten-form \ No newline at end of file diff --git a/core/client/assets/sass/layouts/content.scss b/core/client/assets/sass/layouts/content.scss index 4f0eb5f0175d..526aca88f5b9 100644 --- a/core/client/assets/sass/layouts/content.scss +++ b/core/client/assets/sass/layouts/content.scss @@ -1,7 +1,21 @@ -// +// ------------------------------------------------------------ // Content Management -// -------------------------------------------------- // Slug: /ghost/ +// +// Styles for the content management page, which is where +// the posts are listed. +// +// * Container +// * Show/Hide on mobile +// * Content List +// * Preview +// * No Posts +// * Keyboard Focus Animations +// ------------------------------------------------------------ + + +// +// Container // -------------------------------------------------- .content-view-container { @@ -14,11 +28,16 @@ } } -// Show/hide content list & preview on mobile + +// +// Show/Hide on mobile +// -------------------------------------------------- + .content-list { &.show-menu { display: block; } + &.show-content { display: none; } @@ -28,11 +47,17 @@ &.show-menu { display: none; } + &.show-content { display: block; } } + +// +// Content List +// -------------------------------------------------- + .content-list { width: 33%; padding: 15px; @@ -53,6 +78,7 @@ .content-filter { position: relative; z-index: 300; + > a { padding: 5px; margin-left: -5px; @@ -63,21 +89,6 @@ } } - &.keyboard-focused { - // This has to be a pseudo element to sit over the top of everything else in the content list - &:before { - content: ''; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 500; - pointer-events: none; - animation: keyboard-focus-style-fade-out 1.5s 1 forwards; - } - } - .btn-green { @include icon($i-add); position: absolute; @@ -94,9 +105,9 @@ right: 0; bottom: 0; left: 0; + padding-top: 40px; overflow: auto; -webkit-overflow-scrolling: touch; - padding-top: 40px; } .entry-title { @@ -110,6 +121,7 @@ float: right; text-align: right; margin-left: 15px; + @media (max-width: 900px) { float: none; } @@ -119,8 +131,13 @@ font-size: 1.3rem; font-weight: 300; - .draft { color: $red; } - .scheduled { color: $orange; } + .draft { + color: $red; + } + + .scheduled { + color: $orange; + } } .featured .status { @@ -143,16 +160,9 @@ border-bottom: $lightbrown 1px solid; a { - display: block; padding: 20px 20px; color: rgba(0,0,0,0.5); - @media (max-width: 400px) { - padding: 15px; - } - @media (max-width: 900px) { - padding-right: 40px; - } @include icon-after($i-chevron) { position: absolute; @@ -160,24 +170,29 @@ margin-top: -6px; right: 15px; } - @media (min-width: 901px) { - &:after { - display: none; - } - } &:hover { text-decoration: none; } - } // a + @media (max-width: 400px) { + padding: 15px; + } - } // li + @media (max-width: 900px) { + padding-right: 40px; + } + + @media (min-width: 901px) { + &:after { + display: none; + } + } + }//a + }//li li.active { @media (min-width: 901px) { - // only apply active styles on larger devices - border-bottom: lighten($midgrey, 40%) 1px solid; background: lighten($lightbrown, 5%); box-shadow: @@ -190,11 +205,9 @@ color: $darkgrey; font-weight: normal; } - } - } // li.active - -} // .content-list + }//li.active +}//.content-list // @@ -218,16 +231,13 @@ overflow: visible; } - &.keyboard-focused { - animation: keyboard-focus-style-fade-out 1.5s 1 forwards; - } - .unfeatured { @include icon($i-unfeatured, 14px); vertical-align: -6%; margin: 0 7px 0 -5px; padding: 3px; } + .featured { @include icon($i-featured, 14px); vertical-align: -6%; @@ -259,7 +269,7 @@ max-width: 700px; margin:0 auto; } - } // .content-preview-content + } .post-controls { float:right; @@ -281,10 +291,11 @@ width:100%; height:auto; } -} // .content-preview +}//.content-preview .post-preview-header { - .page-title, .btn-back { + .page-title, + .btn-back { display: none; } @@ -319,7 +330,6 @@ right: 4px; } - .post-edit { color: #fff; background-color: transparent; @@ -327,20 +337,26 @@ .featured, .unfeatured, small { display: none; - } // @media (max-width: 900px) - } + }//@media (max-width: 900px) + }//@media (max-width: 900px) @media (min-width: 901px) { .unfeatured, .featured { float: left; } + .post-published-by { float: left; margin-top: 7px; margin-left: 3px; } } -} // .post-preview-header +}//.post-preview-header + + +// +// No Posts +// -------------------------------------------------- .no-posts-box { position: relative; @@ -349,6 +365,7 @@ padding: 0px; display: table; z-index: 600; + @media (max-width: 900px) { position: fixed; top: 45%; @@ -359,6 +376,7 @@ vertical-align: middle; display: table-cell; text-align: center; + @media (max-width: 900px) { display: block; position: relative; @@ -370,6 +388,30 @@ font-weight: 200; font-size: 2em; } - } // ,no-posts + }//.no-posts +}//.no-posts-box + + +// +// Keyboard Focus Animations +// -------------------------------------------------- + +// The inset shadow to show which area has keyboard focus +.content-list.keyboard-focused { + // This has to be a pseudo element to sit over the top of everything else in the content list + &:before { + content: ''; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 500; + pointer-events: none; + animation: keyboard-focus-style-fade-out 1.5s 1 forwards; + } +} -} // .no-posts-box +.content-preview.keyboard-focused { + animation: keyboard-focus-style-fade-out 1.5s 1 forwards; +} \ No newline at end of file diff --git a/core/client/assets/sass/layouts/default.scss b/core/client/assets/sass/layouts/default.scss index 3ffab74c3c50..f42306e251ee 100644 --- a/core/client/assets/sass/layouts/default.scss +++ b/core/client/assets/sass/layouts/default.scss @@ -1,6 +1,20 @@ +// ------------------------------------------------------------ +// Default Styles +// +// Styles for containers and elements used throughout Ghost +// +// * Global Container +// * Main Layout +// * Content Panel +// * The header bar +// ------------------------------------------------------------ + + // // Global Container // -------------------------------------------------- +// Absolutely everything goes in here. It helps +// reliably position other elements, #container { position: absolute; @@ -11,11 +25,12 @@ overflow: hidden; } + // // Main Layout // -------------------------------------------------- - // The
content wrapper + .viewport { position: absolute; top: 0; @@ -30,17 +45,20 @@ transition: transform 0.4s cubic-bezier($settings-menu-bezier); } - // This selector ends up being `body.settings-menu-expanded .viewport` + // Compiles to `body.settings-menu-expanded .viewport` body.global-nav-expanded & { transform: translate3d(260px, 0px, 0px); } - // This selector ends up being `body.settings-menu-expanded .viewport` + // Compiles to `body.settings-menu-expanded .viewport` body.settings-menu-expanded & { @media (max-width: 350px) { transform: translate3d(-100%, 0px, 0px); } + @media (min-width: 351px) { + transform: translate3d(-350px, 0px, 0px); + &:before { content: ''; position: absolute; @@ -51,15 +69,39 @@ width: 1px; background: #EDECE4; } - transform: translate3d(-350px, 0px, 0px); } } +}//.viewport + + +// +// Content Panel +// -------------------------------------------------- +// We can't use position:fixed on .page-header because it would +// break the mobile menu. So we create an overflow-auto content +// area which scrolls just underneath the header, making it look +// like the header is position:fixed. + +.page-content { + position: absolute; + top: 60px; + right: 0; + bottom: 0; + left: 0; + background: #fff; + overflow-y: auto; + overflow-x: hidden; + + @media (max-width: 900px) { + top: 44px; + } } // -// The header bar - visible below 900px +// The header bar // -------------------------------------------------- +// Visible below 900px, as the nav isn't covering this. .page-header { position: relative; @@ -113,28 +155,4 @@ width: 44px; height: 44px; color: #fff; -} - - -// -// The panel which wraps the main content area -// -------------------------------------------------- -// We can't use position:fixed on .page-header because it would -// break the mobile menu. So we create an overflow-auto content -// area which scrolls just underneath the header, making it look -// like the header is position:fixed. - -.page-content { - position: absolute; - top: 60px; - right: 0; - bottom: 0; - left: 0; - background: #fff; - overflow-y: auto; - overflow-x: hidden; - - @media (max-width: 900px) { - top: 44px; - } -} +} \ No newline at end of file diff --git a/core/client/assets/sass/layouts/editor.scss b/core/client/assets/sass/layouts/editor.scss index 189fc2b7520d..8f0cf0edc045 100644 --- a/core/client/assets/sass/layouts/editor.scss +++ b/core/client/assets/sass/layouts/editor.scss @@ -1,10 +1,25 @@ -// +// ------------------------------------------------------------ // Editor -// -------------------------------------------------- // Slug: /ghost/editor/ +// +// Styles for the Editor +// +// * Post Title +// * Container & Floating Headers +// * Editor +// * Markdown Help Icon +// * Post Preview +// * Zen Mode +// * Publish Bar +// * Post Settings Menu meta Data +// * Markdown Help Modal +// ------------------------------------------------------------ + + +// +// Post Title // -------------------------------------------------- - // The main post title .entry-container .entry-title { height: 60px; padding: 0 20px; @@ -25,7 +40,12 @@ outline: 0; } } -} // .entry-title +}//.entry-title + + +// +// Container & Floating Headers +// -------------------------------------------------- .editor { @@ -41,8 +61,13 @@ } // The two content panel wrappers, positioned left/right - .entry-markdown { left: 0; } - .entry-preview { right: 0; border-left: $lightbrown 1px solid; } + .entry-markdown { + left: 0; + } + .entry-preview { + right: 0; + border-left: $lightbrown 1px solid; + } // The visual styles for both panels .entry-markdown, @@ -55,8 +80,16 @@ border-top: $lightbrown 1px solid; background: #fff; - // Convert all content areas to small boxes + // Hide markdown icon + wordcount when we hit mobile + @media (max-width: 400px) { + .markdown-help, + .entry-word-count { + display: none; + } + } + @media (max-width: 1000px) { + // Convert all content areas to small boxes top: 100px; left: 0; right: 0; @@ -64,13 +97,23 @@ border: none; z-index: 100; min-height: 380px; - .markdown, .entry-preview-content { + + .markdown, + .entry-preview-content { height: 50px; overflow: hidden; } - } + + // Correctly colour the markdown icon when inactive and hovered + &:not(.active) .markdown-help:hover:before { + color: #fff; + } + }//@media (max-width: 1000px) .floatingheader { + a { + color: $brown; + } // Turn headers into tabs which act as links // both headers set to grey/inactive colour @@ -90,27 +133,12 @@ } } - a { - color: $brown; - } - .entry-word-count { float: right; position: relative; top: 2px; } - - } - - @media (max-width: 1000px) { - &:not(.active) { - .markdown-help { - &:hover:before { - color: #fff; - } - } - } - } + }//.floatingheader // Give the tab with the .active class the highest z-index &.active { @@ -133,24 +161,23 @@ color: $brown; background: #fff; box-shadow: none; + a { color: $brown; } } } + }//.entry-markdown, .entry-preview - // Hide markdown icon + wordcount when we hit mobile - @media (max-width: 400px) { - .markdown-help, - .entry-word-count { - display: none; - } - } +} - } // .entry-markdown, .entry-preview - .entry-markdown-content { +// +// Editor +// -------------------------------------------------- +.editor { + .entry-markdown-content { textarea { border: 0; width: 100%; @@ -166,25 +193,27 @@ left: 0; -webkit-overflow-scrolling: touch; + &:focus { + outline: 0; + } + @media (max-width: 600px) { padding: 10px; } + @media (min-width: 601px) and (max-width: 1000px) { padding: 15px; } + @media (min-width: 1001px) { top: 40px; } + @media (max-height: 560px) { height: calc(100% - 5px); } - - &:focus { - outline: 0; - } - } - - } // .entry-markdown-content + }//textarea + }//.entry-markdown-content .CodeMirror { height: auto; @@ -220,6 +249,7 @@ @media (max-width: 1000px) {padding-top: 25px;} @media (max-width: 400px) {padding: 15px 0;} } + .CodeMirror pre { padding: 0 40px; /* Horizontal padding of content */ @media (max-width: 400px) {padding: 0 15px;} @@ -275,39 +305,39 @@ user-select: none; cursor: default; - // Tweak padding for smaller screens - @media (max-width: 1000px) { - padding-top: 20px; - } @media (max-width: 400px) { padding: 15px; } + + @media (max-width: 1000px) { + padding-top: 20px; + } } // Special case, when scrolling, add shadows to content headers. - .scrolling { - - .floatingheader { - @media (max-width: 1000px) { + @media (max-width: 1000px) { + .scrolling{ + .floatingheader { box-shadow: none; - } - &::before, - &::after { - @media (max-width: 1000px) { + &:before, + &:after { display: none; } } - } - .CodeMirror-scroll, - .entry-preview-content { - @media (max-width: 1000px) { + + .CodeMirror-scroll, + .entry-preview-content { box-shadow: 0 5px 5px rgba(0,0,0,0.05) inset; } } - } // .scrolling + } +}//.editor -} // .editor + +// +// Markdown Help Icon +// -------------------------------------------------- .markdown-help { position: relative; @@ -344,10 +374,12 @@ text-decoration: none; color: $grey; } + .img-placeholder { border: 5px dashed $grey; height: 100px; position: relative; + span { display: block; height: 30px; @@ -358,18 +390,19 @@ text-align: center; } } + a { &.image-edit { width: 16px; height: 16px; } } + img { max-width: 100%; height: auto; margin: 0 auto; } - } // Placeholder objects for