Skip to content

Commit

Permalink
[FE] Refactor/#481 개발 서버 QA 후 발생한 이슈 해결 (#486)
Browse files Browse the repository at this point in the history
* refactor: 추가하기 모달 위치 왼쪽 하단으로 고정되는 이슈 해결

* refactor: 1078px 이하에서 이미지 숨겨지던 오류 해결

* refactor: 핀 내 지도에 저장 기능 에러 해결
  • Loading branch information
GC-Park authored Sep 21, 2023
1 parent ec5ae7f commit 7d9906d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
2 changes: 1 addition & 1 deletion frontend/src/apiHooks/usePost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ContentTypeType } from '../types/Api';

interface fetchPostProps {
url: string;
payload: {};
payload?: {} | FormData;
contentType?: ContentTypeType;
errorMessage: string;
onSuccess?: () => void;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/apis/postApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import withTokenRefresh from './utils';

export const postApi = async (
url: string,
payload: {} | FormData,
payload?: {} | FormData,
contentType?: ContentTypeType,
) => {
return await withTokenRefresh(async () => {
Expand Down
29 changes: 24 additions & 5 deletions frontend/src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import ReactDOM from 'react-dom';
import { css, keyframes, styled } from 'styled-components';
import { ModalContext } from '../../context/ModalContext';
import Box from '../common/Box';
type ModalWrapperType = Omit<
ModalProps,
'modalKey' | 'children' | '$dimmedColor'
>;

type ModalWrapperType = Omit<ModalProps, 'children' | '$dimmedColor'>;

interface ModalProps {
modalKey: string;
Expand Down Expand Up @@ -61,6 +59,7 @@ const Modal = ({
onClick={onClickDimmedCloseModal}
/>
<Wrapper
modalKey={modalKey}
position={position}
width={width}
height={height}
Expand Down Expand Up @@ -113,15 +112,34 @@ const getModalPosition = (position: 'center' | 'bottom') => {
return css`
position: fixed;
left: 50%;
transform: translate(-50%, 0);
bottom: 0;
transform: translate(-50%, 0);
border-top-left-radius: ${({ theme }) => theme.radius.medium};
border-top-right-radius: ${({ theme }) => theme.radius.medium};
animation: ${translateModalAnimation} 0.3s ease 1;
`;
}
};

const addMapOrPinPostion = (modalKey: string) => {
console.log(modalKey);
if (modalKey === 'addMapOrPin') {
return css`
width: 252px;
height: inherit;
transform: translate(-50%, -30%);
`;
} else {
return css`
width: 100%;
height: inherit;
transform: translate(-50%, 0);
`;
}
};

const Wrapper = styled.div<ModalWrapperType>`
width: ${({ width }) => width || '400px'};
height: ${({ height }) => height || '400px'};
Expand All @@ -134,6 +152,7 @@ const Wrapper = styled.div<ModalWrapperType>`
${getModalPosition('bottom')};
width: 100%;
height: inherit;
${({ modalKey }) => addMapOrPinPostion(modalKey)};
}
`;

Expand Down
12 changes: 1 addition & 11 deletions frontend/src/components/ModalMyTopicList/addToMyTopicList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,10 @@ const AddToMyTopicList = ({ pin }: any) => {
}, []);

const addPinToTopic = async (topic: OnClickDesignatedProps) => {
const url = '/pins';
const payload = {
topicId: topic.topicId,
name: pin.name,
description: pin.description,
address: pin.address,
latitude: pin.latitude,
longitude: pin.longitude,
legalDongCode: '',
};
const url = `/topics/${topic.topicId}/copy?pinIds=${pin.id}`;

fetchPost({
url,
payload,
errorMessage:
'내 지도에 핀 추가를 실패하였습니다. 잠시 후 다시 시도해주세요.',
onSuccess: () => {
Expand Down
25 changes: 13 additions & 12 deletions frontend/src/components/PinImageContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ const PinImageContainer = ({ images }: PinImageContainerProps) => {
return (
<>
<FilmList>
{images.map((image, index) => (
<ImageWrapper>
<Image
key={index}
height="100px"
width="100px"
src={image.imageUrl}
/>
</ImageWrapper>
))}
{images.map(
(image, index) =>
index < 3 && (
<ImageWrapper>
<Image
key={index}
height="100px"
width="100px"
src={image.imageUrl}
/>
</ImageWrapper>
),
)}
</FilmList>
</>
);
Expand All @@ -29,8 +32,6 @@ const FilmList = styled.ul`
width: 330px;
display: flex;
flex-direction: row;
overflow: hidden;
`;

const ImageWrapper = styled.li`
Expand Down

0 comments on commit 7d9906d

Please sign in to comment.