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/#145 UI 조정 및 머지 후 자잘한 오류 수정 #183

Merged
merged 23 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b32b076
fix: 지도를 클릭하여 핀 추가 시 주소 정보가 입력되지 않던 오류 수정
semnil5202 Aug 2, 2023
67a12a2
refactor: 핀 미리보기 상세내용을 3줄까지만 보여주고 ellipsis 하도록 변경
semnil5202 Aug 2, 2023
1fcf652
refactor: PinDetail 페이지 및 PinPreview space 수정
semnil5202 Aug 2, 2023
8f02f35
refactor: 전반적인 space 수정 및 임시 토픽 생성자명 수정
semnil5202 Aug 2, 2023
9f14101
refactor: 토픽카드 띠 어둡게 처리하여 가독성 개선
semnil5202 Aug 2, 2023
60eca62
design: 태그 컴포넌트 크기 및 글자크기 조정
semnil5202 Aug 2, 2023
c243db9
refactor: 확인 버튼 우측으로 이동 및 기본 이미지 삽입
semnil5202 Aug 2, 2023
a109094
refactor: 핀 수정하기 페이지 저장 버튼 우측으로 이동
semnil5202 Aug 2, 2023
30a93f7
feat: 각 첫 input 태그에 autoFocus 기능 추가
semnil5202 Aug 2, 2023
c01527b
refactor: 핀 주소 입력시 keyDown 이벤트를 감지하여 검색창 띄울 수 있도록 변경
semnil5202 Aug 2, 2023
4ffa90f
refactor: tabIndex 적용하여 우측 확인버튼 선택 편리성 고려
semnil5202 Aug 2, 2023
f73bed1
refactor: 토픽 공유 기능 추가 및 불필요한 코드 제거
semnil5202 Aug 2, 2023
1927776
refactor: 불필요한 import 제거
semnil5202 Aug 2, 2023
34dd1bf
refactor: 토픽 추가하기 버튼 포지션 조정
semnil5202 Aug 2, 2023
f9fcb8b
refactor: 토픽 카드 그림자 추가 및 띠 투명도 조절
semnil5202 Aug 2, 2023
f368f46
rename: Tag 디렉토리 위치 변경
semnil5202 Aug 2, 2023
f37bf23
refactor: 링크 복사 alert 메세지 수정
semnil5202 Aug 2, 2023
928f36f
design: 불필요한 코드 제거
semnil5202 Aug 2, 2023
7b7cd2c
design: 피그마 시안과 맞지 않는 부분 수정
semnil5202 Aug 2, 2023
9931b2c
fix: 같이보기 취소 시에 체크 박스가 해제되지 않던 오류 수정
semnil5202 Aug 2, 2023
9546e50
refactor: 사용하지 않는 함수 제거 및 멘트 수정
semnil5202 Aug 2, 2023
f1182f6
design: 누락된 height 값 추가 및 클릭 영역 확대
semnil5202 Aug 3, 2023
fb1e1a4
design: 대체 이미지 기능 구현 및 여백 수정
semnil5202 Aug 3, 2023
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
2 changes: 1 addition & 1 deletion frontend/src/components/MergeOrSeeTogether/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Button from '../common/Button';
import Flex from '../common/Flex';
import Space from '../common/Space';
import Tag from '../common/Tag';
import Tag from '../Tag';

