Skip to content

Commit

Permalink
fix: swiper overflow visible 선택적으로 줄수 있게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-yn committed Mar 6, 2024
1 parent 9d3f936 commit 2f37805
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/OceanSwiper/OceanSwiper.css.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { globalStyle, style } from '@vanilla-extract/css';

export const swiperSelector = style({});
export const swiperVisibleSelector = style({});

globalStyle(`${swiperSelector} > .swiper`, {
globalStyle(`${swiperVisibleSelector} > .swiper`, {
overflow: 'visible !important',
});
11 changes: 9 additions & 2 deletions src/components/OceanSwiper/OceanSwiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Tag from '@/composable/Tag/Tag';
import { customEvents } from '@/const/customEvents';
import { getStaticContext } from '@/utils/context/StaticContext';
import { ContextValueOceanSwiper } from './OceanSwiper.context';
import { swiperSelector } from './OceanSwiper.css';
import { swiperVisibleSelector } from './OceanSwiper.css';

interface Props {
className?: string;
Expand Down Expand Up @@ -72,6 +72,7 @@ interface MainProps extends SwiperOptions {
prevButton?: React.ReactNode;
nextButton?: React.ReactNode;
isSwipeAble?: boolean;
overflowVisible?: boolean;
}

const Main = ({
Expand All @@ -81,13 +82,19 @@ const Main = ({
prevButton,
nextButton,
isSwipeAble = true,
overflowVisible = true,
...rest
}: PropsWithChildren<MainProps>) => {
const { swiperWrapperRef } = getStaticContext(ContextValueOceanSwiper);
const swiperRef = useRef<SwiperRef | null>(null);

return (
<div className={classNames(className, swiperSelector)}>
<div
className={classNames(
className,
overflowVisible === true && swiperVisibleSelector,
)}
>
<Swiper
{...rest}
ref={swiperRef}
Expand Down

0 comments on commit 2f37805

Please sign in to comment.