discourse/app/assets/stylesheets/desktop/topic-post.scss
Joe 74f0bd08c0
UX: removes unnecessary margin in header tag wrapper
This margin is not needed and doesn't exist in the mobile view. 

It causes a bit of a problem in desktop topics with no categories and more prominently in PMs in the desktop view.

There's a small TODO here where the rest of the extra-info-wrapper styles should all be moved to header sylesheets.
2018-12-28 21:31:41 +08:00

881 lines
16 KiB
SCSS

.wrap {
max-width: $large-width;
}
.full-width {
margin-left: 0;
}
.topic-body {
// this ensures consistent top margin on topic posts even if the first line of a post
// is a top-margin-less element like a list or image.
.regular {
margin-top: 15px;
}
padding: 0;
&:first-of-type {
border-top: none;
}
.reply-to-tab {
z-index: z("base") + 1;
color: dark-light-choose($primary-medium, $secondary-medium);
}
.actions .fade-out {
.discourse-no-touch & {
opacity: 0.7;
transition: opacity 0.7s ease-in-out;
}
.discourse-touch & {
opacity: 1;
}
}
&:hover .actions .fade-out,
.selected .actions .fade-out {
opacity: 1;
}
}
section.post-menu-area {
position: relative;
padding-left: 11px;
}
.post-links-container {
margin-left: 11px;
}
nav.post-controls {
padding: 0;
.like-button {
display: inline-flex;
.like-count {
color: dark-light-choose($primary-low-mid, $secondary-high);
}
.widget-button {
background: none;
}
&:hover {
background: $primary-low;
.like-count {
color: $primary-medium;
&.d-hover {
color: $primary;
}
}
.d-hover {
background: none;
}
}
&:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
.widget-button {
box-shadow: none;
}
}
.like {
&:focus {
background: none;
}
}
.like-count {
font-size: $font-up-1;
margin-left: 0;
.d-icon {
padding-left: 10px;
color: dark-light-choose($primary-low-mid, $secondary-high);
}
&.my-likes {
margin-right: -2px;
}
&.regular-likes {
margin-right: -12px;
}
}
.toggle-like {
padding: 8px 8px;
margin-left: 2px;
}
}
.highlight-action {
color: dark-light-choose($primary-medium, $secondary-high);
}
a,
button {
color: dark-light-choose($primary-low-mid, $secondary-high);
.d-icon {
opacity: 1;
}
margin-right: 2px;
display: inline-block;
}
a.toggle-likes {
padding: 8px 0;
margin-right: -3px;
}
span.badge-posts {
margin-right: 5px;
transition: all linear 0.15s;
}
.actions {
text-align: right;
float: right;
display: inline-block;
.more-actions {
display: none;
overflow: hidden;
}
}
.show-replies {
margin-left: -10px;
font-size: inherit;
span.badge-posts {
color: dark-light-choose($primary-medium, $secondary-high);
}
&:hover {
background: $primary-low;
span.badge-posts {
color: $primary;
}
}
.d-icon {
margin-left: 5px;
font-size: $font-down-1;
}
}
button.create {
margin-right: 0;
color: dark-light-choose($primary-high, $secondary-low);
margin-left: 10px;
}
.create .d-icon {
margin-right: 5px;
}
button {
font-size: $font-up-1;
padding: 8px 10px;
vertical-align: top;
background: transparent;
border: none;
margin-left: 3px;
&.d-hover,
&:focus {
background: $primary-low;
color: $primary;
}
&:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}
&.hidden {
display: none;
}
&.admin {
position: relative;
}
&.delete.d-hover,
&.delete:focus {
background: $danger;
color: $secondary;
}
&.like.d-hover,
&.like:focus {
color: $love;
background: $love-low;
}
&.has-like {
color: $love;
}
&.has-like[disabled]:hover {
background: transparent;
}
&.has-like[disabled]:active {
box-shadow: none;
}
&.bookmark {
padding: 8px 11px;
&.bookmarked {
color: $tertiary;
}
}
}
.post-admin-menu {
display: inline-flex;
flex-direction: column;
box-sizing: border-box;
background-color: $secondary;
width: auto;
max-width: 320px;
padding: 10px;
border: 1px solid $primary-low;
position: absolute;
text-align: left;
bottom: -2px;
right: 15px;
z-index: z("dropdown");
h3 {
margin-top: 0;
color: $primary;
font-size: $font-0;
}
ul {
list-style: none;
margin: 10px 0 0 0;
}
li {
margin-bottom: 5px;
.d-icon {
width: 14px;
margin-right: 10px;
}
}
}
}
.embedded-posts {
h1,
h2,
h3 {
margin: 10px 0;
}
border: 1px solid $primary-low;
.topic-body {
box-sizing: border-box;
width: calc(100% - 70px); // [100% - .topic-avatar width]
// WARNING: overflow hide is required for quoted / embedded images
// which expect "normal" post width, but expansions are narrower
overflow: hidden;
} // this is covered by .topic-body .regular on a normal post
// but no such class structure exists for an embedded, expanded post
.cooked {
margin-top: 15px;
}
.topic-avatar {
padding-left: 25px;
padding-top: 15px;
}
.collapse-down,
.collapse-up {
position: absolute;
color: $primary-medium;
background: $secondary;
border: 1px solid $primary-low;
padding: 6px 9px 8px;
z-index: 99; // Needs to be higher than topic-avatar
&:hover {
background: $primary-low;
color: $primary;
}
} // bottom means "reply expansion" below a post
&.bottom {
border-top: none;
margin-bottom: 20px;
margin-left: 11px;
&.hidden {
display: block;
opacity: 0;
}
}
&.bottom {
.collapse-up {
transform: translate(-50%, -164%);
}
.row {
padding-bottom: 0.5em;
.topic-avatar,
.topic-body {
border-top: 1px solid $primary-low;
}
}
} // top means "in reply to expansion" above a post
&.top {
border-bottom: none;
.collapse-down {
transform: translate(-50%, 55%);
}
margin-left: 56px;
width: 699px;
.row {
border-bottom: none;
.topic-avatar,
.topic-body {
border-top: 1px solid $primary-low;
}
}
}
&.top.topic-body {
padding: 0;
}
.post-date {
color: dark-light-choose($primary-medium, $secondary-high);
}
.d-icon-arrow-up,
.d-icon-arrow-down {
margin-left: 5px;
}
.reply:first-of-type .row {
border-top: none;
}
.topic-meta-data {
position: relative;
}
.topic-meta-data h5 {
position: absolute;
z-index: z("base");
font-size: $font-down-1;
a {
font-weight: bold;
color: dark-light-choose($primary-low-mid, $secondary-high);
}
}
.arrow {
color: dark-light-choose($primary-medium, $secondary-high);
}
}
.post-action {
.relative-date {
margin-left: 5px;
}
.avatar {
margin-right: 2px;
}
}
.topic-map {
margin: 20px 0 20px 11px;
.map {
.secondary {
text-align: center;
}
li {
float: left;
padding: 7px 10px;
&:last-of-type {
border-right: 0;
}
&:nth-child(3) {
text-align: center;
}
}
a,
.number {
line-height: $line-height-large;
}
.number,
.d-icon {
color: dark-light-choose($primary-high, $secondary-low);
font-size: $font-up-2;
line-height: $line-height-medium;
}
.avatar a {
float: left;
}
.topic-map-post {
margin-top: 6px;
}
}
.avatars,
.links,
.information {
padding: 7px 10px 7px 10px;
color: $primary;
}
.buttons {
float: right;
.btn {
border: 0;
padding: 0 23px;
color: dark-light-choose($primary-medium, $secondary-high);
background: blend-primary-secondary(5%);
border-left: 1px solid $primary-low;
border-top: 1px solid transparent;
&:hover {
color: $primary;
background: $primary-low;
}
&.collapsed {
padding-bottom: 1px;
}
.fa {
margin: 0;
font-size: $font-up-2;
line-height: 52px;
}
}
}
.link-summary .btn {
color: dark-light-choose($primary-medium, $secondary-high);
background: blend-primary-secondary(5%);
width: 100%;
&:hover {
color: $primary;
background: dark-light-diff($primary, $secondary, 90%, -80%);
}
}
}
@mixin topic-footer-button {
margin-bottom: 5px;
margin-right: 10px;
}
#topic-footer-buttons {
padding: 10px 10px 0 0;
float: left;
p {
color: dark-light-choose($primary-medium, $secondary-medium);
}
.btn {
@include topic-footer-button;
.d-icon-bookmark.bookmarked {
color: $tertiary;
}
}
.bookmark.bookmarked .d-icon-bookmark {
color: $tertiary;
}
}
#topic-footer-button {
width: 757px;
}
.suggested-topics {
clear: left;
padding: 20px 0 15px 0;
table {
margin-top: 10px;
}
}
.suggested-topics .topic-statuses .topic-status {
padding: 0;
.d-icon {
font-size: 1em;
}
}
span.post-count {
background: $primary;
color: $secondary;
opacity: 0.8;
}
button.expand-post {
margin-top: 10px;
}
.quote-button.visible {
display: block;
}
iframe {
max-width: 100%;
}
video {
max-height: 500px;
}
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.extra-info-wrapper {
overflow: hidden;
.badge-wrapper,
i,
.topic-link {
-webkit-animation: fadein 0.7s;
animation: fadein 0.7s;
}
.topic-statuses {
.d-icon {
color: $header_primary-medium;
}
.d-icon-envelope {
color: $danger;
}
}
.topic-link {
color: $header_primary;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
/* default docked header CSS for all topics, including those without categories */
.extra-info {
h1 {
margin: 5px 0 0 0;
font-size: $font-up-3;
line-height: $line-height-large;
width: 100%;
}
}
/* override docked header CSS for topics with categories */
.extra-info.two-rows {
h1 {
line-height: $line-height-medium;
margin: 0;
width: 100%;
}
}
.open > .dropdown-menu {
display: block;
}
.btn-group {
position: relative;
}
.dropdown-toggle {
float: left;
position: relative;
}
.deleted {
.topic-body {
background-color: dark-light-diff(
rgba($danger, 0.7),
$secondary,
50%,
-60%
);
}
}
#share-link {
width: 365px;
margin-left: -4px;
}
.post-select {
float: right;
margin-right: 20px;
margin-top: -20px;
}
.deleted-user-avatar {
font-size: $font-up-6;
}
.info-line {
margin: 10px 0;
color: $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 {
.onebox-result {
background-color: $primary-very-low;
}
}
aside {
.quote,
.title,
blockquote,
.onebox,
.onebox-result {
background: $primary-very-low;
border-left: 5px solid $primary-low;
}
aside.quote > blockquote,
aside.quote > .title {
border-left: 0;
}
}
}
// variables are used to calculate the width of .gap
$topic-body-width: 690px;
$topic-body-width-padding: 11px;
$topic-avatar-width: 45px;
.topic-body {
width: calc(#{$topic-body-width} + (#{$topic-body-width-padding} * 2));
float: left;
position: relative;
border-top: 1px solid $primary-low;
padding: 12px 0 0 0;
.topic-meta-data,
.cooked {
padding: 0 $topic-body-width-padding 0.25em $topic-body-width-padding;
}
}
.topic-avatar {
border-top: 1px solid $primary-low;
padding-top: 15px;
width: $topic-avatar-width;
float: left;
z-index: z("base") + 1;
}
.gap {
width: calc(
#{$topic-avatar-width} + #{$topic-body-width} + 2 * #{$topic-body-width-padding}
);
}
/* hide the reply border above the time gap notices */
.time-gap + .topic-post .topic-body,
.time-gap + .topic-post .topic-avatar {
border-top: none;
}
.time-gap + .topic-post .embedded-posts.top {
border-bottom: 1px solid $primary-low;
}
.posts-wrapper {
position: relative;
-webkit-font-smoothing: subpixel-antialiased;
}
.dropdown {
position: relative;
}
.caret {
display: inline-block;
width: 0;
height: 0;
vertical-align: middle;
border-top: 4px solid $primary;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
content: "";
margin-left: 5px;
}
.dropdown-menu {
position: absolute;
bottom: 115%;
left: 0;
z-index: z("dropdown");
display: none;
float: left;
width: 550px;
margin: 1px 0 0;
list-style: none;
background-color: $secondary;
border: 1px solid $primary-low;
box-shadow: shadow("dropdown");
background-clip: padding-box;
span {
font-size: $font-down-1;
color: dark-light-choose($primary-medium, $secondary-medium);
}
span.title {
font-weight: bold;
display: block;
font-size: $font-0;
color: $primary;
}
}
.dropdown-menu a {
display: block;
padding: 9px;
clear: both;
font-weight: normal;
line-height: $line-height-medium;
color: $primary;
transition: all linear 0.15s;
& > div {
margin-left: 26px;
}
}
.dropdown-menu li > a:hover,
.dropdown-menu .active > a,
.dropdown-menu .active > a:hover {
color: $primary;
text-decoration: none;
background-color: $highlight-medium;
}
.dropdown-menu .disabled > a,
.dropdown-menu .disabled > a:hover {
text-decoration: none;
color: $primary;
background-color: $tertiary-low;
cursor: default;
}
.dropdown-menu .icon {
margin-top: 3px;
float: left;
font-size: $font-up-2;
}
.open > .dropdown-menu {
display: block;
clear: both;
}
.selected-posts {
width: 200px;
position: fixed;
z-index: z("dropdown");
box-shadow: shadow("card");
padding: 0.714em;
margin-bottom: 5px;
right: 10px;
@include breakpoint(extra-large, min-width) {
right: auto;
margin-left: 330px;
left: 50%;
}
button {
width: 100%;
margin: 4px auto;
display: inline-block;
text-align: left;
}
&.hidden {
display: none;
}
.controls {
margin-top: 10px;
}
p {
font-size: $font-down-1;
margin: 0 0 10px 0;
}
p.cancel {
margin: 10px 0 0 0;
}
h3 {
font-size: $font-up-4;
color: $primary;
margin-bottom: 5px;
.d-icon {
margin-right: 7px;
}
}
}
a.attachment:before {
display: inline-block;
margin-right: 4px;
// ideally, the SVG used here should be in HTML and reference the SVG sprite
content: svg-uri(
'<svg xmlns="http://www.w3.org/2000/svg" width="14px" height="16px" viewBox="0 0 512 512" fill="#{$tertiary}"><path d="M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"></path></svg>'
);
vertical-align: middle;
}
.topic-meta-data {
align-items: center;
.names {
display: flex;
align-items: center;
}
&:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.post-info {
a {
color: dark-light-choose($primary-medium, $secondary-medium);
}
a.wiki {
color: $wiki;
}
}
}
.who-liked {
margin-top: 20px;
margin-bottom: 0;
width: 100%;
text-align: right;
}
span.highlighted {
background-color: $tertiary-low;
}
.username.new-user a {
color: dark-light-choose($primary-low-mid, $secondary-high);
}
.read-state {
position: absolute;
// We use absolute positioning here because we want it to display in the padding
align-self: center;
color: $tertiary-medium;
right: 0;
font-size: 0.571em;
}
.read-state.read {
opacity: 0;
transition: opacity ease-out 1s;
}
.signup-cta {
width: $topic-body-width;
}
/* Tablet (portrait) ----------- */
@media all and (max-width: 775px) {
.topic-avatar {
width: 45px;
}
.topic-post .reply-to-tab {
right: 15%;
}
.topic-body {
box-sizing: border-box;
width: calc(100% - 47px); //100% - [width of .topic-avatar + 2px]
}
.embedded-posts {
// top means "in reply to expansion" above a post
&.top {
width: calc(100% - 56px); // [100% - margin-left]
}
}
}