File tree Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,46 @@ section.event {
262262 border : 0 ;
263263}
264264
265+ .scroll-to-top {
266+ position : fixed;
267+ bottom : 50px ;
268+ right : 30px ;
269+ z-index : 10 ;
270+ display : block;
271+ background : var (--color-gray-500 );
272+ border-width : 0 ;
273+ height : 50px ;
274+ width : 50px ;
275+ border-radius : 50% ;
276+ transition : all 0.2s linear, opacity 0.3s ;
277+ cursor : pointer;
278+ opacity : 0 ;
279+ pointer-events : none;
280+ }
281+
282+ .scroll-to-top .is-visible {
283+ opacity : 1 ;
284+ pointer-events : auto;
285+ }
286+
287+ .scroll-to-top : hover {
288+ transform : scale (1.1 );
289+ }
290+
291+ .scroll-to-top ::after {
292+ content : "" ;
293+ position : absolute;
294+ left : 16px ;
295+ z-index : 11 ;
296+ display : block;
297+ width : 15px ;
298+ height : 15px ;
299+ border-top : 4px solid var (--color-gray-100 );
300+ border-left : 4px solid var (--color-gray-100 );
301+ transform : rotate (45deg );
302+ top : 20px ;
303+ }
304+
265305/* Ember data uses styled elements in markdown blocks that conflict with the
266306 default styles for blockquotes (because of ::before block that has an
267307 absolutely positioned quote mark).
Original file line number Diff line number Diff line change 1+ import { modifier } from ' ember-modifier' ;
2+ import { on } from ' @ember/modifier' ;
3+
4+ const showOnScroll = modifier (function showOnScroll (element ) {
5+ function toggleVisibility () {
6+ if (window .scrollY > window .innerHeight ) {
7+ element .classList .add (' is-visible' );
8+ } else {
9+ element .classList .remove (' is-visible' );
10+ }
11+ }
12+
13+ toggleVisibility ();
14+ window .addEventListener (' scroll' , toggleVisibility);
15+
16+ return () => {
17+ window .removeEventListener (' scroll' , toggleVisibility);
18+ };
19+ });
20+
21+ function scrollToTopOfPageOnClick () {
22+ window .scrollTo ({ top: 0 , behavior: ' smooth' });
23+ }
24+
25+ <template >
26+ <button
27+ {{showOnScroll }}
28+ {{on ' click' scrollToTopOfPageOnClick }}
29+ class =' scroll-to-top'
30+ alt =' Scroll to top'
31+ ></button >
32+ </template >
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ export default class ProjectVersionController extends Controller {
1919 @service
2020 project ;
2121
22+ @service
23+ fastboot ;
24+
2225 @service router ;
2326 @service ( 'project' ) projectService ;
2427
Original file line number Diff line number Diff line change 3131 </EsSidebar >
3232 <section class =" content-wrapper" >
3333 {{ outlet }}
34+
35+ {{ #unless this.fastboot.isFastBoot }}
36+ <ScrollToTopButton />
37+ {{ /unless }}
3438 </section >
3539</div >
You can’t perform that action at this time.
0 commit comments