UX: Improving badge page layout

This commit is contained in:
Kris 2018-03-02 12:42:02 -05:00
parent 5833d00739
commit 0ec1dc9237
6 changed files with 109 additions and 53 deletions

View File

@ -37,6 +37,7 @@
{{#if userBadges}} {{#if userBadges}}
<div class="user-badges {{model.slug}}"> <div class="user-badges {{model.slug}}">
{{#load-more selector=".badge-info" action="loadMore"}} {{#load-more selector=".badge-info" action="loadMore"}}
<div class="badges-granted">
{{#each userBadges as |ub|}} {{#each userBadges as |ub|}}
{{#user-info user=ub.user size="medium" class="badge-info" date=ub.granted_at}} {{#user-info user=ub.user size="medium" class="badge-info" date=ub.granted_at}}
<div class="granted-on">{{i18n 'badges.granted_on' date=(inline-date ub.granted_at)}}</div> <div class="granted-on">{{i18n 'badges.granted_on' date=(inline-date ub.granted_at)}}</div>
@ -45,6 +46,7 @@
{{/if}} {{/if}}
{{/user-info}} {{/user-info}}
{{/each}} {{/each}}
</div>
{{/load-more}} {{/load-more}}
{{#unless canLoadMore}} {{#unless canLoadMore}}

View File

@ -5,13 +5,15 @@
<span class='check-display status-checked'>{{d-icon "check"}}</span> <span class='check-display status-checked'>{{d-icon "check"}}</span>
{{/if}} {{/if}}
<div class='badge-contents'> <div class='badge-contents'>
<a href={{url}} class="badge-link">
<div class='badge-icon {{badge.badgeTypeClassName}}'> <div class='badge-icon {{badge.badgeTypeClassName}}'>
{{icon-or-image badge.icon}} {{icon-or-image badge.icon}}
</div> </div>
<div class='badge-info'> <div class='badge-info'>
<div class='badge-info-item'> <div class='badge-info-item'>
<h3><a href={{url}}>{{badge.name}}</a></h3> <h3>{{badge.name}}</h3>
<div class='badge-summary'>{{{summary}}}</div> <div class='badge-summary'>{{{summary}}}</div>
</div> </div>
</div> </div>
</a>
</div> </div>

View File

@ -121,9 +121,10 @@
.badge-card { .badge-card {
position: relative; position: relative;
display: inline-block; display: inline-block;
background-color: $primary-low; background-color: $primary-very-low;
margin-right: 5px; border: 1px solid $primary-low;
margin-bottom: 10px; margin-bottom: 2vh;
transition: box-shadow .25s;
.check-display { .check-display {
position: absolute; position: absolute;
@ -142,17 +143,26 @@
.badge-contents { .badge-contents {
display: flex; display: flex;
flex-direction: row;
min-height: 128px; min-height: 128px;
height: 100%; height: 100%;
.badge-icon { .badge-link {
min-width: 90px;
display: flex; display: flex;
flex: 1 1 auto;
padding: 0 10%;
@media screen and (max-width: 550px) {
padding: 0 5%;
}
}
.badge-icon {
display: flex;
flex: 0 0 auto;
width: 1.23em;
margin-right: 5%;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: $primary-low; font-size: 3.5em;
font-size: 3em;
img { img {
max-width: 80px; max-width: 80px;
@ -174,32 +184,73 @@
.badge-info { .badge-info {
display: flex; display: flex;
flex: 1 1 auto;
align-items: center; align-items: center;
justify-content: center; padding: 1em 1.5em 1em 0;
padding: 15px;
color: $primary; color: $primary;
@media screen and (max-width: 600px) {
padding-right: 0;
}
h3 { h3 {
margin-bottom: 0.4em; margin-bottom: 0.25em;
font-size: $font-up-1;
@media screen and (min-width: 900px) {
font-size: $font-up-2;
} }
} }
} }
} }
.badge-card.medium { &.medium {
width: 350px;
vertical-align: top; vertical-align: top;
flex: 0 0 32%;
margin-right: calc(2% - 3px);
&:nth-of-type(3n+1) {
margin-right: 0;
}
@include small-width {
flex: 0 0 49%;
margin-right: 0;
}
@media screen and (max-width: 550px) {
flex: 0 0 100%;
}
&:hover {
box-shadow: shadow("card");
}
&:active {
box-shadow: none;
} }
@media all and (max-width: 320px) { @media all and (max-width: 320px) {
.badge-card.medium {
width: 100%; width: 100%;
} }
} }
&.large {
.badge-card.large { width: 100%;
width: 750px; @media screen and (min-width: 767px) {
max-width: calc(#{$large-width} / 2);
} }
.badge-contents {
.badge-link {
padding: 0 5%;
width: 90%;
h3 {
font-size: $font-up-3;
}
}
}
}
}
.badges-granted {
display: flex;
flex-wrap: wrap;
@media screen and (max-width: $small-width) {
justify-content: space-between;
}
}
.badge-groups { .badge-groups {
margin: 20px 0; margin: 20px 0;
@ -211,6 +262,16 @@
.badge-grouping { .badge-grouping {
margin-bottom: 1.5em; margin-bottom: 1.5em;
display: flex;
flex-wrap: wrap;
@include small-width {
justify-content: space-between;
}
.title {
width: 100%;
font-size: $font-up-1;
}
} }
.show-badge-details { .show-badge-details {
@ -222,7 +283,6 @@
.badge-grant-info { .badge-grant-info {
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 1em;
&.hidden { &.hidden {
display: none; display: none;
} }

View File

@ -13,7 +13,9 @@
float: left; float: left;
width: 70%; width: 70%;
padding-left: 5px; padding-left: 5px;
@media screen and (max-width: 600px) {
font-size: $font-down-1; font-size: $font-down-1;
}
.name-line { .name-line {
white-space: nowrap; white-space: nowrap;
@ -57,6 +59,7 @@
&.badge-info { &.badge-info {
min-height: 80px; min-height: 80px;
min-width: 250px;
.granted-on { .granted-on {
color: dark-light-choose($primary-medium, $secondary-medium); color: dark-light-choose($primary-medium, $secondary-medium);

View File

@ -1,14 +1,17 @@
.user-info { .user-info {
&.medium { &.medium {
width: 480px; flex: 0 0 32%;
margin-right: 2%;
display: flex;
&:nth-of-type(3n) {
margin-right: 0;
}
@media screen and (max-width: $small-width) {
flex: 0 0 48%;
margin-right: 0;
}
.user-image { .user-image {
width: 55px; width: 55px;
} }
.user-detail {
width: 380px;
}
} }
} }

View File

@ -1,14 +0,0 @@
// Mobile styles for "user-info" component
.user-info {
&.medium {
width: 300px;
.user-image {
width: auto;
}
.user-detail {
width: 240px;
}
}
}