UX: Improve user profile header layout on mobile

This commit is contained in:
Kris 2019-03-20 14:56:34 -04:00
parent 56b4ee43d3
commit 88a3b89990
6 changed files with 163 additions and 157 deletions

View File

@ -36,10 +36,9 @@
{{/if}} {{/if}}
{{/unless}} {{/unless}}
<div class='profile-image'></div>
<div class='details'> <div class='details'>
<div class='primary'> <div class='primary'>
{{user-profile-avatar user=model}} {{user-profile-avatar user=model tagName=""}}
<section class='controls'> <section class='controls'>
<ul> <ul>
{{#if model.can_send_private_message_to_user}} {{#if model.can_send_private_message_to_user}}
@ -69,6 +68,7 @@
<li><a href={{model.adminPath}} class="btn btn-default">{{d-icon "wrench"}}{{i18n 'admin.user.show_admin_profile'}}</a></li> <li><a href={{model.adminPath}} class="btn btn-default">{{d-icon "wrench"}}{{i18n 'admin.user.show_admin_profile'}}</a></li>
{{/if}} {{/if}}
{{plugin-outlet name="user-profile-controls" {{plugin-outlet name="user-profile-controls"
tagName=""
connectorTagName="li" connectorTagName="li"
args=(hash model=model)}} args=(hash model=model)}}
@ -89,6 +89,7 @@
</section> </section>
<div class="primary-textual"> <div class="primary-textual">
<div class="user-profile-names">
<h1 class="{{if nameFirst "full-name" "username"}}">{{if nameFirst model.name (format-username model.username)}} {{user-status model currentUser=currentUser}}</h1> <h1 class="{{if nameFirst "full-name" "username"}}">{{if nameFirst model.name (format-username model.username)}} {{user-status model currentUser=currentUser}}</h1>
<h2 class="{{if nameFirst "username" "full-name"}}">{{#if nameFirst}}{{model.username}}{{else}}{{model.name}}{{/if}}</h2> <h2 class="{{if nameFirst "username" "full-name"}}">{{#if nameFirst}}{{model.username}}{{else}}{{model.name}}{{/if}}</h2>
{{#if model.staged}} {{#if model.staged}}
@ -98,15 +99,18 @@
<h3>{{model.title}}</h3> <h3>{{model.title}}</h3>
{{/if}} {{/if}}
{{plugin-outlet name="user-post-names" args=(hash model=model)}} {{plugin-outlet name="user-post-names" args=(hash model=model)}}
</div>
<h3 class="location-and-website"> <h3 class="location-and-website">
{{#if model.location}}{{d-icon "map-marker-alt"}} {{model.location}}{{/if}} {{#if model.location}}<div class="user-profile-location">{{d-icon "map-marker-alt"}} {{model.location}}</div>{{/if}}
{{#if model.website_name}} {{#if model.website_name}}
<div class="user-profile-website">
{{d-icon "globe"}} {{d-icon "globe"}}
{{#if linkWebsite}} {{#if linkWebsite}}
<a href={{model.website}} rel={{unless removeNoFollow 'nofollow noopener'}} target="_blank">{{model.website_name}}</a> <a href={{model.website}} rel={{unless removeNoFollow 'nofollow noopener'}} target="_blank">{{model.website_name}}</a>
{{else}} {{else}}
<span title={{model.website}}>{{model.website_name}}</span> <span title={{model.website}}>{{model.website_name}}</span>
{{/if}} {{/if}}
</div>
{{/if}} {{/if}}
{{plugin-outlet name="user-location-and-website" args=(hash model=model)}} {{plugin-outlet name="user-location-and-website" args=(hash model=model)}}
</h3> </h3>

View File

@ -199,8 +199,8 @@
font-size: $font-up-1; font-size: $font-up-1;
margin-top: 4px; margin-top: 4px;
} }
h3,
h3 { h3.location-and-website {
display: none; display: none;
} }
} }

View File

@ -11,6 +11,8 @@ $base-space: 4px;
// Strip units if 0 // Strip units if 0
$size: $size * $base-space; $size: $size * $base-space;
$size: $size / ($size * 0 + 1); $size: $size / ($size * 0 + 1);
} @else if ($size == auto) {
$size: auto;
} @else { } @else {
$size: $size * $base-space; $size: $size * $base-space;
} }

View File

@ -149,7 +149,6 @@
.details { .details {
padding: 0 0 4px 0; padding: 0 0 4px 0;
margin-top: -200px;
transition: margin 0.15s linear; transition: margin 0.15s linear;
img.avatar { img.avatar {
@ -164,10 +163,14 @@
text-decoration: underline; text-decoration: underline;
} }
.location-and-website { .location-and-website {
display: flex;
max-width: 100%; max-width: 100%;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
.user-profile-location {
margin-right: 1em;
}
} }
} }
@ -184,6 +187,7 @@
&.has-background { &.has-background {
.details { .details {
padding: 15px 15px 4px 15px; padding: 15px 15px 4px 15px;
margin-top: 240px;
} }
} }
@ -221,6 +225,7 @@
.details { .details {
padding: 0 0 2px 0; padding: 0 0 2px 0;
margin-top: 0;
border-bottom: 1px solid $primary-low; border-bottom: 1px solid $primary-low;
} }

View File

@ -0,0 +1,7 @@
.show-badge-details {
margin-bottom: 1em;
.badge-grant-info {
display: none;
}
}

View File

@ -1,79 +1,33 @@
// Mobile styles for "/user" section // Mobile styles for "/user" section
.user-right {
&,
> .user-stream {
> .alert:first-child {
margin-top: 20px;
}
}
}
.user-main { .user-main {
margin-top: 10px; margin-top: s(3);
table.group-members {
width: 100%;
p {
max-width: 600px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
th {
text-align: right;
}
td {
padding: 0.5em;
border-bottom: 1px solid $primary-low;
img {
margin-right: 10px;
}
span.text {
float: right;
color: $primary;
}
}
.user-info {
width: 245px;
}
}
.user-content { .user-content {
background-color: $secondary;
box-sizing: border-box; box-sizing: border-box;
margin-top: 10px; background-color: $secondary;
margin-top: s(3);
.btn.right {
float: right;
}
table { table {
width: 100%; width: 100%;
margin-top: 10px; margin-top: s(3);
} }
} }
.about { .about {
background: dark-light-diff($primary, $secondary, 0%, -75%) center; margin-bottom: 0;
margin-bottom: 10px;
color: $secondary; color: $secondary;
&.no-background {
.profile-image {
display: none;
}
}
.secondary { .secondary {
margin-bottom: s(3);
dl { dl {
padding: 5px 0; padding: s(2) 0;
} }
} }
.details { .details {
padding: 15px 5px 5px 5px; background: $secondary;
h1 { h1 {
margin: 0;
line-height: $line-height-small; line-height: $line-height-small;
} }
@ -81,32 +35,82 @@
line-height: $line-height-medium; line-height: $line-height-medium;
} }
.user-profile-avatar {
.avatar-flair {
right: 2px;
}
display: block;
float: none;
margin: s(2 auto);
img.avatar {
float: none;
}
}
.user-profile-names {
text-align: center;
}
.location-and-website {
display: flex;
flex-wrap: wrap;
justify-content: center;
font-size: $font-0;
.d-icon {
width: 0.8em;
height: 0.8em;
margin-right: 0.25em;
}
a {
text-decoration: underline;
}
}
.user-profile-location {
margin-right: 1em;
}
.user-profile-location,
.user-profile-website {
justify-content: center;
display: flex;
align-items: center;
}
}
.primary { .primary {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
color: $primary; color: $primary;
.avatar { .avatar {
margin: 0 5px 10px 5px; margin: 0 0 s(3);
} }
.primary-textual { .primary-textual {
flex: 1 1 40%; flex: 1 1 100%;
padding-left: 5px;
word-break: break-word; word-break: break-word;
a[href] { margin: 0;
color: $primary;
}
} }
.bio { .bio {
color: $primary; color: $primary;
margin: 0 auto s(2);
max-width: 700px; max-width: 700px;
text-align: center;
} }
} }
.user-profile-avatar .avatar-flair { &.has-background {
right: 2px; background-size: contain;
background-position: top center;
background-repeat: no-repeat;
.user-profile-avatar {
margin-top: s(-24);
}
.details {
margin-top: 200px;
} }
} }
@ -120,17 +124,17 @@
display: flex; display: flex;
flex: 1 1 auto; flex: 1 1 auto;
flex-wrap: wrap; flex-wrap: wrap;
} margin-left: -1em;
li,
li { > span {
display: flex; display: flex;
flex: 1 1 auto; flex: 1 1 45%;
margin: 0 5px; margin-left: 1em;
button,
a {
width: 100%;
}
} }
span {
flex: 0 1 100%;
margin: 0 5px;
} }
.user-profile-controls-outlet { .user-profile-controls-outlet {
@ -145,22 +149,6 @@
min-width: 120px; min-width: 120px;
} }
} }
&.collapsed-info {
.details {
.primary {
.primary-textual {
margin: 0 10px 5px 0;
}
.avatar {
margin: 0 5px 10px 5px;
}
}
}
.user-profile-avatar .avatar-flair {
bottom: 12px;
}
}
} }
.user-field { .user-field {
@ -172,13 +160,31 @@
} }
} }
.profile-image { .user-main .collapsed-info.about.has-background {
height: 25px; background-image: none !important; // todo: make changes to behavior to remove this
width: 100%; .details {
margin-top: 0;
}
} }
.has-background .details { .user-main .collapsed-info.about .details {
margin-top: 200px; display: flex;
.user-profile-avatar {
margin: 0;
flex: 0 0 auto;
align-self: flex-start;
}
.primary .primary-textual {
flex: 1 0 80%;
margin: 0;
}
.user-profile-names {
text-align: left;
}
.controls {
margin: s(2) 0 s(3);
border-bottom: 1px solid $primary-low;
}
} }
.form-horizontal .control-group.category { .form-horizontal .control-group.category {
@ -201,7 +207,6 @@
} }
} }
// mobile fixups for badges
.badge-card.medium { .badge-card.medium {
width: 100%; width: 100%;
} }
@ -210,40 +215,13 @@
margin-bottom: 2em; margin-bottom: 2em;
} }
.show-badge-details {
margin-bottom: 1em;
.badge-grant-info {
display: none;
}
}
.user-preferences { .user-preferences {
.instructions { .instructions {
margin-top: 5px; margin-top: s(1);
}
.category-controls {
padding-top: 8px;
} }
.controls-dropdown { .controls-dropdown {
margin-top: 10px; margin-bottom: s(4);
margin-bottom: 15px;
select {
width: 280px;
}
}
.save-button {
width: 100%;
overflow: auto;
max-width: 200px;
button {
display: block;
}
} }
.delete-account { .delete-account {
@ -261,10 +239,20 @@
} }
} }
.desktop-notifications button {
float: none;
}
.apps .controls button { .apps .controls button {
float: right; float: right;
} }
} }
.staff-counters {
margin-bottom: s(4);
}
.user-right {
&,
> .user-stream {
> .alert:first-child {
margin-top: 20px;
}
}
}