framework/less/forum/composer.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

332 lines
5.8 KiB
Plaintext

// ------------------------------------
// Composer
.composer {
pointer-events: auto;
.box-shadow(0 2px 6px @fl-shadow-color);
&.minimized {
height: 50px;
cursor: pointer;
}
}
.composer-controls {
list-style: none;
padding: 0;
margin: 0;
}
.composer-content {
.minimized & {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.composer-header {
list-style: none;
padding: 1px 0;
margin: 0 0 10px;
.minimized & {
pointer-events: none;
}
& > li {
display: inline-block;
margin-right: -4px;
}
& h3 {
margin: 0;
line-height: 1.5em;
&, & input, & a {
color: @fl-secondary-color;
font-size: 16px;
font-weight: normal;
}
& input {
&, &[disabled], &:focus {
background: none;
border: 0;
padding: 0 20px 0 0;
height: auto;
}
}
& .fa {
font-size: 14px;
}
}
}
.fa-minus.minimize {
vertical-align: -5px;
}
.composer-controls {
position: absolute;
right: 10px;
top: 10px;
z-index: 1;
& li {
display: inline-block;
}
.minimized & {
top: 7px;
}
}
.composer-loading {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.9);
opacity: 0;
pointer-events: none;
border-radius: @border-radius-base @border-radius-base 0 0;
.transition(opacity 0.2s);
&.active {
opacity: 1;
pointer-events: auto;
}
}
.composer-editor {
.minimized & {
visibility: hidden;
}
}
// On phones, show the composer as a fixed overlay that covers the whole
// screen. The controls are hidden (except for the 'x', which is the back-
// control), and the avatar hidden.
@media @phone {
.composer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: @zindex-composer;
background: @fl-body-bg;
&:not(.minimized) {
top: 0;
height: 100vh !important;
padding-top: @mobile-header-height;
&:before {
content: " ";
.toolbar();
opacity: 0;
.visible& {
opacity: 1;
}
}
& .composer-controls {
z-index: @zindex-navbar-fixed + 1;
& li:not(.back-control) {
display: none;
}
}
}
}
.composer-content {
.minimized & {
margin-right: 50px;
}
}
.composer-avatar {
display: none;
}
.composer-header {
margin-bottom: 0;
& > li {
display: block;
border-bottom: 1px solid @fl-body-secondary-color;
padding: 10px 15px;
.minimized & {
border-bottom: 0;
padding: 15px;
}
}
& h3 {
&, & a, & input {
font-size: 14px;
}
& input {
width: 100% !important;
}
}
}
.composer-editor {
padding: 15px;
& textarea {
height: 50vh !important;
}
}
}
// On larger screens, show the composer as a window at the bottom of the
// content area. We hide a lot of the content when the composer is minimized.
@media @tablet, @desktop, @desktop-hd {
.composer-container {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: @zindex-composer;
pointer-events: none;
.transition(left 0.2s);
}
.composer {
border-radius: @border-radius-base @border-radius-base 0 0;
background: fade(@fl-body-bg, 95%);
transform: translateZ(0); // Fix for Chrome bug where a transparent white background is actually gray
position: relative;
height: 300px;
.transition(~"background 0.2s, box-shadow 0.2s");
&.active, &.full-screen {
background: @fl-body-bg;
}
&.active:not(.full-screen) {
box-shadow: 0 0 0 2px @fl-body-primary-color, 0 2px 6px @fl-shadow-color;
}
&.full-screen {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: 0;
height: auto;
}
}
.composer-controls {
.full-screen & .btn {
padding: 13px;
& .fa {
font-size: 20px;
}
}
}
.composer-header {
.full-screen & {
margin-bottom: 20px;
}
}
.composer-content {
padding: 20px 20px 0;
.minimized & {
padding: 12px 20px;
}
.full-screen & {
max-width: 900px;
margin: 0 auto;
padding: 30px;
}
}
.composer-handle {
height: 15px;
margin-bottom: -17px;
position: relative;
.minimized &, .full-screen & {
display: none;
}
}
.composer-avatar {
float: left;
.avatar-size(64px);
.minimized &, .full-screen & {
display: none;
}
}
.composer-body {
margin-left: 90px;
.minimized &, .full-screen & {
margin-left: 0;
}
}
.composer-editor {
.full-screen & textarea {
font-size: 16px;
}
}
}
@media @desktop, @desktop-hd {
.composer:not(.full-screen) {
margin-left: -20px;
margin-right: 180px;
.index-page & {
margin-left: 205px;
margin-right: -20px;
}
}
}
@media @desktop-hd {
.has-pane.pane-pinned .composer-container {
left: @index-pane-width;
}
}
// ------------------------------------
// Text Editor
.text-editor {
& textarea {
border-radius: 0;
padding: 0;
border: 0;
resize: none;
color: @fl-body-color;
font-size: 14px;
line-height: 1.7;
&, &:focus, &[disabled] {
background: none;
border: 0;
}
}
}
.text-editor-controls {
margin: 0;
padding: 15px 0;
list-style-type: none;
& li {
display: inline-block;
}
}
@media @tablet, @desktop, @desktop-hd {
.text-editor-controls {
margin: 0 -20px 0 -110px;
padding: 15px 20px;
border-top: 1px solid @fl-body-secondary-color;
.full-screen & {
margin: 0;
border-top: 0;
padding: 20px 0;
}
& .btn-primary {
padding-left: 20px;
padding-right: 20px;
}
}
}