Commit c7687b68 authored by Robert Knight's avatar Robert Knight

Truncated excerpt design tweaks

 * Increase the expansion speed

 * Make the drop-shadow at the bottom of collapsed annotation bodies
   expand to the full width of the annotation card and be clickable
   to provide an easier-to-hit target for expanding collapsed
   annotations

 * Make the shadow non-clickable when hidden after expansion
parent deeab8b2
.excerpt { @at-root {
transition: max-height .3s ease-in; $expand-duration: .15s;
position: relative;
overflow: hidden;
}
.excerpt__inline-controls { // the truncated body of the <excerpt>
display: block; .excerpt {
position: absolute; transition: max-height $expand-duration ease-in;
right: 0; overflow: hidden;
bottom: 0; }
pointer-events: none;
}
.excerpt__toggle-link { // a container which wraps the <excerpt> and contains the excerpt
pointer-events: auto; // itself plus the shadow at the bottom that can be clicked to expand or
padding-left: 15px; // collapse it
background-image: linear-gradient(to right, transparent 0px, white 12px); .excerpt__container {
} position: relative;
}
.excerpt__toggle-link > a { // inline controls for expanding and collapsing
color: $text-color; // the <excerpt>
font-style: italic; // -------------
font-weight: normal; .excerpt__inline-controls {
} display: block;
position: absolute;
right: 0;
bottom: 0;
pointer-events: none;
}
// a shadow displayed at the bottom of an <excerpt>s with inline controls .excerpt__toggle-link {
// disabled, which provides a hint that the excerpt is collapsed pointer-events: auto;
.excerpt__shadow { padding-left: 15px;
position: absolute; background-image: linear-gradient(to right, transparent 0px, white 12px);
left: 0; }
right: 0;
bottom: 0; .excerpt__toggle-link > a {
height: 20px; color: $text-color;
background-image: linear-gradient(to bottom, font-style: italic;
transparent 0%, rgba(0,0,0,0.10) 90%, rgba(0,0,0,0.15) 100%); font-weight: normal;
transition: opacity .3s linear; }
}
// a shadow displayed at the bottom of an <excerpt>s with inline controls
// disabled, which provides a hint that the excerpt is collapsed
// -------------
// the distance by which the shadow indicating a collapsed
// annotation expands beyond the left/right edges of the card.
// This value is chosen such that the shadow expands to the full width of
// the card
$shadow-h-offset: -12px;
.excerpt__shadow {
position: absolute;
left: $shadow-h-offset;
right: $shadow-h-offset;
bottom: 0;
height: 40px;
background-image: linear-gradient(to bottom,
transparent 50%, rgba(0,0,0,0.08) 95%, rgba(0,0,0,0.13) 100%);
transition: opacity $expand-duration linear;
}
.excerpt__shadow.is-hidden { .excerpt__shadow.is-hidden {
opacity: 0; opacity: 0;
pointer-events: none;
}
} }
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
<div class="u-stretch"></div> <div class="u-stretch"></div>
<a class="u-strong" ng-show="vm.canCollapseBody" <a class="u-strong" ng-show="vm.canCollapseBody"
ng-click="vm.collapseBody = !vm.collapseBody" ng-click="vm.collapseBody = !vm.collapseBody"
ng-title="vm.collapseBody ? 'Show the full annotation text' : 'Show the first few lines only'"
ng-bind="vm.collapseBody ? 'More' : 'Less'"></a> ng-bind="vm.collapseBody ? 'More' : 'Less'"></a>
</div> </div>
<!-- / Tags --> <!-- / Tags -->
......
<div ng-transclude ng-if="!vm.enabled()"></div> <div ng-transclude ng-if="!vm.enabled()"></div>
<div class="excerpt" ng-if="vm.enabled()"> <div class="excerpt__container" ng-if="vm.enabled()">
<div ng-transclude></div> <div class="excerpt">
<div class="excerpt__inline-controls" <div ng-transclude></div>
ng-show="vm.showInlineControls()"> <div class="excerpt__inline-controls"
<span class="excerpt__toggle-link" ng-show="vm.isExpandable()"> ng-show="vm.showInlineControls()">
<a ng-click="vm.toggle()" <span class="excerpt__toggle-link" ng-show="vm.isExpandable()">
title="Show the full excerpt">More</a> <a ng-click="vm.toggle()"
</span> title="Show the full excerpt">More</a>
<span class="excerpt__toggle-link" ng-show="vm.isCollapsible()"> </span>
<a ng-click="vm.toggle()" <span class="excerpt__toggle-link" ng-show="vm.isCollapsible()">
title="Show the first few lines only">Less</a> <a ng-click="vm.toggle()"
</span> title="Show the first few lines only">Less</a>
</span>
</div>
</div> </div>
<div class="excerpt__shadow" <div class="excerpt__shadow"
ng-click="vm.toggle()"
ng-class="{'is-hidden' : !vm.isExpandable()}" ng-class="{'is-hidden' : !vm.isExpandable()}"
ng-if="!vm.inlineControls"></div> ng-if="!vm.inlineControls"
title="Show the full excerpt"></div>
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment