discourse/app/assets/stylesheets/common/base/discourse.scss

710 lines
11 KiB
SCSS
Raw Normal View History

// Common
// 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
// Animation Keyframes
@keyframes ping {
from {
transform: scale(0.25);
opacity: 1;
}
to {
transform: scale(2);
opacity: 0;
}
}
@keyframes rotate-forever {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
2015-07-20 15:47:53 +08:00
}
@keyframes background-fade-highlight {
0% {
background-color: $tertiary-low;
}
100% {
background-color: transparent;
}
2014-05-20 11:55:46 +08:00
}
// Base Elements
html {
height: 100%;
}
body {
background-attachment: fixed;
background-size: cover;
min-height: 100%;
@include clearfix;
2014-05-20 11:55:46 +08:00
}
2018-01-19 15:12:30 +08:00
// setting a static limit on big and small prevents nesting abuse
big {
font-size: $font-up-5;
}
small {
font-size: $font-down-2;
}
2014-05-20 11:55:46 +08:00
blockquote {
@include post-aside;
2015-05-19 17:40:19 +08:00
clear: both;
2014-05-20 11:55:46 +08:00
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
button {
&.ok {
background: $success;
color: $secondary;
2019-02-01 03:20:27 +08:00
.d-icon {
color: currentColor;
}
@include hover {
background: lighten($success, 10%);
color: $secondary;
}
}
&.cancel {
background: $danger;
color: $secondary;
2019-02-01 03:20:27 +08:00
.d-icon {
color: currentColor;
}
@include hover {
background: lighten($danger, 10%);
color: $secondary;
}
}
}
ul.breadcrumb {
margin: 0 10px 0 10px;
}
2014-05-26 14:17:25 +08:00
a.no-href {
cursor: pointer;
}
img.avatar {
border-radius: 50%;
}
// don't wrap relative dates; we want Jul 26, '15, not: Jul
// 26,
// '15
span.relative-date {
white-space: nowrap;
}
label {
display: flex;
margin-bottom: 5px;
2018-09-19 23:48:48 +08:00
align-items: flex-start;
> .d-icon {
align-self: center;
margin-right: 4px;
}
2017-08-19 00:36:21 +08:00
}
input {
&[type="radio"],
&[type="checkbox"] {
2018-10-03 00:04:37 +08:00
margin-top: 0.17em;
margin-right: 0.43em;
margin-left: 0.1em;
line-height: $line-height-small;
cursor: pointer;
flex-shrink: 0; // Adding for safety, Safari will shrink checkboxes
}
&[type="submit"],
&[type="reset"],
&[type="button"],
&[type="radio"],
&[type="checkbox"] {
width: auto;
}
&.invalid {
background-color: dark-light-choose(
$danger-low,
scale-color($danger, $lightness: -60%)
);
}
.radio &[type="radio"],
.checkbox &[type="checkbox"] {
float: left;
margin-left: -18px;
}
}
input,
select,
textarea {
color: $primary;
&[class*="span"] {
float: none;
margin-left: 0;
}
&[disabled],
&[readonly] {
cursor: not-allowed;
background-color: $primary-low;
border-color: $primary-low;
}
&:focus:required:invalid {
color: $danger;
border-color: $danger;
}
&:focus:required:invalid:focus {
border-color: $danger;
box-shadow: shadow("focus-danger");
}
}
input {
&[type="text"],
&[type="password"],
&[type="datetime"],
&[type="datetime-local"],
&[type="date"],
&[type="month"],
&[type="time"],
&[type="week"],
&[type="number"],
&[type="email"],
&[type="url"],
&[type="search"],
&[type="tel"],
&[type="color"] {
@include appearance-none;
display: inline-block;
padding: $input-padding;
margin-bottom: 9px;
font-size: $font-0;
line-height: $line-height-small;
color: $primary;
background-color: $secondary;
border: 1px solid $primary-medium;
border-radius: 0;
box-sizing: border-box;
min-height: 30px;
&:focus {
border-color: $tertiary;
box-shadow: shadow("focus");
outline: 0;
}
}
}
2018-10-05 03:47:14 +08:00
.input {
&-prepend,
&-append {
margin-bottom: 5px;
input[class*="span"] {
display: inline-block;
}
input,
select {
position: relative;
margin-bottom: 0;
vertical-align: middle;
border-radius: 0;
&:focus {
z-index: z("base") + 1;
}
}
.add-on {
display: inline-flex;
align-items: center;
width: auto;
padding: 0 0.5em;
height: 28px;
background-color: $primary-low;
border: 1px solid $primary-medium;
}
.add-on,
.btn {
&:first-child {
margin-right: -1px;
}
&:last-child {
margin-left: -1px;
border-radius: 0 3px 3px 0;
}
}
}
&-prepend {
.add-on,
.btn {
margin-right: -1px;
}
}
}
textarea {
height: auto;
background-color: $secondary;
border: 1px solid $primary-medium;
&:focus {
border-color: $tertiary;
box-shadow: shadow("focus");
outline: 0;
}
}
select {
2018-01-19 15:12:30 +08:00
border: 1px solid $primary-low;
2017-08-19 00:36:21 +08:00
}
2015-03-28 02:42:27 +08:00
table {
th {
font-weight: normal;
color: $primary-medium;
text-align: left;
padding: 0.5em;
}
}
// Common Classes
.sortable {
white-space: nowrap;
cursor: pointer;
.discourse-no-touch & {
&:hover {
background-color: $primary-low;
}
}
.d-icon {
margin-left: 0.25em;
}
@include unselectable;
}
.radio,
.checkbox {
min-height: 18px;
padding-left: 18px;
.controls > &:first-child {
padding-top: 5px;
}
&.inline {
display: inline-block;
padding-top: 5px;
margin-bottom: 0;
vertical-align: middle;
}
2017-08-19 00:36:21 +08:00
}
.radio.inline .radio.inline,
.checkbox.inline .checkbox.inline {
margin-left: 10px;
}
.container {
@extend .clearfix;
}
.wrap {
@extend .clearfix;
margin-right: auto;
margin-left: auto;
padding: 0 8px;
.contents {
position: relative;
}
}
.boxed {
&.white {
background-color: $secondary;
}
2017-08-19 00:36:21 +08:00
}
.full-width {
margin-left: 12px;
}
2017-08-19 00:36:21 +08:00
// the default for table cells in topic list
2017-10-11 04:07:46 +08:00
// is $primary-medium
2017-08-19 00:36:21 +08:00
// numbers get dimmer as they get colder
.coldmap {
&-high {
color: dark-light-choose($primary-low-mid, $secondary-high) !important;
}
2014-08-14 21:33:41 +08:00
&-med {
2017-10-11 04:07:46 +08:00
color: dark-light-choose($primary-medium, $secondary-high) !important;
}
&-low {
2017-10-11 04:07:46 +08:00
color: dark-light-choose($primary-medium, $secondary-medium) !important;
}
2017-08-19 00:36:21 +08:00
}
.top-space {
2017-08-19 00:36:21 +08:00
margin-top: 10px;
}
2014-12-23 19:09:17 +08:00
2017-08-19 00:36:21 +08:00
.message {
2018-07-13 04:38:51 +08:00
border-radius: 8px;
2017-08-19 00:36:21 +08:00
background-color: $secondary;
padding: 14px;
2014-12-23 19:09:17 +08:00
2017-08-19 00:36:21 +08:00
h2 {
margin-bottom: 20px;
}
2017-08-19 00:36:21 +08:00
}
2017-08-19 00:36:21 +08:00
.clear-transitions {
transition: none !important;
2017-08-19 00:36:21 +08:00
}
2017-08-19 00:36:21 +08:00
.tip {
display: inline-block;
&.good {
color: $success;
}
2017-08-19 00:36:21 +08:00
&.bad {
color: $danger;
}
2017-08-19 00:36:21 +08:00
}
2017-08-19 00:36:21 +08:00
.avatar-wrapper {
background-color: $secondary;
display: inline-block;
border-radius: 50%;
}
2017-08-19 00:36:21 +08:00
.profiler-results.profiler-left {
top: 60px !important;
}
.flex-center-align {
display: flex;
align-items: center;
}
2014-07-26 01:33:38 +08:00
.unread-private-messages {
2014-07-26 11:06:14 +08:00
color: $secondary;
background: $success;
&.badge-notification[href] {
color: $secondary;
}
2014-07-26 01:33:38 +08:00
}
2014-08-22 22:45:51 +08:00
.ring-backdrop-spotlight {
position: absolute;
width: 80px;
height: 80px;
top: -18px;
right: -18px;
background-image: radial-gradient(
40px at 50% 50%,
transparent 95%,
$primary 100%
);
opacity: 0.85;
}
.ring-backdrop {
position: absolute;
width: 80px;
height: 80px;
top: -18px !important;
right: -18px !important;
box-shadow: 0 0 0 9999px rgba($primary, 0.85);
z-index: z("modal", "overlay");
}
.ring-first-notification {
position: absolute;
color: $secondary;
text-align: left;
right: 70px;
2016-11-16 12:44:22 +08:00
top: 60px;
width: 230px;
2018-01-13 06:27:38 +08:00
line-height: $line-height-medium;
}
.ring {
$gradient-start: transparent;
$gradient-end: #090;
background: -webkit-radial-gradient($gradient-start, $gradient-end);
background: -o-radial-gradient($gradient-start, $gradient-end);
background: -moz-radial-gradient($gradient-start, $gradient-end);
background: radial-gradient($gradient-start, $gradient-end);
top: -11px !important;
2016-11-09 14:35:29 +08:00
right: 23.5px !important;
2016-11-08 19:57:32 +08:00
border-radius: 100%;
width: 20px;
height: 20px;
-moz-animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
-webkit-transform-origin: center;
-moz-animation-duration: 3s;
-webkit-animation-duration: 3s;
-moz-animation-name: ping;
-webkit-animation-name: ping;
}
2014-08-22 22:45:51 +08:00
.fade {
opacity: 0;
transition: opacity 0.15s linear;
2014-11-06 09:13:51 +08:00
&.in {
opacity: 1;
2014-11-06 09:13:51 +08:00
}
}
2014-11-14 03:15:36 +08:00
.inline-spinner {
display: inline-block;
margin: 0;
}
.spinner {
margin: 20px auto 20px auto;
position: relative;
-webkit-animation: rotate-forever 1s infinite linear;
animation: rotate-forever 1s infinite linear;
height: 30px;
width: 30px;
2017-06-12 10:20:14 +08:00
border: 4px solid blend-primary-secondary(50%);
border-right-color: transparent;
border-radius: 50%;
2014-11-14 03:15:36 +08:00
&.small {
width: 10px;
height: 10px;
margin: 0;
display: inline-block;
}
2014-11-06 09:13:51 +08:00
}
2016-02-07 06:22:46 +08:00
2016-06-07 02:18:15 +08:00
.content-list {
h3 {
2017-08-19 00:36:21 +08:00
color: $primary-medium;
2018-01-13 06:27:38 +08:00
font-size: $font-up-1;
2016-06-07 02:18:15 +08:00
padding-left: 5px;
margin-bottom: 10px;
}
ul {
list-style: none;
margin: 0;
li {
2017-08-19 00:36:21 +08:00
border-bottom: 1px solid $primary-low;
2016-06-07 02:18:15 +08:00
&:first-of-type {
border-top: 1px solid $primary-low;
2016-06-07 02:18:15 +08:00
}
a {
display: block;
padding: 10px;
2016-06-07 02:18:15 +08:00
color: $primary;
&:hover {
background-color: $primary-low;
color: $primary;
}
&.active {
font-weight: bold;
color: $primary;
}
2016-06-07 02:18:15 +08:00
}
}
}
}
.form-vertical {
input,
textarea,
select,
.input-prepend,
.input-append {
display: inline-block;
margin-bottom: 0;
2018-10-02 22:42:49 +08:00
flex: 0 0 auto;
}
.control-group {
@include clearfix;
}
.control-label {
font-weight: bold;
2018-01-13 06:27:38 +08:00
font-size: $font-up-2;
line-height: $line-height-large;
}
.controls {
margin-left: 0;
}
2016-02-07 06:22:46 +08:00
}
// Special elements
// Special elements
#main {
img.avatar {
&.header {
width: 45px;
height: 45px;
}
&.medium {
width: 32px;
height: 32px;
}
&.small {
width: 25px;
height: 25px;
}
&.tiny {
width: 20px;
height: 20px;
}
}
.user-list {
.user {
padding-bottom: 5px;
}
}
}
#loading-message {
position: absolute;
2018-01-13 06:27:38 +08:00
font-size: $font-up-5;
text-align: center;
top: 120px;
left: 500px;
color: $primary;
}
#footer {
.container {
height: 50px;
.contents {
padding-top: 10px;
a[href] {
color: $secondary;
}
}
}
}
.inline {
display: inline;
}
.pref-auth-tokens {
.row {
border-bottom: 1px solid #ddd;
margin: 5px 0px;
padding-bottom: 5px;
&:last-child {
border-bottom: 0;
}
}
.auth-token-icon {
font-size: 2.25em;
float: left;
margin-right: 10px;
}
.auth-token-first {
font-size: 1.1em;
.auth-token-device {
font-weight: bold;
}
}
.auth-token-second {
color: $primary-medium;
.active {
color: $success;
font-weight: bold;
}
}
.auth-token-dropdown {
float: right;
.btn,
.btn:hover {
background: transparent;
.d-icon {
color: $primary;
}
}
}
.dropdown-menu {
width: 120px;
& .icon {
margin-top: auto;
}
}
}
.topic-statuses {
display: inline;
float: left;
margin-right: 0.15em;
.topic-status {
margin: 0;
display: inline-flex;
color: $primary-medium;
.d-icon {
height: 0.76em;
width: 0.75em;
}
&:not(:last-child) {
margin-right: 0.15em;
}
}
.d-icon-envelope {
color: $danger;
}
}