framework/less/forum/discussion.less
Toby Zerner e466dcc626 Significantly improve mobile UX
Most of #137 done.

- Use FastClick to make everything feel more responsive
- Use transforms for animations to make them silky smooth
- Style the drawer the same as the header to keep things simple
- Revert to fixed composer, but allow it to be minimised
- Add a separate notifications page for mobile so it’s easy to go back
- Add indicator to the menu button when there are unread notifications
- Close the drawer when navigating away
- Make dropdowns/modals scrollable
- Many other mobile tweaks and bug fixes

Didn’t take much care to keep CSS clean, due to #103
2015-06-24 11:44:53 +09:30

653 lines
11 KiB
Plaintext

// ------------------------------------
// Hero
.discussion-hero {
& .badges {
margin-right: 5px;
}
& .discussion-hero-items {
padding: 0;
margin: 0;
list-style: none;
& > li {
display: inline-block;
}
& .block-item {
display: block;
}
}
}
.discussion-title {
display: inline;
vertical-align: middle;
}
// ------------------------------------
// Sidebar
.discussion-nav {
& > ul {
padding: 0;
margin: 0;
list-style: none;
}
}
@media @tablet, @desktop, @desktop-hd {
.discussion-nav {
float: right;
&, & > ul {
width: 150px;
}
& > ul {
position: fixed;
margin-top: 30px;
& > li {
margin-bottom: 10px;
}
}
& .btn-group, & .btn {
width: 100%;
}
& .btn-group:not(.item-count-1) {
& .btn {
width: 77%;
}
& .dropdown-toggle {
width: 22%;
}
}
}
}
// ------------------------------------
// Stream
.discussion-posts {
margin-top: 10px;
& .item {
&:not(:last-child) {
border-bottom: 1px solid @fl-body-secondary-color;
@media @phone {
margin: 0 -15px;
padding: 0 15px;
}
}
}
}
@keyframes blink {
0% {opacity: 0.5}
50% {opacity: 1}
100% {opacity: 0.5}
}
.loading-post {
animation: blink 1s linear;
animation-iteration-count: infinite;
}
.fake-text {
display: inline-block;
vertical-align: middle;
background: @fl-body-secondary-color;
height: 12px;
width: 100%;
margin-bottom: 20px;
border-radius: @border-radius-base;
.post-header & {
height: 16px;
width: 150px;
@media @phone {
margin-bottom: 0;
}
}
}
@media @tablet, @desktop, @desktop-hd {
.discussion-posts {
margin-right: 200px;
}
}
// ------------------------------------
// Posts
.post {
padding: 30px 0;
transition: 0.2s box-shadow, top 0.2s, opacity 0.2s;
position: relative;
top: 0;
&.editing {
top: 5px;
opacity: 0.2;
}
& .contextual-controls {
float: right;
margin-top: -8px;
margin-left: 10px;
}
}
.item.highlight .post {
&:before {
content: "";
position: absolute;
left: -30px;
top: -5px;
bottom: -5px;
width: 5px;
border-radius: @border-radius-base;
background: @fl-primary-color;
}
}
@-webkit-keyframes pulsate {
0% {-webkit-transform: scale(1)}
50% {-webkit-transform: scale(1.02)}
100% {-webkit-transform: scale(1)}
}
@keyframes pulsate {
0% {transform: scale(1)}
50% {transform: scale(1.02)}
100% {transform: scale(1)}
}
.item.pulsate {
animation: pulsate 1s ease-in-out;
animation-iteration-count: infinite;
-webkit-animation: pulsate 1s ease-in-out;
-webkit-animation-iteration-count: infinite;
}
.item.flash {
animation: pulsate 0.2s ease-in-out;
animation-iteration-count: 1;
-webkit-animation: pulsate 0.2s ease-in-out;
-webkit-animation-iteration-count: 1;
}
.post-header {
margin-bottom: 10px;
color: @fl-body-muted-color;
&, & a {
color: @fl-body-muted-color;
}
& > ul {
list-style-type: none;
padding: 0;
margin: 0;
& > li {
display: inline;
margin-right: 10px;
}
}
& .post-user {
margin: 0;
display: inline;
font-weight: normal;
position: relative;
& h3 {
display: inline;
}
& h3, & h3 a {
color: @fl-body-heading-color;
font-weight: bold;
font-size: 15px;
}
& h3 .badges {
text-align: right;
white-space: nowrap;
& .badge {
margin-left: -15px;
position: relative;
}
}
& .user-card {
position: absolute;
top: -10px;
left: -100px;
z-index: @zindex-popover;
.transition(~"opacity 0.2s, transform 0.2s");
transform: scale(0.95);
transform-origin: left top;
&.in {
transform: scale(1);
}
}
}
}
.post-body {
font-size: 14px;
line-height: 1.7;
position: relative;
& p, & ul, & ol, & blockquote {
margin-bottom: 1em;
}
& a {
border-bottom: 1px solid @fl-body-secondary-color;
font-weight: 600;
&:hover, &:focus, &:active {
text-decoration: none;
border-color: @link-hover-color;
}
}
& blockquote {
font-size: inherit;
border: 0;
background: @fl-body-control-bg;
color: @fl-body-control-color;
border-radius: @border-radius-base;
padding: 10px 20px;
border-top: 2px dotted @fl-body-bg;
border-bottom: 2px dotted @fl-body-bg;
}
& pre {
border: 0;
padding: 15px;
background: #f3f3f3;
color: #666;
font-size: 90%;
}
& h1 {
font-size: 160%;
}
& h2 {
font-size: 120%;
font-weight: bold;
}
& h3 {
font-size: 100%;
font-weight: bold;
text-transform: uppercase;
}
& h4, & h5, & h6 {
font-size: 100%;
font-weight: bold;
}
& img {
max-width: 100%;
}
}
.post.is-hidden {
& .post-header, & .post-header a, & .post-user h3, & .post-user h3 a {
color: @fl-body-muted-more-color;
}
& .post-body, & .post-footer, & h3 .avatar, & .post-header .badges {
position: absolute;
visibility: hidden;
opacity: 0;
margin-top: -5px;
.transition(~"margin-top 0.2s, opacity 0.2s");
}
&.reveal-content {
& .post-body, & .post-footer, & h3 .avatar, & .post-header .badges {
position: static;
visibility: visible;
opacity: 0.5;
margin-top: 0;
}
}
& .post-header .btn-more {
background: #eee;
color: @fl-body-muted-more-color;
}
}
.post-meta {
width: 400px;
padding: 10px;
color: @fl-body-muted-color;
& .number {
color: @fl-body-color;
font-weight: bold;
}
& .time {
margin-left: 5px;
}
& .permalink {
margin-top: 10px;
}
& a.permalink {
display: block;
overflow: hidden;
text-overflow: ellipsis;
}
}
.post-icon {
float: left;
}
.event-post {
&, & a {
color: @fl-body-muted-color;
}
& a {
font-weight: bold;
}
}
.event-post-info {
font-size: 15px;
}
.discussion-renamed-post {
& .old-title, & .new-title {
font-weight: normal;
font-style: italic;
}
}
.post-footer, .post-actions {
& > ul {
list-style-type: none;
padding: 0;
margin: 0;
}
&, & a {
color: @fl-body-muted-color;
}
& a {
display: inline-block;
& .icon {
display: none;
}
}
}
.post-footer {
& > ul {
& > li {
margin-bottom: 5px;
}
}
& .fa {
font-size: 14px;
margin-right: 5px;
}
}
.post-actions {
margin-top: 10px;
.transition(opacity 0.2s);
@media @tablet, @desktop, @desktop-hd {
margin-bottom: -10px;
opacity: 0;
}
& > ul {
& > li {
margin-right: 10px;
display: inline-block;
}
}
.post:hover & {
opacity: 1;
}
}
.time-gap {
text-transform: uppercase;
font-weight: bold;
color: @fl-body-muted-color;
padding: 20px 20px 20px 90px;
background: @fl-body-secondary-color;
font-size: 12px;
@media @phone {
margin: 0 -15px;
padding: 20px 15px;
}
}
.post-preview {
color: @fl-body-muted-color;
padding-left: 50px;
line-height: 1.7em;
& .avatar {
float: left;
margin-left: -50px;
.avatar-size(32px);
}
& .username {
color: @fl-body-color;
font-weight: bold;
margin-right: 5px;
}
& time {
margin-right: 5px;
text-transform: uppercase;
font-size: 11px;
font-weight: 600;
}
}
@media @phone {
.post-header {
& .avatar {
.avatar-size(32px);
vertical-align: middle;
margin-right: 5px;
}
}
.post-user {
position: relative;
& h3 .badges {
position: absolute;
top: -12px;
left: 6px;
width: 32px;
& .badge {
.badge-size(20px);
margin-left: -13px;
}
}
}
.event-post {
padding-left: 30px;
}
.post-icon {
font-size: 18px;
margin-left: -30px;
margin-top: 2px;
}
}
@media @tablet, @desktop, @desktop-hd {
.post {
padding-left: 90px;
& .contextual-controls {
opacity: 0;
transition: opacity 0.2s;
}
&:hover .contextual-controls, & .contextual-controls.open {
opacity: 1;
}
}
.post-header {
& .avatar {
margin-left: -90px;
float: left;
.avatar-size(64px);
}
}
.post-user {
& h3 .badges {
float: left;
margin-left: -85px;
margin-top: -3px;
width: 64px;
}
}
.post-icon {
text-align: right;
margin-left: -90px;
width: 64px;
font-size: 22px;
}
}
.reply-post {
font-size: 15px;
cursor: text;
overflow: hidden;
margin-top: 50px;
border: 2px dashed @fl-body-secondary-color;
color: @fl-body-muted-color;
border-radius: 10px;
padding: 20px;
& .post-header {
margin: 0;
color: inherit;
}
}
@media @tablet, @desktop, @desktop-hd {
.reply-post {
margin-left: -20px;
margin-right: -20px;
padding-left: 110px;
border-color: transparent;
transition: border-color 0.2s;
& .post-header {
padding-top: 18px;
}
& .avatar {
margin-top: -18px;
}
&:hover {
border-color: @fl-body-secondary-color;
}
}
}
// ------------------------------------
// Scrubber
.scrubber {
& a {
margin-left: -5px;
color: @fl-body-muted-color;
& .fa {
font-size: 14px;
margin-right: 2px;
}
&:hover, &:focus {
text-decoration: none;
color: @link-hover-color;
}
}
}
.scrubber-scrollbar {
margin: 8px 0 8px 3px;
height: 300px;
min-height: 50px; // JavaScript sets a max-height
position: relative;
}
.scrubber-before, .scrubber-after {
border-left: 1px solid @fl-body-secondary-color;
}
.scrubber-unread {
position: absolute;
border-left: 1px solid lighten(@fl-body-muted-color, 10%);
width: 100%;
background-image: linear-gradient(to right, @fl-body-secondary-color, fade(@fl-body-secondary-color, 0) 10px, fade(@fl-body-secondary-color, 0));
display: flex;
align-items: center;
color: @fl-body-muted-color;
text-transform: uppercase;
font-size: 11px;
font-weight: bold;
padding-left: 13px;
}
.scrubber-slider {
position: relative;
z-index: 1;
background: @fl-body-bg;
width: 100%;
padding: 5px 0;
}
.scrubber-handle {
height: 100%;
width: 5px;
background: @fl-body-primary-color;
border-radius: 4px;
float: left;
margin-left: -2px;
transition: background 0.2s;
.disabled & {
background: @fl-body-secondary-color;
}
}
.scrubber-info {
height: (2em * @line-height-base);
margin-top: (-1em * @line-height-base);
position: absolute;
top: 50%;
width: 100%;
left: 15px;
& strong {
display: block;
}
& .description {
color: @fl-body-muted-color;
}
}
.scrubber-highlights {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
list-style-type: none;
pointer-events: none;
}
.scrubber-highlights li {
position: absolute;
right: -6px;
background: #fc0;
height: 8px;
width: 13px;
border-radius: 4px;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
opacity: 0.99;
}
@media @phone {
.stream-scrubber {
& .dropdown-toggle {
font-size: 14px;
}
& .dropdown-menu {
padding: 30px;
font-size: 14px;
}
}
.scrubber-scrollbar {
height: 40vh !important;
max-height: none !important;
}
}
@media @tablet, @desktop, @desktop-hd {
.stream-scrubber {
margin: 30px 0 0 0;
.expand-dropdown();
}
}