Skip to content

Commit

Permalink
fix: 가로 스크롤 클릭 탈출 오류 수정 (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tekiter authored Nov 29, 2023
1 parent 667c67c commit 7b15f78
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/common/HorizontalScroller/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';
import { colors } from '@sopt-makers/colors';
import { forwardRef, ReactNode, useEffect, useRef, useState } from 'react';
import { forwardRef, MouseEvent, ReactNode, useEffect, useRef, useState } from 'react';

interface HorizontalScrollerProps {
className?: string;
Expand Down Expand Up @@ -58,7 +58,9 @@ const HorizontalScroller = forwardRef<HTMLDivElement, HorizontalScrollerProps>(
};
}, []);

function scrollLeft() {
function scrollLeft(e: MouseEvent) {
e.preventDefault();

const scrollWidth = containerRef?.current?.clientWidth ?? 0;

containerRef.current?.scrollBy({
Expand All @@ -67,7 +69,9 @@ const HorizontalScroller = forwardRef<HTMLDivElement, HorizontalScrollerProps>(
});
}

function scrollRight() {
function scrollRight(e: MouseEvent) {
e.preventDefault();

const scrollWidth = containerRef?.current?.clientWidth ?? 0;

containerRef.current?.scrollBy({
Expand Down

0 comments on commit 7b15f78

Please sign in to comment.