1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 05:30:38 +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:
Toby Zerner
2015-06-24 11:44:53 +09:30
parent b4dcc02520
commit e466dcc626
33 changed files with 538 additions and 292 deletions

View File

@@ -4,23 +4,39 @@
.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;
margin: 0 0 10px;
.minimized & {
pointer-events: none;
}
& > li {
display: inline-block;
margin-right: -4px;
}
& h3 {
margin: 0 0 10px;
margin: 0;
line-height: 1.5em;
&, & input, & a {
@@ -41,6 +57,9 @@
}
}
}
.fa-minus.minimize {
vertical-align: -5px;
}
.composer-controls {
position: absolute;
right: 10px;
@@ -71,27 +90,85 @@
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: absolute;
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 {
padding: 15px 15px 0;
}
.composer-controls {
& li:not(:last-child) {
display: none;
.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
@@ -120,10 +197,6 @@
&.active:not(.full-screen) {
box-shadow: 0 0 0 2px @fl-body-primary-color, 0 2px 6px @fl-shadow-color;
}
&.minimized {
height: 50px;
cursor: pointer;
}
&.full-screen {
position: fixed;
left: 0;
@@ -144,9 +217,6 @@
}
}
.composer-header {
.minimized & {
pointer-events: none;
}
.full-screen & {
margin-bottom: 20px;
}
@@ -172,9 +242,6 @@
display: none;
}
}
.fa-minus.minimize {
vertical-align: -5px;
}
.composer-avatar {
float: left;
.avatar-size(64px);
@@ -191,10 +258,6 @@
}
}
.composer-editor {
.minimized & {
visibility: hidden;
}
.full-screen & textarea {
font-size: 16px;
}

View File

@@ -72,6 +72,11 @@
& .item {
&:not(:last-child) {
border-bottom: 1px solid @fl-body-secondary-color;
@media @phone {
margin: 0 -15px;
padding: 0 15px;
}
}
}
}
@@ -85,6 +90,8 @@
animation-iteration-count: infinite;
}
.fake-text {
display: inline-block;
vertical-align: middle;
background: @fl-body-secondary-color;
height: 12px;
width: 100%;
@@ -94,6 +101,10 @@
.post-header & {
height: 16px;
width: 150px;
@media @phone {
margin-bottom: 0;
}
}
}
@@ -135,6 +146,11 @@
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)}
@@ -143,10 +159,14 @@
.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;
@@ -356,10 +376,13 @@
}
.post-actions {
margin-top: 10px;
margin-bottom: -10px;
opacity: 0;
.transition(opacity 0.2s);
@media @tablet, @desktop, @desktop-hd {
margin-bottom: -10px;
opacity: 0;
}
& > ul {
& > li {
margin-right: 10px;
@@ -377,6 +400,11 @@
padding: 20px 20px 20px 90px;
background: @fl-body-secondary-color;
font-size: 12px;
@media @phone {
margin: 0 -15px;
padding: 20px 15px;
}
}
.post-preview {
@@ -415,8 +443,8 @@
& h3 .badges {
position: absolute;
top: -7px;
left: 5px;
top: -12px;
left: 6px;
width: 32px;
& .badge {
@@ -469,26 +497,39 @@
font-size: 22px;
}
}
.reply-post {
font-size: 15px;
cursor: text;
overflow: hidden;
margin: 50px -20px 0;
border: 2px dashed transparent;
margin-top: 50px;
border: 2px dashed @fl-body-secondary-color;
color: @fl-body-muted-color;
border-radius: 10px;
padding: 20px 20px 20px 110px;
transition: border-color 0.2s;
padding: 20px;
& .post-header {
padding-top: 18px;
margin: 0;
color: inherit;
}
& .avatar {
margin-top: -18px;
}
&:hover {
border-color: @fl-body-secondary-color;
}
@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;
}
}
}

View File

@@ -146,11 +146,13 @@
}
@media @phone {
.discussion-list > ul > li {
padding-right: 45px;
.discussion-list {
margin: 0 -15px;
& .contextual-controls {
display: none;
& > ul > li {
& .contextual-controls {
display: none;
}
}
}
}
@@ -271,8 +273,12 @@
@media @phone {
.discussion-summary {
padding-left: 45px;
padding-right: 45px;
padding-left: 15px + 45px;
padding-right: 15px + 35px;
&:active {
background: @fl-body-secondary-color;
}
& .author {
margin-left: -45px;
@@ -294,9 +300,10 @@
}
& .title {
font-size: 14px;
text-decoration: none !important;
}
& .count {
margin-right: -45px;
margin-right: -35px;
background: @fl-body-control-bg;
color: @fl-body-control-color;
border-radius: @border-radius-base;

View File

@@ -2,14 +2,22 @@
& .dropdown-menu {
padding: 0;
overflow: hidden;
}
& .loading-indicator {
height: 100px;
& .notifications-content {
max-height: 600px;
overflow: auto;
padding-bottom: 10px;
}
}
& .dropdown-toggle .label {
margin-left: 5px;
}
}
.notification-list {
& .loading-indicator {
height: 100px;
}
}
@media @tablet, @desktop, @desktop-hd {
.notifications {
& .dropdown-menu {
@@ -36,26 +44,23 @@
color: #fff;
}
.notifications-header {
padding: 12px 15px;
border-bottom: 1px solid @fl-body-secondary-color;
@media @tablet, @desktop, @desktop-hd {
padding: 12px 15px;
border-bottom: 1px solid @fl-body-secondary-color;
& h4 {
font-size: 12px;
text-transform: uppercase;
font-weight: bold;
margin: 0;
color: @fl-body-muted-color;
& h4 {
font-size: 12px;
text-transform: uppercase;
font-weight: bold;
margin: 0;
color: @fl-body-muted-color;
}
& .btn {
float: right;
margin-top: -5px;
margin-right: -5px;
}
}
& .btn {
float: right;
margin-top: -5px;
margin-right: -5px;
}
}
.notifications-content {
max-height: 600px;
overflow: auto;
padding-bottom: 10px;
}
.no-notifications {
color: @fl-body-muted-color;
@@ -80,7 +85,7 @@
overflow: hidden;
text-overflow: ellipsis;
}
.notifications-list {
.notification-group-list {
list-style: none;
margin: 0;
padding: 0;
@@ -123,14 +128,20 @@
text-transform: uppercase;
}
}
@media @phone {
.notification {
& > a {
padding-left: 60px;
}
& .avatar {
margin-left: -45px;
.avatar-size(32px);
}
.drawer-toggle.unread-notifications {
position: relative;
&:after {
content: ' ';
display: block;
position: absolute;
background: @fl-body-primary-color;
top: 4px;
right: 2px;
width: 14px;
height: 14px;
border-radius: 7px;
border: 2px solid @fl-body-bg;
}
}

View File

@@ -10,7 +10,7 @@
color: #fff;
font-size: 14px;
.drawer-components();
.inverted-components();
& .avatar {
.avatar-size(96px);

View File

@@ -1,5 +1,5 @@
.user-card {
.drawer-components();
.inverted-components();
background-size: 100% 100%;
&, & .container {
@@ -44,6 +44,11 @@
padding-left: 130px;
max-width: 800px;
@media @phone {
padding-left: 0;
text-align: center;
}
& .user-identity {
display: inline;
vertical-align: middle;
@@ -51,16 +56,30 @@
& .user-avatar {
float: left;
margin-left: -130px;
@media @phone {
float: none;
margin: 0 auto 20px;
width: 64px + 8px;
}
}
& .avatar-editor .dropdown-toggle {
margin: 4px;
line-height: 96px;
font-size: 26px;
@media @phone {
line-height: 64px;
}
}
& .avatar {
.avatar-size(96px);
border: 4px solid @fl-body-bg;
.box-shadow(0 2px 6px @fl-shadow-color);
@media @phone {
.avatar-size(64px);
}
}
& .badges {
margin-left: 10px;
@@ -126,6 +145,10 @@
& > li {
margin-bottom: 30px;
padding-left: 32px;
@media @phone {
padding-left: 24px;
}
}
& .activity-icon {
.avatar-size(32px);
@@ -133,6 +156,10 @@
margin-left: -50px;
.box-shadow(0 0 0 3px #fff);
margin-top: -5px;
@media @phone {
margin-left: -42px;
}
}
}
.activity-info {
@@ -213,8 +240,10 @@
right: 0;
bottom: 0;
}
& .dropdown-menu {
left: 35%;
top: 65%;
@media @tablet, @desktop, @desktop-hd {
& .dropdown-menu {
left: 35%;
top: 65%;
}
}
}