Skip to content

Commit

Permalink
feat:코드리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
ssumanlife committed Nov 4, 2024
1 parent 4f51714 commit 96c41b5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/components/addTravel/FloatingMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ const FloatingMenu = ({ onClick }: FloatingMenuProps) => {
const sections = useSectionsStore((state) => state.sections);
const setOpenSection = useSectionsStore((state) => state.setOpenSection);
const location = useLocation();

const menuHeight = location.pathname === '/add-for-find-guide' ? '260px' : '520px';

return (
<MenuContainer location={location.pathname}>
<MenuContainer menuHeight={menuHeight}>
{location.pathname === '/add-for-find-guide' ? (
<>
<MenuItem>
Expand Down Expand Up @@ -112,11 +115,11 @@ const FloatingMenu = ({ onClick }: FloatingMenuProps) => {

export default FloatingMenu;

const MenuContainer = styled.div<{ location: string }>`
const MenuContainer = styled.div<{ menuHeight: string }>`
position: sticky;
top: 20px;
min-width: 240px;
height: ${({ location }) => (location === '/add-for-find-guide' ? '260px' : '520px')};
height: ${({ menuHeight }) => menuHeight};
padding: 16px;
border: 1px solid #d2d2d2;
border-radius: 8px;
Expand Down
23 changes: 16 additions & 7 deletions src/hooks/useHandleImageUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import useGetImageUrls from '@/hooks/useGetImageUrls';
import { ImageStore } from '@/stores/useImageStore';
import prepareImageUpload from '@/utils/prepareImageUpload';
import { useState } from 'react';
import { useEffect, useState } from 'react';

const useHandleImageUpload = (images: ImageStore) => {
const [enabled, setEnabled] = useState(false);
const formData = new FormData();
const { data: uploadedImages } = useGetImageUrls({ formData, enabled });

useEffect(() => {
return () => {
setEnabled(false);
};
}, []);

const uploadImages = () => {
if (images.thumbnail === '') return;

setEnabled(true);
prepareImageUpload(images, formData);
if (uploadedImages) {
setEnabled(false);
console.log(uploadedImages);
try {
setEnabled(true);
prepareImageUpload(images, formData);
if (uploadedImages) {
setEnabled(false);
console.log(uploadedImages);
}
} catch (error) {
console.warn(error);
}
};

Expand Down

0 comments on commit 96c41b5

Please sign in to comment.