Skip to content

Commit

Permalink
Merge pull request #331 from SejongPeer/feature/6
Browse files Browse the repository at this point in the history
feat: [6] 버튼 컴포넌트화
  • Loading branch information
JunYoungKr authored Jul 7, 2024
2 parents 1b5e302 + 9ba0c46 commit 73b0d60
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import StudyList from '../src/pages/study/studyList/StudyList.js';
import StudyPostDeatil from '../src/pages/study/studyPostDetail/StudyPostDetail.js';
import StudyPostWrite from './pages/study/studyPostWrite/StudyPostWrite.js';
import StudyFilter from '../src/pages/study/studyFilterPage/StudyFIlterPage.js';
import StudyModify from './pages/study/studyModify/studyModify.js';

// 축제
import AnimalApply from './pages/festival/animalApply/AnimalApply.js';
Expand Down Expand Up @@ -196,6 +197,7 @@ const App = () => {
<Route path="/study/post/:studyId" element={<StudyPostDeatil />} />
<Route path="/study/post" element={<StudyPostWrite />} />
<Route path="/study/filter" element={<StudyFilter />} />
<Route path="/study/modify" element={<StudyModify />} />

<Route path="/fest/AnimalApply" element={<AnimalApply />} />
<Route path="/fest/AnimalApply2" element={<AnimalApply2 />} />
Expand Down
18 changes: 11 additions & 7 deletions src/components/button/submitButton/SubmitBtn.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Children } from 'react';
import style from './SubmitBtn.module.css'

const SubmitBtn = (props) => {
return (
<div>
{Children}
</div>
)
const SubmitBtn = ({
name,
ready,
onClickHandler
}) => {
return <button
className={ready ? style.submitBtn : style.submitBtn_notReady}
onClick={onClickHandler}
>
{name}
</button>
}

export default SubmitBtn;
22 changes: 22 additions & 0 deletions src/components/button/submitButton/SubmitBtn.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.submitBtn {
width: 343px;
height: 52px;
background-color: #ff4b4b;
text-align: center;
color: #ffffff;
border: none;
border-radius: 28px;
font-size: 18px;
font-weight: 700;
}
.submitBtn_notReady {
width: 343px;
height: 52px;
background-color: #E5E5E5;
text-align: center;
color: #ffffff;
border: none;
border-radius: 28px;
font-size: 18px;
font-weight: 700;
}
4 changes: 3 additions & 1 deletion src/components/studyPostWrite/ImageUpload.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
width: 100%;
display: flex;
gap: 10px;
position: relative;
}
.imageWrapper{
width: 100px;
Expand All @@ -35,6 +36,7 @@
align-items: center;
justify-content: center;
position: relative;
cursor: pointer;
}
.imageWrapper img.upload {
width: 100%;
Expand All @@ -46,11 +48,11 @@
height: 24px;
margin: 0;
cursor: pointer;
position: relative;
}
.uploadImg img {
width: 100%;
height: 100%;
z-index: 2;
}
.hiddenInput {
display: none;
Expand Down
7 changes: 7 additions & 0 deletions src/pages/study/studyModify/studyModify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import StudyPostWrite from "../studyPostWrite/StudyPostWrite";

const StudyModify = () => {
return <StudyPostWrite />
}

export default StudyModify;
9 changes: 8 additions & 1 deletion src/pages/study/studyPostWrite/StudyPostWrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Tag from '../../../components/studyPostWrite/studyRequirement/Tag';

import style from './StudyPostWrite.module.css';
import './StudyPostWriteBasic.css';
import SubmitBtn from '../../../components/button/submitButton/SubmitBtn';

const StudyPostWrite = () => {
// 모집 기간, 모집 인원
Expand Down Expand Up @@ -131,6 +132,9 @@ const StudyPostWrite = () => {
setImgFiles(newImgFiles);
}

//
const [isFilled, setIsFilled] = useState(true);

return (
<div className={style.container}>
<div className={style.innerConatiner}>
Expand Down Expand Up @@ -174,7 +178,10 @@ const StudyPostWrite = () => {
</div>

<div className={style.postConainer}>
<button className={style.postBtn}>모집글 올리기</button>
<SubmitBtn
name={'모집글 올리기'}
ready={isFilled}
/>
</div>

{modalOpen && (
Expand Down

0 comments on commit 73b0d60

Please sign in to comment.