Skip to content

Commit

Permalink
scrollToTop 버튼 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
nestiank committed Mar 17, 2024
1 parent 9b97470 commit 8bd099b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions public/images/top.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import PurpleButton from "@/components/PurpleButton";
import WhiteButton from "@/components/WhiteButton";
import WhiteButtonTitle from "@/components/WhiteButtonTitle";
import MiniStar from "@/components/MiniStar";
import Ask from '@/components/Ask'
import Ask from '@/components/Ask';
import ScrollToTop from '@/components/ScrollToTop';

export default function Home() {
return (
Expand Down Expand Up @@ -148,6 +149,12 @@ export default function Home() {
<p>Contact Us</p>
<p>[email protected]</p>
</div>

<div className="scroll">
<ScrollToTop
link={"#main"}
/>
</div>
</main>
);
}
27 changes: 27 additions & 0 deletions src/components/ScrollToTop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import Image from 'next/image';
import Link from 'next/link';

const ScrollToTop = (props: {link: string}) => {
return (
<Link href={props.link}>
<Image
src="/images/top.svg"
alt="scrollToTop"
width={0}
height={0}
style={
{
width: "50px",
height: "auto",
position: "fixed",
bottom: "150px",
right: "25px"
}
}
/>
</Link>
)
}

export default ScrollToTop;

0 comments on commit 8bd099b

Please sign in to comment.