File tree Expand file tree Collapse file tree 5 files changed +365
-9
lines changed Expand file tree Collapse file tree 5 files changed +365
-9
lines changed Original file line number Diff line number Diff line change 1+ # This configuration file was automatically generated by Gitpod.
2+ # Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3+ # and commit this file to your remote git repository to share the goodness with others.
4+
5+ # Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6+
7+ tasks :
8+ - init : yarn install && yarn run build
9+ command : yarn run start
10+
11+
Original file line number Diff line number Diff line change 2020 },
2121 "dependencies" : {
2222 "@badrap/bar-of-progress" : " ^0.2.2" ,
23+ "@fortawesome/fontawesome-svg-core" : " ^6.3.0" ,
24+ "@fortawesome/free-regular-svg-icons" : " ^6.3.0" ,
25+ "@fortawesome/free-solid-svg-icons" : " ^6.3.0" ,
26+ "@fortawesome/react-fontawesome" : " ^0.2.0" ,
2327 "@headlessui/react" : " ^1.7.7" ,
2428 "@heroicons/react" : " ^2.0.13" ,
2529 "@mdx-js/loader" : " ^2.2.1" ,
2832 "@types/node" : " 18.15.5" ,
2933 "@types/react" : " 18.0.28" ,
3034 "@types/react-dom" : " 18.0.11" ,
35+ "@types/styled-components" : " ^5.1.26" ,
3136 "axios" : " ^1.2.2" ,
3237 "eslint" : " 8.36.0" ,
3338 "eslint-config-next" : " 13.2.4" ,
4651 "remark-html" : " ^15.0.1" ,
4752 "remark-parse" : " ^10.0.1" ,
4853 "sharp" : " ^0.31.3" ,
54+ "styled-components" : " ^5.3.9" ,
4955 "typescript" : " 5.0.2" ,
5056 "unified" : " ^10.1.2" ,
5157 "unist-util-map" : " ^3.1.3"
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import GradientBG from '@utilities/GradientBg';
44import Logo from '@utilities/Logo' ;
55import StarUs from '@utilities/StarUs' ;
66import colors from 'tailwindcss/colors' ;
7+ import GoToTop from '../topbutton/GoToTop' ;
78import FooterList from './FooterList' ;
89import Slogun from './Slogun' ;
910
@@ -35,6 +36,7 @@ export default function Footer() {
3536 < FooterList />
3637 </ div >
3738 </ Container >
39+ < GoToTop />
3840 </ footer >
3941 ) ;
4042}
Original file line number Diff line number Diff line change 1+ import { faChevronUp } from '@fortawesome/free-solid-svg-icons' ;
2+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
3+ import { FC , useEffect , useState } from 'react' ;
4+ import styled from 'styled-components' ;
5+
6+ const GoToTop : FC = ( ) => {
7+ const [ isVisible , setIsVisible ] = useState ( false )
8+ const GoToBtn = ( ) => {
9+ window . scrollTo ( { top : 0 , left : 0 , behavior : 'smooth' } )
10+ }
11+
12+
13+ const listenToScroll = ( ) => {
14+ const downScroll = document . body . scrollTop || document . documentElement . scrollTop
15+ const heightToHidden = 250 ;
16+ if ( downScroll > heightToHidden ) {
17+ setIsVisible ( true )
18+ } else {
19+ setIsVisible ( false )
20+ }
21+ }
22+
23+ useEffect ( ( ) => {
24+ window . addEventListener ( 'scroll' , listenToScroll )
25+ } , [ ] )
26+
27+ return (
28+
29+ < Wrapper >
30+ { isVisible && (
31+ < div className = 'top-btn' onClick = { GoToBtn } >
32+ < FontAwesomeIcon icon = { faChevronUp } />
33+ </ div >
34+ ) }
35+ </ Wrapper >
36+ ) ;
37+ } ;
38+
39+ const Wrapper = styled . section `
40+ display: flex;
41+ justify-content: center;
42+ align-items: center;
43+
44+ .top-btn{
45+ font-size: 1.5rem;
46+ font-weight: bold;
47+ width: 3rem;
48+ height: 3rem;
49+ color: #fff;
50+ background-color: #DC4A78;
51+ border-radius: 50%;
52+ position: fixed;
53+ bottom: 3rem;
54+ right: 5rem;
55+ z-index: 999;
56+ display: flex;
57+ justify-content: center;
58+ align-items: center;
59+ cursor: pointer;
60+
61+ }
62+
63+ @media screen and (max-width:750px) {
64+ .top-btn{
65+ bottom: 1rem;
66+ right: 1rem;
67+ }
68+ }
69+ ` ;
70+ export default GoToTop ;
You can’t perform that action at this time.
0 commit comments