Skip to content

Commit

Permalink
Merge pull request #69 from IT-Cotato/feat/PR-3_sessoin_page
Browse files Browse the repository at this point in the history
Feat/pr 3 sessoin page
  • Loading branch information
WONYOUNG-HC authored Aug 12, 2024
2 parents 115501b + 9b8e13a commit ea2fe72
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function App() {
<Route path="/about" element={<ReadyState />} />
<Route path="/products" element={<ReadyState />} />
<Route path="/cs/*" element={<CSPage />} />
<Route path="/session" element={<Session />} />
<Route path="/session/*" element={<Session />} />
<Route path="/faq" element={<FAQ />} />
<Route path="/signin" element={<Login />} />
<Route path="/findid" element={<FindID />} />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Session/SessionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const Container = styled.div<{ $isActive?: boolean }>`
display: flex;
flex-direction: column;
width: calc(${IMAGE_WIDTH} + (3px * 2));
border: 3px solid
border: 2px solid
${({ $isActive, theme }) =>
$isActive !== false ? theme.colors.primary100_1 : theme.colors.gray30};
border-radius: 0.6rem;
Expand Down
20 changes: 13 additions & 7 deletions src/pages/Session/SessionUploadModalImageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const SessionUploadModalImageInput = ({
}: SessionUploadModalImageInputProps) => {
const [selectedImage, setSelectedImage] = useState<SessionListImageInfo | null>(null);
const [sortedImageList, setSortedImageList] = useState<SessionListImageInfo[]>([]);
const [isImageLoading, setIsImageLoading] = useState(selectedImage?.imageUrl ? true : false);
const [isImageLoading, setIsImageLoading] = useState(true);

const theme = useTheme();

Expand Down Expand Up @@ -293,14 +293,20 @@ const SessionUploadModalImageInput = ({
* If imageList is changed, set sortedImageList and selectedImage
*/
useEffect(() => {
if (imageList.length > 0) {
if (
imageList.length > 0 &&
imageList.some((image, index) => image.imageUrl !== sortedImageList[index]?.imageUrl)
) {
const newImageList = imageSortByOrder(imageList);
if (sortedImageList.length === 0) {
setSelectedImage(imageList.find((image) => image.order === 0) || null);
}

if (imageList.some((image, index) => image.imageUrl !== sortedImageList[index]?.imageUrl)) {
setSortedImageList(imageSortByOrder(imageList));
setSelectedImage(newImageList[0]);
setIsImageLoading(true);
}
setSortedImageList(newImageList);
} else if (imageList.length === 0) {
setSortedImageList([]);
setSelectedImage(null);
setIsImageLoading(false);
}
}, [imageList]);

Expand Down

0 comments on commit ea2fe72

Please sign in to comment.