Skip to content

Commit 6da303b

Browse files
author
exoego
committed
Fix #1454: Remove "Expand" button to improve usability.
Also, "Read" button works without JS code.
1 parent 12d9212 commit 6da303b

File tree

3 files changed

+30
-59
lines changed

3 files changed

+30
-59
lines changed

_overviews/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ permalink: /overviews/:title.html
3535
</div>
3636
</div>
3737
<div class="card-footer">
38-
<div class="expand-btn"><i class="fa fa-plus" aria-hidden="true"></i> Expand</div>
39-
<div class="go-btn" style="display: none;" href="{{ overview.url }}"><i class="fa fa-arrow-right" aria-hidden="true"></i> Read</div>
38+
<a class="go-btn" href="{{ overview.url }}"><i class="fa fa-arrow-right" aria-hidden="true"></i> Read</a>
4039
</div>
4140
</div>
4241
{% endfor %}

_sass/layout/overviews.scss

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
flex: 0 1 calc(50% - 1em);
2020
@include bp(medium) {
2121
flex: 0 1 calc(100% - 0.5em);
22-
}
22+
}
2323
}
2424
}
2525

@@ -47,12 +47,10 @@
4747
position: relative;
4848
flex: 0 1 calc(50% - 1em);
4949
margin-bottom: 2em;
50-
transition: max-height .3s ease-out;
5150
text-decoration: none;
5251
border-radius: 2px;
5352
box-shadow: 0 1px 3px 0 rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 2px 1px -1px rgba(0,0,0,.12);
5453
background: #fff;
55-
max-height: 400px;
5654
overflow: hidden;
5755

5856
@include bp(medium) {
@@ -76,7 +74,7 @@
7674
.card-content {
7775
padding: 20px;
7876
padding-top: 0px;
79-
padding-bottom: 0px;
77+
padding-bottom: 60px;
8078
}
8179

8280
h2 {
@@ -160,25 +158,23 @@
160158
position: absolute;
161159
bottom: 0;
162160
width: 100%;
163-
padding: 20px;
164-
height: 66px;
165-
background: #fff;
166-
border-top: 1px solid lighten($base-font-color-light, 35%);
167161

168-
&:hover {
169-
cursor: pointer;
170-
background: $brand-primary;
171-
.expand-btn,
172-
.go-btn {
173-
color: #fff;
174-
}
175-
}
176-
177-
.expand-btn,
178162
.go-btn {
179-
color: lighten($base-font-color-light, 15%);
163+
display: block;
164+
padding: 20px;
165+
height: 66px;
166+
background: #fff;
167+
border-top: 1px solid lighten($base-font-color-light, 35%);
168+
color: lighten($base-font-color-light, 10%);
180169
font-weight: $font-regular;
181170
font-size: $font-regular;
171+
text-decoration: none;
172+
173+
&:hover {
174+
cursor: pointer;
175+
background: $brand-primary;
176+
color: #fff;
177+
}
182178
}
183179
}
184180
}

resources/js/functions.js

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -133,30 +133,6 @@ $(document).ready(function() {
133133

134134
return false;
135135
};
136-
137-
$('.white-card').each(function(index) {
138-
if (!$(this).hasOverflow()) {
139-
$(this).find(".expand-btn").hide();
140-
$(this).find(".go-btn").show();
141-
}
142-
});
143-
144-
$(".card-footer").click(function() {
145-
// if we clicked on the expand button, expand the box
146-
if ($(this).find(".expand-btn").is(':visible')) {
147-
148-
// height mangling becasue flexbox align-self: self-end; doesn't work :(
149-
$(this).parent().css('max-height', 'none');
150-
var cardWrapHeight = $(this).parent().find(".card-wrap").outerHeight();
151-
var cardFooterHeight = $(this).outerHeight()
152-
$(this).parent().outerHeight(cardWrapHeight + cardFooterHeight);
153-
154-
$(this).find(".expand-btn").hide();
155-
$(this).find(".go-btn").show();
156-
} else {
157-
window.location.href = $(this).find(".go-btn").attr("href");
158-
}
159-
});
160136
});
161137

162138

@@ -491,18 +467,18 @@ $('#filter-glossary-terms').focus();
491467

492468

493469
//Footer scroll to top button
494-
$(document).ready(function(){
495-
$(window).scroll(function(){
496-
if ($(this).scrollTop() > 100) {
497-
$('#scroll-to-top-btn').fadeIn();
498-
} else {
499-
$('#scroll-to-top-btn').fadeOut();
500-
}
501-
});
502-
$('#scroll-to-top-btn').click(function(){
503-
$("html, body").animate({ scrollTop: 0 }, 600);
504-
return false;
505-
});
470+
$(document).ready(function(){
471+
$(window).scroll(function(){
472+
if ($(this).scrollTop() > 100) {
473+
$('#scroll-to-top-btn').fadeIn();
474+
} else {
475+
$('#scroll-to-top-btn').fadeOut();
476+
}
477+
});
478+
$('#scroll-to-top-btn').click(function(){
479+
$("html, body").animate({ scrollTop: 0 }, 600);
480+
return false;
481+
});
506482
});
507483

508484
//Contributors widget
@@ -514,7 +490,7 @@ $(document).ready(function () {
514490
* - some files aren't prefixed with underscore, see rootFiles
515491
* - some files are placed in _overviews but rendered to its folder, see overviewsFolders
516492
*/
517-
493+
518494
let rootFiles = ['getting-started', 'learn', 'glossary'];
519495
let overviewsFolders = ['FAQ', 'cheatsheets', 'collections', 'compiler-options',
520496
'core', 'jdk-compatibility', 'macros', 'parallel-collections',
@@ -534,7 +510,7 @@ $(document).ready(function () {
534510
} else {
535511
thisPageUrl = '_' + thisPageUrl + '.md';
536512
}
537-
513+
538514
let url = githubApiUrl + '?path=' + thisPageUrl;
539515
$.get(url, function (data, status) {
540516
if(!data || data.length < 1) {

0 commit comments

Comments
 (0)