Skip to content

Commit ba8bccf

Browse files
committed
refactor(#128): 좌우 클릭 영역 variants로 관리
1 parent 928fc74 commit ba8bccf

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src/app/story/[id]/_components/StoryDetailContent/StoryDetailContent.css.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { style } from "@vanilla-extract/css";
2+
import { recipe } from "@vanilla-extract/recipes";
23

34
import { radius, semantic } from "@/styles";
45

@@ -37,24 +38,24 @@ export const storyImageArea = style({
3738
height: "100%",
3839
});
3940

40-
export const leftZone = style({
41-
position: "absolute",
42-
top: 0,
43-
left: 0,
44-
width: "50%",
45-
height: "100%",
46-
cursor: "pointer",
47-
zIndex: 5,
48-
});
49-
50-
export const rightZone = style({
51-
position: "absolute",
52-
top: 0,
53-
right: 0,
54-
width: "50%",
55-
height: "100%",
56-
cursor: "pointer",
57-
zIndex: 5,
41+
export const zone = recipe({
42+
base: {
43+
position: "absolute",
44+
top: 0,
45+
width: "50%",
46+
height: "100%",
47+
cursor: "pointer",
48+
zIndex: 5,
49+
},
50+
variants: {
51+
side: {
52+
left: { left: 0 },
53+
right: { right: 0 },
54+
},
55+
},
56+
defaultVariants: {
57+
side: "left",
58+
},
5859
});
5960

6061
export const informationContent = style({

src/app/story/[id]/_components/StoryDetailContent/StoryDetailContent.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,14 @@ export const StoryDetailContent = ({ storyId }: StoryDetailContentProps) => {
8181
</div>
8282

8383
<div className={styles.storyImageArea}>
84-
<button className={styles.leftZone} onClick={handlePrevStory} />
85-
<button className={styles.rightZone} onClick={handleNextStory} />
84+
<button
85+
className={styles.zone({ side: "left" })}
86+
onClick={handlePrevStory}
87+
/>
88+
<button
89+
className={styles.zone({ side: "right" })}
90+
onClick={handleNextStory}
91+
/>
8692
<Image
8793
src={story.imageUrl}
8894
alt={`${story.storeName} 스토리`}

0 commit comments

Comments
 (0)