Skip to content

Commit

Permalink
fix: scrollToTop 버튼 위치 정정
Browse files Browse the repository at this point in the history
  • Loading branch information
koremp committed Mar 18, 2024
1 parent 697d84f commit 4db31eb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/ScrollToTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ function useWindowWidth() {

const ScrollToTop = (props: { link: string }) => {
const width = useWindowWidth();
const [right, setRight] = useState(25);

useEffect(() => {
setRight((Number(width.width) - 360) / 2 + 25)
console.log(right)
}, [width, right])

return (
<Link href={props.link}>
Expand All @@ -41,12 +47,12 @@ const ScrollToTop = (props: { link: string }) => {
height={52}
style={
{
height: "auto",
position: "fixed",
bottom: "150px",
border: "1px solid #ffffff",
borderRadius: "26px",
right: `${(Number(width) - 360) / 2 + 25}px`
left: "auto",
right: `${right}px`,
bottom: "150px",
}
}
/>
Expand Down

0 comments on commit 4db31eb

Please sign in to comment.