-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BYOB-125] Style 및 AppRouter 관련 리팩토링 (#17)
* refactor: style 적용 방식 통일 * refactor: AppRouter 구조에 맞게 수정
- Loading branch information
Showing
26 changed files
with
129 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use client" | ||
|
||
import { Box, styled } from "@mui/material"; | ||
|
||
export const ContainerBox = styled(Box)({ | ||
display: "flex", | ||
flexDirection: "column" | ||
}); | ||
|
||
export const HeaderBox = styled(Box)({ | ||
height: "200px", | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react"; | ||
import { ContainerBox, HeaderBox } from "./StyledComponent"; | ||
|
||
export default function JoinLayout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<ContainerBox> | ||
<HeaderBox> | ||
<h1>JUMO</h1> | ||
<span>당신이 찾던 완벽한 주류모임, 주모</span> | ||
</HeaderBox> | ||
{children} | ||
</ContainerBox> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
38 changes: 14 additions & 24 deletions
38
src/component/MeetingCard.tsx → src/components/MeetingCard/MeetingCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,45 @@ | ||
"use client"; | ||
|
||
import { Avatar, ListItem, ListItemAvatar, ListItemText } from "@mui/material"; | ||
import { Meeting } from "../app/meetings/page"; | ||
import { Avatar, Box, ListItemAvatar, ListItemText } from "@mui/material"; | ||
import { Meeting } from "../../app/meetings/page"; | ||
import { useRef, useState } from "react"; | ||
import useObserver from "@/hook/useObserver"; | ||
import Link from "next/link"; | ||
import useObserver from "@/hooks/useObserver"; | ||
import useLocalStorage from "use-local-storage"; | ||
// import { LazyLoadImage } from "react-lazy-load-image-component"; | ||
import styles from "../style/meetings.module.css"; | ||
import { DescriptionSpan, LinkButton } from "./StyledComponent"; | ||
|
||
const formatDateTime = (datetime: string) => { | ||
return `${datetime.slice(5, 7)}/${datetime.slice(8, 10)}`; | ||
} | ||
|
||
|
||
export default function MeetingCard( | ||
{ meeting }: { key: number, meeting: Meeting} | ||
{ meeting }: { meeting: Meeting} | ||
) { | ||
const [visible, setVisible] = useState(false); | ||
const [scrollY, setScrollY] = useLocalStorage("meeting-list-scroll", 0); | ||
|
||
// IntersectionObserver API 설정: 뷰포트 안에 요소가 들어올 때만 DOM에 마운트 | ||
const target = useRef(null); | ||
const onIntersect = ([entry]: IntersectionObserverEntry[]) => { | ||
return entry.isIntersecting ? setVisible(true) : setVisible(false); | ||
} | ||
const onIntersect = ([entry]: IntersectionObserverEntry[]) => setVisible(entry.isIntersecting); | ||
useObserver({ target, onIntersect, threshold: 0.1 }); | ||
|
||
return ( | ||
<Link | ||
href={`/meetings/${meeting.id}`} | ||
onClick={() => setScrollY(window.scrollY)} | ||
className={styles.container} | ||
> | ||
<ListItem ref={target} className={styles.item}> | ||
<LinkButton ref={target} onClick={() => setScrollY(window.scrollY)} href={`/meetings/${meeting.id}`}> | ||
{visible && ( | ||
<> | ||
<Box style={{display:'flex',alignItems:'center',overflow:'hidden',width:'100%'}}> | ||
<ListItemAvatar> | ||
<Avatar alt="thumbnail" src={meeting.thumbnail} /> | ||
{/* <LazyLoadImage alt="thumbnail" src={meeting.thumbnail} width="40px" height="auto" /> */} | ||
<Avatar alt="thumbnail" src={meeting.thumbnail} slotProps={{img:{loading: "lazy"}}} /> | ||
</ListItemAvatar> | ||
<ListItemText | ||
primary={`${meeting.id}: ${meeting.name}`} | ||
secondary={`${formatDateTime(meeting.meetingAt)} ${meeting.region}`} | ||
primaryTypographyProps={{style:{overflow:'hidden',whiteSpace:'nowrap',textOverflow:'ellipsis'}}} | ||
/> | ||
</> | ||
</Box> | ||
)} | ||
</ListItem> | ||
<span className={styles.description}> | ||
<DescriptionSpan> | ||
{`${meeting.liquors}, 회비 ${meeting.payment}원`} | ||
</span> | ||
</Link> | ||
</DescriptionSpan> | ||
</LinkButton> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { styled } from "@mui/material"; | ||
import emotionStyled from "@emotion/styled"; | ||
import Link from "next/link"; | ||
|
||
|
||
export const LinkButton = styled(Link)({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'flex-start', | ||
margin: '15px 10px', | ||
padding: '5px', | ||
minHeight: "75px", | ||
border: '1px solid', | ||
borderRadius: '5px', | ||
color: 'inherit', | ||
textDecoration:'none', | ||
}) | ||
|
||
export const DescriptionSpan = emotionStyled.span` | ||
padding: 5px 20px; | ||
white-space: normal; | ||
word-break: break-word; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"use client" | ||
|
||
import { Box, styled } from "@mui/material"; | ||
|
||
export const SelectRegionContainer = styled(Box)({ | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
gap: "10px", | ||
padding: "50px 5px", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.