-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SKRR-11 design: 클럽 게시글 작성 페이지 디자인 구현 (#243)
* feat: 글 작성 페이지 구현 * design: 글 작성 페이지 디자인 수정 * fix: 더미값 삭제 * design: 작서완료 버튼 padding 게시판 페이지와 맞춤
- Loading branch information
1 parent
049f73a
commit 81088f8
Showing
3 changed files
with
163 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import Theme from '@/styles/Theme'; | ||
import styled from '@emotion/styled'; | ||
|
||
import { ClubHomePageContainer, ClubHomeTopWrapper } from '../ClubHomePage/ClubHomePage.style'; | ||
|
||
const ClubPostWritePageContainer = styled(ClubHomePageContainer)``; | ||
|
||
const ClubPostWriteTopWrapper = styled(ClubHomeTopWrapper)``; | ||
|
||
const ContentWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 0.5rem; | ||
width: 100%; | ||
padding: 1rem; | ||
`; | ||
|
||
const ButtonWrapper = styled.div` | ||
display: flex; | ||
justify-content: start; | ||
width: 100%; | ||
`; | ||
|
||
const TitleStyled = styled.input` | ||
width: 100%; | ||
height: 2.5rem; | ||
padding: 0.3rem; | ||
border: 1px solid ${Theme.color.tSeparator}; | ||
`; | ||
|
||
const ContentStyled = styled.textarea` | ||
width: 100%; | ||
height: 20rem; | ||
padding: 0.5rem 0.3rem; | ||
border: 1px solid ${Theme.color.tSeparator}; | ||
`; | ||
|
||
const FileInputWrapper = styled.div` | ||
display: flex; | ||
justify-content: start; | ||
width: 100%; | ||
padding: 0.5rem; | ||
`; | ||
|
||
const ErrorMessageStyled = styled.span` | ||
font-size: ${Theme.fontSize.smallContent}; | ||
color: ${Theme.color.tRed}; | ||
`; | ||
|
||
export { | ||
ClubPostWritePageContainer, | ||
ClubPostWriteTopWrapper, | ||
ContentWrapper, | ||
ButtonWrapper, | ||
TitleStyled, | ||
ContentStyled, | ||
FileInputWrapper, | ||
ErrorMessageStyled, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,94 @@ | ||
import ClubHeader from '@/components/ClubHeader/ClubHeader'; | ||
import Button from '@/components/common/Button/Button'; | ||
import ClubBanner from '@/components/common/ClubBanner/ClubBanner'; | ||
|
||
import { SubmitHandler, useForm } from 'react-hook-form'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import { | ||
ButtonWrapper, | ||
ClubPostWritePageContainer, | ||
ClubPostWriteTopWrapper, | ||
ContentStyled, | ||
ContentWrapper, | ||
ErrorMessageStyled, | ||
FileInputWrapper, | ||
TitleStyled, | ||
} from './ClubPostWritePage.style'; | ||
|
||
interface ClubPostWriteValue { | ||
image: File; | ||
title: string; | ||
content: string; | ||
} | ||
|
||
const ClubPostWritePage = () => { | ||
return <div>ClubPostWritePage</div>; | ||
const { clubId } = useParams(); | ||
const { | ||
register, | ||
handleSubmit, | ||
formState: { errors }, | ||
} = useForm<ClubPostWriteValue>({ | ||
defaultValues: { | ||
title: '', | ||
content: '', | ||
image: undefined, | ||
}, | ||
}); | ||
if (!clubId) throw new Error('클럽 ID를 찾을 수 없습니다'); | ||
|
||
const onSubmit: SubmitHandler<ClubPostWriteValue> = () => {}; | ||
|
||
return ( | ||
<> | ||
<ClubHeader clubId={clubId} /> | ||
<ClubPostWritePageContainer> | ||
<ClubPostWriteTopWrapper> | ||
<ClubBanner withdrawClubButton clubId={clubId} bannerSize="small" /> | ||
</ClubPostWriteTopWrapper> | ||
<form onSubmit={handleSubmit(onSubmit)}> | ||
<ContentWrapper> | ||
<ButtonWrapper> | ||
<Button buttonText="작성 완료" /> | ||
</ButtonWrapper> | ||
<TitleStyled | ||
{...register('title', { | ||
required: '제목 입력은 필수입니다.', | ||
minLength: { | ||
value: 2, | ||
message: '2글자 이상 입력해주세요.', | ||
}, | ||
maxLength: { | ||
value: 30, | ||
message: '30자 이상 입력할 수 없습니다.', | ||
}, | ||
})} | ||
placeholder="제목을 입력해주세요." | ||
/> | ||
<ErrorMessageStyled>{errors?.title ? errors.title.message : ''}</ErrorMessageStyled> | ||
<ContentStyled | ||
{...register('content', { | ||
required: '내용 입력은 필수입니다.', | ||
minLength: { | ||
value: 2, | ||
message: '2글자 이상 입력해주세요.', | ||
}, | ||
maxLength: { | ||
value: 1000, | ||
message: '1000자 이상 입력할 수 없습니다.', | ||
}, | ||
})} | ||
placeholder="내용을 입력해주세요." | ||
/> | ||
<ErrorMessageStyled>{errors?.content ? errors.content.message : ''}</ErrorMessageStyled> | ||
<FileInputWrapper> | ||
<input type="file" accept=".jpg, .jpeg, .png, .heic" /> | ||
</FileInputWrapper> | ||
</ContentWrapper> | ||
</form> | ||
</ClubPostWritePageContainer> | ||
</> | ||
); | ||
}; | ||
|
||
export default ClubPostWritePage; |