Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] Refactor/#513 지도 생성 및 핀 생성 페이지 지도 위치 조정 #514

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ const MediaWrapper = styled.section<{
overflow: hidden;
@media (max-width: 1076px) {
flex-direction: ${({ $isAddPage, $layoutWidth }) => {
if ($isAddPage) return 'column';
if ($layoutWidth === '372px') return 'column-reverse';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모두 하단으로 배치 시켰군요 굿 !

}};
}
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/pages/NewPin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const NewPin = () => {
const [topic, setTopic] = useState<any>(null);
const [selectedTopic, setSelectedTopic] = useState<any>(null);
const [showedImages, setShowedImages] = useState<string[]>([]);
const { clickedMarker } = useContext(MarkerContext);
const { clickedMarker, markers, removeMarkers, removeInfowindows } =
useContext(MarkerContext);
const { clickedCoordinate, setClickedCoordinate } =
useContext(CoordinatesContext);
const { formValues, errorMessages, onChangeInput } =
Expand Down Expand Up @@ -228,6 +229,11 @@ const NewPin = () => {
}
};

if (!topicId && markers && markers.length > 0) {
removeMarkers();
removeInfowindows();
}
Comment on lines +232 to +235
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드가 방금 말씀하신 핀 생성하기 갔을 때 핀 찍혀있는거 초기화 하는 부분이군요 ! 굿~!


getTopicId();
}, []);

Expand Down Expand Up @@ -307,7 +313,6 @@ const NewPin = () => {
onChangeInput={onChangeInput}
tabIndex={1}
errorMessage={errorMessages.name}
autoFocus
maxLength={50}
/>

Expand Down Expand Up @@ -364,6 +369,7 @@ const NewPin = () => {
추가하기
</Button>
</Flex>
<Space size={7} />
</Wrapper>
</form>

Expand Down
30 changes: 27 additions & 3 deletions frontend/src/pages/NewTopic.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useState } from 'react';
import { useContext, useEffect, useState } from 'react';
import Text from '../components/common/Text';
import Flex from '../components/common/Flex';
import Space from '../components/common/Space';
Expand All @@ -18,6 +18,7 @@ import usePost from '../apiHooks/usePost';
import AuthorityRadioContainer from '../components/AuthorityRadioContainer';
import styled from 'styled-components';
import useCompressImage from '../hooks/useCompressImage';
import { MarkerContext } from '../context/MarkerContext';

type NewTopicFormValuesType = Omit<NewTopicFormProps, 'topics'>;

Expand All @@ -36,6 +37,8 @@ const NewTopic = () => {
image: '',
});
const { compressImage } = useCompressImage();
const { markers, removeMarkers, removeInfowindows } =
useContext(MarkerContext);

const [isPrivate, setIsPrivate] = useState(false); // 혼자 볼 지도 : 같이 볼 지도
const [isAllPermissioned, setIsAllPermissioned] = useState(true); // 모두 : 지정 인원
Expand Down Expand Up @@ -137,10 +140,17 @@ const NewTopic = () => {
setShowImage(URL.createObjectURL(file));
};

useEffect(() => {
if (!pulledPinIds && markers && markers.length > 0) {
removeMarkers();
removeInfowindows();
}
Comment on lines +144 to +147
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing~

}, []);

return (
<form onSubmit={onSubmit}>
<Space size={4} />
<Flex
<Wrapper
width={`calc(${width} - ${LAYOUT_PADDING})`}
$flexDirection="column"
>
Expand Down Expand Up @@ -237,11 +247,25 @@ const NewTopic = () => {
생성하기
</Button>
</Flex>
</Flex>
<Space size={7} />
</Wrapper>
</form>
);
};

const Wrapper = styled(Flex)`
margin: 0 auto;

@media (max-width: 1076px) {
width: calc(50vw - 40px);
}

@media (max-width: 744px) {
width: ${({ width }) => width};
margin: 0 auto;
}
`;

const ImageInputLabel = styled.label`
height: 40px;
padding: 10px 10px;
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/pages/SeeTogetherTopics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ const Wrapper = styled.section<{ width: '372px' | '100vw' }>`
height: 100%;
display: flex;
flex-direction: column;

margin: 0 auto;
`;

const WrapperWhenEmpty = styled.section<{ width: '372px' | '100vw' }>`
Expand All @@ -139,11 +141,13 @@ const WrapperWhenEmpty = styled.section<{ width: '372px' | '100vw' }>`
flex-direction: column;
justify-content: center;
align-items: center;

margin: 0 auto;
`;

const ButtonsWrapper = styled.div`
display: flex;
justify-content: center;
justify-content: end;
align-items: center;
`;

Expand Down