A platform for community discussion. Free, open, simple.
REFACTOR: merge /desktop and /mobile discourse.scss into /common (#32517)
Kris9603cb63d026
diff --git a/app/assets/stylesheets/common/base/discourse.scss b/app/assets/stylesheets/common/base/discourse.scssindex 4c0deb61278..5ea989be1da 100644--- a/app/assets/stylesheets/common/base/discourse.scss+++ b/app/assets/stylesheets/common/base/discourse.scss@@ -5,6 +5,7 @@// BEWARE: changing these styles implies they take effect anywhere they are seen// throughout the Discourse application:root {+ --d-max-width: 1110px;--d-input-bg-color: var(--secondary);--d-input-text-color: var(--primary);--d-input-border: 1px solid var(--primary-400);@@ -101,12 +102,23 @@ html {}body {+ background-color: var(--secondary);background-attachment: fixed;background-size: cover;min-height: 100%;box-sizing: border-box;+ &.dragging {+ cursor: ns-resize;+ }+@include clearfix;++ @include viewport.until(sm) {+ body {+ min-width: 0;+ }+ }}// setting a static limit on big and small prevents nesting abuse@@ -119,11 +131,14 @@ small {}blockquote {- clear: both;-@include post-aside;}+code,+pre {+ font-family: var(--d-font-family--monospace);+}+h1,h2,h3,@@ -194,6 +209,11 @@ label {}input {+ @include viewport.from(sm) {+ width: 210px;+ margin-left: 0;+ }+&[type="radio"],&[type="checkbox"] {margin-top: 0.17em;@@ -310,10 +330,30 @@ textarea {&:focus {@include default-focus;}++ @include viewport.from(sm) {+ width: 210px;+ margin-left: 0;+ }}select {border: 1px solid var(--primary-low);+ background: var(--secondary);++ &[multiple],+ &[size] {+ height: auto;+ }++ @include viewport.from(sm) {+ width: 220px;+ }+}++select,+input[type="file"] {+ line-height: var(--line-height-large);}table {@@ -346,6 +386,34 @@ textarea {}}+@include viewport.from(sm) {+ label,+ input,+ button,+ select,+ textarea {+ font-size: var(--font-0);+ font-weight: normal;+ line-height: var(--line-height-medium);+ }++ select,+ textarea {+ display: inline-block;+ margin-bottom: 9px;+ font-size: var(--font-0);+ line-height: var(--line-height-large);+ color: var(--primary);+ }++ .input {+ &-xxlarge,+ &-xxlarge + .control-instructions {+ width: 530px;+ }+ }+}+// Common Classes.sortable {white-space: nowrap;@@ -402,12 +470,18 @@ textarea {margin-left: auto;padding: 0 var(--d-wrap-padding-h);+ @include viewport.until(sm) {+ min-width: 0;+ }+.contents {position: relative;}}.boxed {+ height: 100%;+&.white {background-color: var(--secondary);}@@ -415,6 +489,10 @@ textarea {.full-width {margin-left: 12px;++ @include viewport.until(sm) {+ min-width: 0;+ }}.clear-transitions {@@ -565,6 +643,23 @@ textarea {}}+form {+ margin: 0;+}++.control-group {+ margin-bottom: 9px;+}++.controls-dropdown {+ margin-bottom: 10px;+}++.control-instructions {+ color: var(--primary-medium);+ font-size: 0.875rem;+}+.form-vertical {input,textarea,@@ -591,11 +686,50 @@ textarea {}}+ .control-group {+ margin-bottom: 1.25em;+ }+.radio-group {display: flex;flex-direction: column;gap: 0.5em;}++ .controls:not(.controls-dropdown) + .controls {+ margin-top: 0.5em;+ }+}++.form-horizontal {+ input[type="text"],+ input[type="password"],+ textarea {+ margin-bottom: 0;+ }++ .control-group {+ margin-bottom: 18px;++ @include clearfix;+ }++ .control-indent {+ margin-left: 20px;+ margin-bottom: 10px;+ }++ .control-label {+ margin: 6.5px;+ float: left;+ width: 140px;+ text-align: right;+ font-weight: bold;+ }++ .controls {+ margin-left: 160px;+ }}// Special elements@@ -619,6 +753,8 @@ textarea {padding-top: 1.5em;.mobile-view & {+ padding-top: 1.25em;+// notch avoidance@media only screen and (orientation: landscape) {padding-right: env(safe-area-inset-right);@@ -853,3 +989,125 @@ a#skip-link {overflow: hidden !important;margin-right: var(--scroll-gap, 0);}++body.has-sidebar-page {+ .wrap {+ // increase page max-width to accommodate sidebar width+ max-width: calc(var(--d-sidebar-width) + var(--d-max-width));+ }++ #main-outlet-wrapper {+ grid-template-columns: var(--d-sidebar-width) minmax(0, 1fr);+ gap: 0 2em;+ padding-left: 0;++ @include viewport.until(lg) {+ gap: 0 1em;+ }+ }+}++@media (prefers-reduced-motion: no-preference) {+ body.sidebar-animate {+ #main-outlet-wrapper {+ 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);+ }+ }+}++.mobile-view {+ .boxed {+ .contents {+ // adds space below avatar+ padding: 10px 0 0 0;+ }+ }+}++.ios-device {+ textarea {+ background-color: var(--secondary);+ -webkit-tap-highlight-color: transparent;+ }++ input#reply-title {+ -webkit-tap-highlight-color: transparent;+ }+}++// todo: replace — legacy, currently only seems to be used for assigns+.mobile-nav {+ margin: 0;+ padding: 0;+ list-style: none;+ position: relative;++ a {+ color: var(--primary);++ .d-icon {+ margin-right: 0.25em;+ color: var(--primary-medium);+ }+ }++ > li > a.expander {+ display: flex;+ align-items: center;+ border-color: var(--primary-medium);+ max-width: 100%;++ @include form-item-sizing;++ .selection {+ max-width: 120px;++ @include ellipsis;+ }++ > .d-icon {+ &:last-of-type {+ margin-left: auto;+ margin-right: 0;+ }+ }+ }++ .drop {+ display: none;++ &.expanded {+ left: 0;+ display: block;+ position: absolute;+ z-index: z("dropdown");+ background-color: var(--secondary);+ width: 100%;+ list-style: none;+ margin: 0;+ padding: 5px;+ border: 1px solid var(--primary-low);+ box-sizing: border-box;++ li {+ margin: 5px 0;+ padding: 0;++ a {+ height: 100%;+ display: block;+ padding: 5px 8px;++ @include ellipsis;+ }+ }+ }+ }+}diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scssindex 497edbd1ee5..d6a5f9ef0df 100644--- a/app/assets/stylesheets/common/base/topic-post.scss+++ b/app/assets/stylesheets/common/base/topic-post.scss@@ -615,6 +615,12 @@ nav.post-controls {}}+blockquote {+ margin-left: 0;+ margin-right: 0;+ padding: 0.75em;+}+// we use aside to hold expandable quotes (versus, say, static blockquotes)aside.quote {margin-top: 1em;diff --git a/app/assets/stylesheets/desktop/_index.scss b/app/assets/stylesheets/desktop/_index.scssindex 30b196049e8..dad0629a1e4 100644--- a/app/assets/stylesheets/desktop/_index.scss+++ b/app/assets/stylesheets/desktop/_index.scss@@ -1,5 +1,4 @@@import "category-list";-@import "discourse";@import "latest-topic-list";@import "login-signup-page";@import "menu-panel";diff --git a/app/assets/stylesheets/desktop/discourse.scss b/app/assets/stylesheets/desktop/discourse.scssdeleted file mode 100644index 499495106ff..00000000000--- a/app/assets/stylesheets/desktop/discourse.scss+++ /dev/null@@ -1,187 +0,0 @@-// Desktop-// global styles that apply to the Discourse application specifically-// BEWARE: changing these styles implies they take effect anywhere they are seen-// throughout the Discourse application-:root {- --d-max-width: 1110px;-}--// Base Elements-body.widget-dragging {- cursor: ns-resize;-}--body.dragging {- cursor: ns-resize;-}--// Common classes-.boxed {- height: 100%;-}--.form-vertical {- .control-group {- margin-bottom: 1.25em;- }-- .controls:not(.controls-dropdown) + .controls {- margin-top: 0.5em;- }-}--code,-pre {- font-family: var(--d-font-family--monospace);-}--// this removes the unwanted top margin on a paragraph under a heading-h1,-h2,-h3,-h4,-h5,-h6 {- + p {- margin-top: 0;- }-}--form {- margin: 0;-}--label,-input,-button,-select,-textarea {- font-size: var(--font-0);- font-weight: normal;- line-height: var(--line-height-medium);-}--select,-textarea {- display: inline-block;- margin-bottom: 9px;- font-size: var(--font-0);- line-height: var(--line-height-large);- color: var(--primary);-}--input,-textarea {- width: 210px;- margin-left: 0;-}--select,-input[type="file"] {- line-height: var(--line-height-large);-}--select {- width: 220px;- background: var(--secondary);-- &[multiple],- &[size] {- height: auto;- }-}--.input {- &-xxlarge,- &-xxlarge + .control-instructions {- width: 530px;- }-}--.controls-dropdown {- margin-bottom: 10px;-}--.control-instructions {- color: var(--primary-medium);- font-size: 0.875rem;-}--.control-group {- margin-bottom: 9px;-}--.form-horizontal {- input[type="text"],- input[type="password"],- textarea {- margin-bottom: 0;- }-- .control-group {- margin-bottom: 18px;-- @include clearfix;- }-- .control-indent {- margin-left: 20px;- margin-bottom: 10px;- }-- .control-label {- margin: 6.5px;- float: left;- width: 140px;- text-align: right;- font-weight: bold;- }-- .controls {- margin-left: 160px;- }-}--// Media Queries-@include breakpoint(mobile-extra-large) {- body {- min-width: 0;- }-- .wrap,- .full-width {- min-width: 0;- }-}--body.has-sidebar-page {- .wrap {- // increase page max-width to accommodate sidebar width- max-width: calc(var(--d-sidebar-width) + var(--d-max-width));- }-- #main-outlet-wrapper {- grid-template-columns: var(--d-sidebar-width) minmax(0, 1fr);- gap: 0 2em;- padding-left: 0;-- @include breakpoint(large) {- gap: 0 1em;- }- }-}--@media (prefers-reduced-motion: no-preference) {- body.sidebar-animate {- #main-outlet-wrapper {- 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);- }- }-}diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scssindex 63c9e53d2bb..f52327ac2e4 100644--- a/app/assets/stylesheets/desktop/topic-post.scss+++ b/app/assets/stylesheets/desktop/topic-post.scss@@ -485,14 +485,6 @@ video {color: var(--primary);}-/* solo quotes */-blockquote {- /* leave browser defaults for top and bottom here */- margin-left: 0;- margin-right: 0;- padding: 12px;-}-/* quotes with attribution */.quote {& > blockquote {diff --git a/app/assets/stylesheets/mobile/_index.scss b/app/assets/stylesheets/mobile/_index.scssindex cad24c49710..f155b4ca729 100644--- a/app/assets/stylesheets/mobile/_index.scss+++ b/app/assets/stylesheets/mobile/_index.scss@@ -1,4 +1,3 @@-@import "discourse";@import "invite-signup";@import "list-controls";@import "login-signup-page";diff --git a/app/assets/stylesheets/mobile/discourse.scss b/app/assets/stylesheets/mobile/discourse.scssdeleted file mode 100644index c9ba161f88d..00000000000--- a/app/assets/stylesheets/mobile/discourse.scss+++ /dev/null@@ -1,134 +0,0 @@-// Mobile-// global styles that apply to the Discourse application specifically-// BEWARE: changing these styles implies they take effect anywhere they are seen-// throughout the Discourse application--// Base Elements-body {- background-color: var(--secondary);-}--.ios-device {- textarea {- background-color: var(--secondary);- -webkit-tap-highlight-color: transparent;- }-- input#reply-title {- -webkit-tap-highlight-color: transparent;- }-}--blockquote {- /* 13px left is intentional here to properly align with post quotes */- padding: 10px 8px 10px 13px;-- p {- margin: 0 0 10px 0;-- &:last-of-type {- margin-bottom: 0;- }- }-}--// Common classes-.boxed {- .contents {- padding: 10px 0 0 0;- }-}--.control-group {- margin-bottom: 9px;-}--.mobile-nav {- margin: 0;- padding: 0;- list-style: none;- position: relative;-- a {- color: var(--primary);-- .d-icon {- margin-right: 0.25em;- color: var(--primary-medium);- }- }-- > li > a.expander {- display: flex;- align-items: center;-- @include form-item-sizing;- border-color: var(--primary-medium);- max-width: 100%;-- .selection {- @include ellipsis;- max-width: 120px;- }-- > .d-icon {- &:last-of-type {- margin-left: auto;- margin-right: 0;- }- }- }-- .drop {- display: none;-- &.expanded {- left: 0;- display: block;- position: absolute;- z-index: z("dropdown");- background-color: var(--secondary);- width: 100%;- list-style: none;- margin: 0;- padding: 5px;- border: 1px solid var(--primary-low);- box-sizing: border-box;-- li {- margin: 5px 0;- padding: 0;-- a {- height: 100%;- display: block;- padding: 5px 8px;-- @include ellipsis;- }- }- }- }-}--.form-vertical {- .control-group {- margin-bottom: 12px;- }-}--// Special elements-#main-outlet {- padding-top: 1.25em;-- &::after {- // setup overlay for sidebar- content: "";- opacity: 0;- transition: opacity 0.2s;- }-}--#main {- position: relative;-}