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

공통 상단 네비게이션 만들기 #235

Merged
merged 4 commits into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions src/assets/icons/ic_back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { default as icBookmarkSelected } from './ic_bookmark_selected.svg';
export { default as icBookmarkUnselected } from './ic_bookmark_unselected.svg';
export { default as icSearch } from './ic_search.svg';
export { ReactComponent as IcBack } from './ic_back.svg';
export { default as icBack } from './ic_back.svg';
export { ReactComponent as IcDelete } from './ic_delete.svg';
export { default as icMemberAdd } from './ic_member_add.svg';
export { default as icMemberAdded } from './ic_member_added.svg';
Expand Down
27 changes: 27 additions & 0 deletions src/presentation/components/common/CommonNavigation/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useNavigate } from 'react-router-dom';

import { icBack } from '@assets/icons';
import { StBack, StCommonNavigation, StSubmitButton, StTitle } from './style';

interface CommonNavigationProps {
isBack?: boolean;
onClickBack?: () => void;
title?: string;
submitButton?: { content: string; onClick: () => void };
}

export default function CommonNavigation(props: CommonNavigationProps) {
const { isBack = true, onClickBack, title, submitButton } = props;
const navigate = useNavigate();
return (
<StCommonNavigation>
{isBack && <StBack src={icBack} onClick={onClickBack ? onClickBack : () => navigate(-1)} />}
{title && <StTitle>{title}</StTitle>}
{submitButton && (
<StSubmitButton onClick={submitButton && submitButton.onClick}>
{submitButton && submitButton.content}
Copy link
Member

Choose a reason for hiding this comment

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

20번째 줄에서 한 번 감싸줬으니 안에서는 안 감싸줘도 괜찮지 않나여!!?

Copy link
Member Author

Choose a reason for hiding this comment

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

다른 방식으로 짤 때 써놨던건데 안지웠다..! 고마워 수정할게!!

</StSubmitButton>
)}
</StCommonNavigation>
);
}
37 changes: 37 additions & 0 deletions src/presentation/components/common/CommonNavigation/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { COLOR } from '@styles/common/color';
import { FONT_STYLES } from '@styles/common/font-style';
import styled from 'styled-components';

export const StCommonNavigation = styled.div`
width: 100%;
height: 44px;
position: relative;
& > * {
position: absolute;
}
`;

export const StBack = styled.img`
margin-left: 14px;
`;

export const StTitle = styled.div`
top: 14px;
left: 50%;
transform: translate(-50%, 0%);
${FONT_STYLES.SB_17_TITLE}
line-height: 100%;
letter-spacing: -0.01em;
color: ${COLOR.GRAY_8};
`;

export const StSubmitButton = styled.button`
top: 14.33px;
right: 0;
margin-right: 14.33px;
${FONT_STYLES.M_15_TITLE}
line-height: 100%;
letter-spacing: -0.01em;
color: ${COLOR.CORAL_MAIN};
background-color: transparent;
`;
84 changes: 44 additions & 40 deletions src/presentation/pages/Team/Register/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useLoginUser } from '@hooks/useLoginUser';
import { api } from '@api/index';
import { useState } from 'react';
import { useEffect } from 'react';
import CommonNavigation from '@components/common/CommonNavigation';

function TeamRegister() {
const [isMemberSelectMode, setIsMemberSelectMode] = useState(false);
Expand Down Expand Up @@ -53,46 +54,49 @@ function TeamRegister() {
return (
<StTeamRegister>
{isMemberSelectMode && <TeamMembers onClickSubmitButton={closeMembers} />}
<StTeamRegisterWrapper>
<StTitle>팀 등록하기</StTitle>
<StAbsoluteWrapper>
<PhotoUpload width="104px" height="104px" borderRadius="36px" setFile={setImage}>
<ImgTeamAdd />
</PhotoUpload>
{!image && <StIcPencil />}
</StAbsoluteWrapper>
<CommonLabel content="팀 이름" marginTop="32px" marginBottom="18px" />
<CommonInput
value={name}
width="100%"
placeholder="팀 이름을 입력해주세요"
onChange={(name) => setName(name)}
/>
<CommonLabel content="팀에 관해 간략히 설명해주세요" marginTop="44px" />
<StTextarea
placeholder="설명을 입력해주세요"
value={description}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => setDescription(e.target.value)}
/>
<CommonLabel content="팀원을 추가해주세요" marginTop="44px" marginBottom="18px" />
<ProfileList
isSquare={false}
profileList={[
{ id: id, profileName: username, profileImage: profileImage ?? imgEmptyProfile },
...selectedUserList,
]}
onAddClick={() => setIsMemberSelectMode(true)}
/>
<StSubmitButton
onClick={() => {
submitTeamInfo();
navigate('/home/team');
}}
isActive={name.length > 0}
>
완료
</StSubmitButton>
</StTeamRegisterWrapper>
<>
<CommonNavigation />
<StTeamRegisterWrapper>
<StTitle>팀 등록하기</StTitle>
<StAbsoluteWrapper>
<PhotoUpload width="104px" height="104px" borderRadius="36px" setFile={setImage}>
<ImgTeamAdd />
</PhotoUpload>
{!image && <StIcPencil />}
</StAbsoluteWrapper>
<CommonLabel content="팀 이름" marginTop="32px" marginBottom="18px" />
<CommonInput
value={name}
width="100%"
placeholder="팀 이름을 입력해주세요"
onChange={(name) => setName(name)}
/>
<CommonLabel content="팀에 관해 간략히 설명해주세요" marginTop="44px" />
<StTextarea
placeholder="설명을 입력해주세요"
value={description}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => setDescription(e.target.value)}
/>
<CommonLabel content="팀원을 추가해주세요" marginTop="44px" marginBottom="18px" />
<ProfileList
isSquare={false}
profileList={[
{ id: id, profileName: username, profileImage: profileImage ?? imgEmptyProfile },
...selectedUserList,
]}
onAddClick={() => setIsMemberSelectMode(true)}
/>
<StSubmitButton
onClick={() => {
submitTeamInfo();
navigate('/home/team');
}}
isActive={name.length > 0}
>
완료
</StSubmitButton>
</StTeamRegisterWrapper>
</>
</StTeamRegister>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/presentation/pages/Team/Register/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const StTitle = styled.div`
font-weight: 600;
font-size: 24px;
color: ${COLOR.GRAY_8};
margin-top: 42px;
margin-top: 68px;
margin-bottom: 30px;
`;

Expand Down