export interface MergeOrSeeTogetherProps {
tag: string[];
Expand Down
19 changes: 15 additions & 4 deletions frontend/src/components/PinPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ const PinPreview = ({
<Text color="black" $fontSize="default" $fontWeight="bold">
{pinTitle}
</Text>
<Space size={0} />
<Text color="gray" $fontSize="small" $fontWeight="normal">
{pinLocation}
</Text>
<Space size={3} />
<Text color="black" $fontSize="small" $fontWeight="normal">
<EllipsisText color="black" $fontSize="small" $fontWeight="normal">
{pinInformation}
</Text>
</EllipsisText>
</Flex>
</Flex>
);
Expand All @@ -89,8 +90,8 @@ const MultiSelectButton = styled.input`
width: 24px;
height: 24px;
position: absolute;
top: 8px;
right: 8px;
top: 4px;
right: 4px;
background-color: ${({ theme }) => theme.color.white};
border: 1px solid ${({ theme }) => theme.color.black};
border-radius: ${({ theme }) => theme.radius.small};
Expand All @@ -101,4 +102,14 @@ const MultiSelectButton = styled.input`
}
`;

const EllipsisText = styled(Text)`
width: 100%;
display: -webkit-box;
word-wrap: break-word;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
overflow: hidden;
`;

export default PinPreview;
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { styled } from 'styled-components';

const Tag = styled.span`
height: 28px;
max-width: 240px;
display: block;
height: 32px;
max-width: 280px;

padding: ${({ theme }) => `${theme.spacing['1']} ${theme.spacing['3']}`};

color: ${({ theme }) => theme.color.white};
font-size: ${({ theme }) => theme.fontSize.extraSmall};
font-size: ${({ theme }) => theme.fontSize.small};

background-color: ${({ theme }) => theme.color.black};
border-radius: ${({ theme }) => theme.radius.medium};
Expand Down
29 changes: 21 additions & 8 deletions frontend/src/components/TopicCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { styled } from 'styled-components';
import Flex from '../common/Flex';
import Text from '../common/Text';
import useNavigator from '../../hooks/useNavigator';
import Box from '../common/Box';

export interface TopicCardProps {
topicId: number;
Expand Down Expand Up @@ -42,7 +43,7 @@ const TopicCard = ({
};

return (
<li>
<WrapperLi>
<Flex
width="360px"
height="140px"
Expand All @@ -53,6 +54,7 @@ const TopicCard = ({
$borderRadius="small"
$backgroundImage={topicImage}
$backgroundSize="360px 140px"
$backgroundColor="whiteGray"
>
<MultiSelectButton
type="checkbox"
Expand All @@ -61,36 +63,47 @@ const TopicCard = ({
}
checked={taggedTopicIds.includes(topicId)}
/>
<Box
position="absolute"
width="100%"
height="68px"
$backgroundColor="black"
opacity="0.6"
></Box>
Comment on lines +66 to +72
Copy link
Collaborator

Choose a reason for hiding this comment

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

세인 혹시 이 부분은 blur처리 관련해서 추가된 코드일까요?!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

네 맞습니다 블러 처리 뒤에 검은 배경입니다. 따라서 기존의 블러 효과를 유지하면서 배경을 어둡게하고 글씨를 흰색으로 바꿔서 좀 더 잘 보이도록 했습니다.

<Flex
width="100%"
height="65px"
height="68px"
$flexDirection="column"
$alignItems="center"
$justifyContent="center"
cursor="pointer"
onClick={goToSelectedTopic}
$backdropFilter="blur(20px)"
$backdropFilter="blur(12px)"
>
<Text color="black" $fontSize="medium" $fontWeight="normal">
<Text color="white" $fontSize="medium" $fontWeight="normal">
{topicTitle}
</Text>
<Text color="gray" $fontSize="small" $fontWeight="normal">
<Text color="lightGray" $fontSize="small" $fontWeight="normal">
{`업데이트 : ${
topicUpdatedAt.split('T')[0]
} | 핀 개수 : ${topicPinCount}`}
</Text>
</Flex>
</Flex>
</li>
</WrapperLi>
);
};

const WrapperLi = styled.li`
box-shadow: 2px 4px 4px 0px rgba(69, 69, 69, 0.25);
`;

const MultiSelectButton = styled.input`
width: 24px;
height: 24px;
position: absolute;
top: 8px;
right: 8px;
top: ${({ theme }) => theme.spacing[0]};
right: ${({ theme }) => theme.spacing[0]};
background-color: ${({ theme }) => theme.color.white};
border: 1px solid ${({ theme }) => theme.color.black};
border-radius: ${({ theme }) => theme.radius.small};
Expand Down
19 changes: 15 additions & 4 deletions frontend/src/components/TopicInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ const TopicInfo = ({
routePage(`/new-pin?topic-id=${topicId}`);
};

const copyContent = async () => {
try {
const topicUrl = window.location.href.split('?')[0];
await navigator.clipboard.writeText(topicUrl);
alert('토픽 링크가 복사되었습니다.');
} catch (err) {
if (typeof err === 'string') throw new Error(err);
throw new Error('[ERROR] clipboard error');
}
};

return (
<Flex
width="360px"
Expand All @@ -49,20 +60,20 @@ const TopicInfo = ({
<Text color="black" $fontSize="large" $fontWeight="bold">
{topicTitle}
</Text>
<Space size={0} />
<Space size={1} />
<Text color="black" $fontSize="small" $fontWeight="normal">
{topicOwner}
</Text>
<Space size={0} />
<Space size={1} />
<Text color="black" $fontSize="small" $fontWeight="normal">
{topicDescription}
</Text>
<Space size={3} />
<Flex $justifyContent="space-between">
<Flex>
<Clipping />
<Space size={2} />
<Share />
<Space size={4} />
<Share cursor="pointer" onClick={copyContent} />
</Flex>
<Button variant="primary" onClick={goToNewPin}>
+ 핀 추가하기
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/common/Box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type BoxProps = {
$backgroundImage?: string;
$backgroundSize?: string;
$backdropFilter?: string;
opacity?: string;
};

const Box = styled.div<BoxProps>`
Expand Down Expand Up @@ -67,8 +68,11 @@ const Box = styled.div<BoxProps>`
border-bottom: ${({ $borderBottom }) => $borderBottom};
border-left: ${({ $borderLeft }) => $borderLeft};
cursor: ${({ cursor }) => cursor};
background-image: url(${({ $backgroundImage }) => $backgroundImage});
background-image: ${({ $backgroundImage }) =>
$backgroundImage &&
`url(${$backgroundImage}), url('https://velog.velcdn.com/images/semnil5202/post/37dae18f-9860-4483-bad5-1158a210e5a8/image.svg')`};
background-size: ${({ $backgroundSize }) => $backgroundSize};
backdrop-filter: ${({ $backdropFilter }) => $backdropFilter};
opacity: ${({ opacity }) => opacity};
`;
export default Box;
3 changes: 2 additions & 1 deletion frontend/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Home = () => {

const onTagCancel = () => {
setTagTopics([]);
setTaggedTopicIds([]);
};

const getAndSetDataFromServer = async () => {
Expand Down Expand Up @@ -82,7 +83,7 @@ const Home = () => {
);
})}
</ul>
<Flex position="fixed" bottom="40px" left="130px">
<Flex position="fixed" bottom="40px" left="142px">
<Button variant="primary" onClick={goToNewTopic}>
{tagTopics.length > 0 ? '토픽 병합하기' : '토픽 추가하기'}
</Button>
Expand Down
31 changes: 20 additions & 11 deletions frontend/src/pages/NewPin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Space from '../components/common/Space';
import Button from '../components/common/Button';
import Textarea from '../components/common/Textarea';
import { postApi } from '../utils/postApi';
import { FormEvent, useContext, useEffect, useState } from 'react';
import { FormEvent, useContext, useEffect, useRef, useState } from 'react';
import { getApi } from '../utils/getApi';
import { getAddress } from '../utils/getAddress';
import { TopicType } from '../types/Topic';
Expand All @@ -32,6 +32,7 @@ const NewPin = () => {
images: [],
});
const { routePage } = useNavigator();
const addressRef = useRef<HTMLInputElement | null>(null);

const goToBack = () => {
routePage(-1);
Expand All @@ -41,7 +42,7 @@ const NewPin = () => {
await postApi('/pins', {
topicId: topic?.id || 'error',
name: formValues.name,
address: formValues.address,
address: addressRef.current?.value,
description: formValues.description,
latitude: clickedCoordinate.latitude,
longitude: clickedCoordinate.longitude,
Expand Down Expand Up @@ -76,10 +77,6 @@ const NewPin = () => {
onComplete: async function (data: any) {
const addr = data.roadAddress; // 주소 변수

setFormValues((prev) => {
return { ...prev, address: addr };
});

//data를 통해 받아온 값을 Tmap api를 통해 위도와 경도를 구한다.
const { ConvertAdd } = await getAddress(
`https://apis.openapi.sk.com/tmap/geo/convertAddress?version=1&format=json&callback=result&searchTypCd=NtoO&appKey=P2MX6F1aaf428AbAyahIl9L8GsIlES04aXS9hgxo&coordType=WGS84GEO&reqAdd=${addr}`,
Expand Down Expand Up @@ -155,6 +152,8 @@ const NewPin = () => {
value={formValues.name}
onChange={onChangeInput}
placeholder="지도를 클릭하거나 장소의 이름을 입력해주세요."
autoFocus={true}
tabIndex={1}
/>
</section>

Expand All @@ -174,9 +173,11 @@ const NewPin = () => {
<Input
name="address"
readOnly
value={clickedCoordinate.address ?? formValues.address}
onChange={onChangeInput}
value={clickedCoordinate.address}
onClick={onClickAddressInput}
onKeyDown={onClickAddressInput}
Comment on lines +176 to +178
Copy link
Collaborator

Choose a reason for hiding this comment

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

와우 탭 된 후에 사용자가 키보드로 입력할 경우까지 생각해 onKeyDown을...굿굿!

ref={addressRef}
tabIndex={2}
placeholder="지도를 클릭하거나 장소의 위치를 입력해주세요."
/>
</section>
Expand All @@ -199,17 +200,25 @@ const NewPin = () => {
value={formValues.description}
onChange={onChangeInput}
placeholder="장소에 대한 의견을 자유롭게 남겨주세요."
tabIndex={3}
/>
</section>

<Space size={6} />

<Flex $justifyContent="end">
<Button variant="primary">추가하기</Button>
<Space size={3} />
<Button type="button" variant="secondary" onClick={goToBack}>
<Button
tabIndex={5}
type="button"
variant="secondary"
onClick={goToBack}
>
취소하기
</Button>
<Space size={3} />
<Button tabIndex={4} variant="primary">
추가하기
</Button>
</Flex>
</Flex>
</form>
Expand Down
Loading