File tree Expand file tree Collapse file tree 4 files changed +82
-0
lines changed Expand file tree Collapse file tree 4 files changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,48 @@ table td {
335335 .content {
336336 margin-top : var (--spacing-4 );
337337 }
338+
339+ .scroll-to-top {
340+ position : fixed;
341+ bottom : 50px ;
342+ right : 30px ;
343+ z-index : 10 ;
344+ display : block;
345+ background : var (--color-gray-500 );
346+ border-width : 0 ;
347+ height : 50px ;
348+ width : 50px ;
349+ border-radius : 50% ;
350+ transition :
351+ all 0.2s linear,
352+ opacity 0.3s ;
353+ cursor : pointer;
354+ opacity : 0 ;
355+ pointer-events : none;
356+ }
357+
358+ .scroll-to-top .is-visible {
359+ opacity : 1 ;
360+ pointer-events : auto;
361+ }
362+
363+ .scroll-to-top : hover {
364+ transform : scale (1.1 );
365+ }
366+
367+ .scroll-to-top ::after {
368+ content : "" ;
369+ position : absolute;
370+ left : 16px ;
371+ z-index : 11 ;
372+ display : block;
373+ width : 15px ;
374+ height : 15px ;
375+ border-top : 4px solid var (--color-gray-100 );
376+ border-left : 4px solid var (--color-gray-100 );
377+ transform : rotate (45deg );
378+ top : 20px ;
379+ }
338380}
339381
340382@media (width <= 450px) {
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+ type =' button'
28+ {{showOnScroll }}
29+ {{on ' click' scrollToTopOfPageOnClick }}
30+ class =' scroll-to-top'
31+ alt =' Scroll to top'
32+ ></button >
33+ </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