mirror of
https://github.com/flarum/core.git
synced 2025-07-25 10:41:24 +02:00
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
This commit is contained in:
@@ -81,59 +81,73 @@
|
||||
}
|
||||
}
|
||||
|
||||
// PHONES
|
||||
@media @phone {
|
||||
.dropdown-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
.dropdown-menu {
|
||||
margin: 0;
|
||||
position: fixed;
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
width: auto !important;
|
||||
bottom: -100vh;
|
||||
top: auto;
|
||||
padding: 0;
|
||||
.dropdown.open {
|
||||
z-index: @zindex-modal;
|
||||
display: block;
|
||||
max-height: 100vh;
|
||||
border-radius: 0;
|
||||
.box-shadow(0 2px 6px @fl-shadow-color);
|
||||
.translate3d(0, 0, 0);
|
||||
visibility: hidden;
|
||||
.transition(~"bottom 0.3s, visibility 0s 0.3s");
|
||||
}
|
||||
.dropdown {
|
||||
& .dropdown-menu {
|
||||
margin: 0;
|
||||
position: fixed;
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
width: auto !important;
|
||||
bottom: 0;
|
||||
top: auto;
|
||||
padding: 0;
|
||||
padding-bottom: 40px !important;
|
||||
display: block;
|
||||
max-height: 70vh;
|
||||
border-radius: 0;
|
||||
.box-shadow(0 2px 6px @fl-shadow-color);
|
||||
visibility: hidden;
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
.translate3d(0, 70vh, 0);
|
||||
.transition-transform(~" 0.3s, visibility 0s 0.3s");
|
||||
|
||||
& > li > a {
|
||||
background: #fff;
|
||||
font-size: 16px;
|
||||
padding: 15px 20px 15px 50px;
|
||||
|
||||
& .icon {
|
||||
& > li > a {
|
||||
background: #fff;
|
||||
font-size: 16px;
|
||||
margin-left: -30px;
|
||||
padding: 15px 20px;
|
||||
|
||||
&.has-icon {
|
||||
padding-left: 50px;
|
||||
}
|
||||
& .icon {
|
||||
font-size: 16px;
|
||||
margin-left: -30px;
|
||||
}
|
||||
&:hover {
|
||||
background: @fl-body-secondary-color;
|
||||
}
|
||||
}
|
||||
& .divider {
|
||||
margin: 0;
|
||||
}
|
||||
& > .active > a {
|
||||
&, &:hover {
|
||||
background: @fl-body-primary-color !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.open& {
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
visibility: visible;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
}
|
||||
& .divider {
|
||||
margin: 0;
|
||||
}
|
||||
& > .active > a {
|
||||
color: #fff !important;
|
||||
}
|
||||
& .dropdown-backdrop {
|
||||
background: fade(@fl-secondary-color, 90%);
|
||||
opacity: 0;
|
||||
.transition(~"opacity 0.3s");
|
||||
.translate3d(0, 0, 0);
|
||||
|
||||
.open & {
|
||||
bottom: 0;
|
||||
visibility: visible;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
}
|
||||
.dropdown-backdrop {
|
||||
background: fade(@fl-body-primary-color, 90%);
|
||||
opacity: 0;
|
||||
.transition(~"opacity 0.3s");
|
||||
|
||||
.open & {
|
||||
opacity: 1;
|
||||
.open& {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@
|
||||
.form-control {
|
||||
.box-shadow(none);
|
||||
border-width: 2px;
|
||||
-webkit-appearance: none;
|
||||
|
||||
&:focus,
|
||||
&.focus {
|
||||
|
@@ -22,14 +22,14 @@ body {
|
||||
|
||||
.toolbar() {
|
||||
background: fade(@fl-hdr-bg, 98%);
|
||||
transform: translateZ(0); // Fix for Chrome bug where a transparent white background is actually gray
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: @zindex-navbar-fixed;
|
||||
border-bottom: 1px solid @fl-body-control-bg;
|
||||
.transition(~"box-shadow 0.2s, left 0.2s");
|
||||
.translate3d(0, 0, 0);
|
||||
.transition(~"box-shadow 0.2s, -webkit-transform 0.2s");
|
||||
|
||||
@media @phone {
|
||||
height: @mobile-header-height;
|
||||
@@ -55,7 +55,7 @@ body {
|
||||
// PHONES: Push the toolbar to the right when the drawer is open.
|
||||
@media @phone {
|
||||
.drawer-open & {
|
||||
left: @drawer-width;
|
||||
.translate3d(@drawer-width, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,29 +67,35 @@ body {
|
||||
.primary-control, .title-control, .back-control {
|
||||
position: fixed;
|
||||
z-index: @zindex-navbar-fixed + 1;
|
||||
top: 5px;
|
||||
top: 0;
|
||||
margin: 0;
|
||||
visibility: visible;
|
||||
.transition(visibility 0s 0.4s);
|
||||
|
||||
& .btn {
|
||||
float: none;
|
||||
background: transparent !important;
|
||||
.box-shadow(~"none !important");
|
||||
height: @mobile-header-height;
|
||||
width: auto;
|
||||
padding: 13px !important;
|
||||
|
||||
&:active {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
.primary-control, .title-control {
|
||||
.drawer-open .global-page & {
|
||||
visibility: hidden;
|
||||
transition-delay: 0s;
|
||||
}
|
||||
}
|
||||
.primary-control {
|
||||
width: auto;
|
||||
right: 5px;
|
||||
.transition(right 0.2s);
|
||||
right: 0;
|
||||
|
||||
.drawer-open .global-page & {
|
||||
right: -@drawer-width;
|
||||
}
|
||||
|
||||
& .dropdown-split {
|
||||
&.dropdown-split {
|
||||
& .btn, & .icon-caret {
|
||||
display: none;
|
||||
}
|
||||
@@ -101,12 +107,10 @@ body {
|
||||
.primary-control, .back-control {
|
||||
& .btn {
|
||||
color: @fl-hdr-control-color !important;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
|
||||
& .icon {
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
font-size: 20px;
|
||||
}
|
||||
& .label {
|
||||
display: none;
|
||||
@@ -118,24 +122,27 @@ body {
|
||||
left: 50%;
|
||||
margin-left: -100px;
|
||||
text-align: center;
|
||||
line-height: 33px;
|
||||
.transition(margin-left 0.2s);
|
||||
|
||||
.drawer-open .global-page & {
|
||||
margin-left: -100px + @drawer-width;
|
||||
}
|
||||
color: @fl-body-muted-color;
|
||||
|
||||
&, & .btn {
|
||||
color: @fl-hdr-color;
|
||||
font-size: 16px;
|
||||
}
|
||||
& .btn {
|
||||
color: @fl-hdr-color;
|
||||
}
|
||||
}
|
||||
h3.title-control, h4.title-control {
|
||||
line-height: 46px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.back-control {
|
||||
left: 5px;
|
||||
.transition(left 0.2s);
|
||||
left: 0;
|
||||
.transition-transform(0.2s);
|
||||
|
||||
.drawer-open .global-page & {
|
||||
left: @drawer-width + 10px;
|
||||
.translate3d(@drawer-width, 0, 0);
|
||||
}
|
||||
|
||||
& .pin {
|
||||
@@ -147,41 +154,34 @@ body {
|
||||
// ------------------------------------
|
||||
// Drawer
|
||||
|
||||
// This is a mixin which styles components (buttons, inputs, etc.) for use in
|
||||
// the drawer. We define it as a mixin because it is also pulled in when
|
||||
// styling a "colored header".
|
||||
.drawer-components() {
|
||||
// This is a mixin which styles components (buttons, inputs, etc.) for use on
|
||||
// dark backgrounds.
|
||||
.inverted-components() {
|
||||
.header-title {
|
||||
&, & a {
|
||||
color: @fl-drawer-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
&, & a, & .btn-link {
|
||||
color: @fl-drawer-control-color;
|
||||
color: #fff;
|
||||
}
|
||||
& .form-control {
|
||||
background: @fl-drawer-control-bg;
|
||||
background: fade(#000, 10%);
|
||||
border: 0;
|
||||
color: @fl-drawer-control-color;
|
||||
.placeholder(@fl-drawer-control-color);
|
||||
color: #fff;
|
||||
.placeholder(fade(#fff, 50%));
|
||||
|
||||
&:focus {
|
||||
background: fadein(@fl-drawer-control-bg, 5%);
|
||||
background: fade(#000, 15%);
|
||||
}
|
||||
}
|
||||
& .search-input {
|
||||
color: @fl-drawer-control-color;
|
||||
}
|
||||
& .btn-default, & .btn-default:hover {
|
||||
background: @fl-drawer-control-bg;
|
||||
color: @fl-drawer-control-color;
|
||||
& .btn-default:not(.btn-naked), & .btn-default:hover {
|
||||
background: fade(#000, 10%);
|
||||
color: #fff;
|
||||
}
|
||||
& .btn-default.active, .open > .dropdown-toggle.btn-default {
|
||||
background: fadein(@fl-drawer-control-bg, 5%);
|
||||
color: @fl-drawer-control-color;
|
||||
}
|
||||
& .btn-naked {
|
||||
background: transparent;
|
||||
background: fade(#000, 15%);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,8 +193,7 @@ body {
|
||||
overflow: hidden;
|
||||
}
|
||||
.global-drawer {
|
||||
background: @fl-drawer-bg;
|
||||
color: @fl-drawer-color;
|
||||
background: @fl-hdr-bg;
|
||||
width: @drawer-width;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
@@ -202,8 +201,11 @@ body {
|
||||
bottom: 0;
|
||||
visibility: hidden;
|
||||
.transition(visibility 0s 0.2s);
|
||||
.box-shadow(inset -6px 0 6px -6px @fl-shadow-color);
|
||||
|
||||
.drawer-components();
|
||||
& when (@fl-colored-hdr = true) {
|
||||
.inverted-components();
|
||||
}
|
||||
|
||||
.drawer-open & {
|
||||
visibility: visible;
|
||||
@@ -279,7 +281,7 @@ body {
|
||||
.clearfix();
|
||||
|
||||
& when (@fl-colored-hdr = true) {
|
||||
.drawer-components();
|
||||
.inverted-components();
|
||||
}
|
||||
|
||||
& .back-button {
|
||||
@@ -333,13 +335,12 @@ body {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 15px;
|
||||
padding-bottom: 50px;
|
||||
margin-top: @mobile-header-height;
|
||||
.box-shadow(0 0 6px @fl-shadow-color);
|
||||
.transition(margin-left 0.2s);
|
||||
.transition-transform(0.2s);
|
||||
|
||||
.drawer-open & {
|
||||
margin-left: @drawer-width;
|
||||
.translate3d(@drawer-width, 0, 0);
|
||||
|
||||
// Disable all interaction with the content when the drawer is open. When
|
||||
// .global-content is touched, the drawer will be closed.
|
||||
|
@@ -83,33 +83,32 @@
|
||||
.modal.fade {
|
||||
opacity: 1;
|
||||
}
|
||||
.modal-backdrop.in {
|
||||
opacity: 0;
|
||||
}
|
||||
.modal-dialog {
|
||||
.modal {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
}
|
||||
.modal-dialog {
|
||||
margin: 0;
|
||||
overflow: auto;
|
||||
|
||||
.modal.fade & {
|
||||
.transition(top 0.3s);
|
||||
top: 100%;
|
||||
.translate(0, 0);
|
||||
&.fade {
|
||||
.transition-transform(0.3s);
|
||||
.translate3d(0, 100vh, 0);
|
||||
}
|
||||
.modal.in & {
|
||||
top: 0;
|
||||
&.in {
|
||||
-webkit-transform: none !important;
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: " ";
|
||||
.toolbar();
|
||||
}
|
||||
}
|
||||
.modal-dialog {
|
||||
margin: 0;
|
||||
-webkit-transform: none !important;
|
||||
transform: none !important;
|
||||
}
|
||||
.modal-content {
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
@@ -121,10 +120,6 @@
|
||||
padding: 0;
|
||||
border: 0;
|
||||
min-height: 0;
|
||||
|
||||
& h3 {
|
||||
line-height: 36px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
.search-box {
|
||||
& input:focus, &.active input, & .search-results {
|
||||
width: 400px;
|
||||
@media @tablet, @desktop, @desktop-hd {
|
||||
.search-box {
|
||||
& input:focus, &.active input, & .search-results {
|
||||
width: 400px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.search-results {
|
||||
|
Reference in New Issue
Block a user