-
Notifications
You must be signed in to change notification settings - Fork 0
[#11] 제보사이트 - 코드 리뷰 반영 #12
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import styled from "styled-components"; | ||
|
||
import Contents from "./Components/Contents"; | ||
|
||
export default function App() { | ||
return ( | ||
<> | ||
<h1>🤖 프로그래머스 JS 정답 통과기</h1> | ||
<Title>🤖 프로그래머스 JS 정답 통과기</Title> | ||
<Contents /> | ||
</> | ||
); | ||
} | ||
|
||
const Title = styled.h1``; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,120 @@ | ||
import { useState } from "react"; | ||
import { | ||
TabWrapper, | ||
BlockText, | ||
Button, | ||
StepByStepInputItem, | ||
InlineText, | ||
RadioInput, | ||
Label, | ||
TextInput, | ||
DataList, | ||
Option, | ||
TextArea, | ||
} from "./Style/StyledComponent"; | ||
|
||
export default function ErrorReport() { | ||
const [submitted, setSubmitted] = useState(false); | ||
const [errorCategory, setErrorCategory] = useState(-1); | ||
const [errorCategory, setErrorCategory] = useState(""); | ||
const [questionName, setQuestionName] = useState(""); | ||
const [detailInput, setDetailInput] = useState(""); | ||
const [detailContent, setDetailContent] = useState(""); | ||
|
||
const isQuestionNameUnvisible = errorCategory === "" || errorCategory === "error-notCopied"; | ||
const isDetailContentUnvisible = | ||
errorCategory === "" || (errorCategory === "error-wrongAnswer" && questionName === ""); | ||
const isSubmitBtnDisabled = errorCategory === "error-other" && detailContent === ""; | ||
|
||
function handleOtherErrorBtnClick() { | ||
setSubmitted(false); | ||
setErrorCategory(""); | ||
setQuestionName(""); | ||
setDetailContent(""); | ||
} | ||
|
||
function handleErrorCategoryClick(e) { | ||
setErrorCategory(e.target.id); | ||
} | ||
|
||
function handleQuestionNameInput(e) { | ||
setQuestionName(e.target.value); | ||
} | ||
|
||
function handleDetailContentInput(e) { | ||
setDetailContent(e.target.value); | ||
} | ||
|
||
function handleSubmitBtnClick() { | ||
setSubmitted(true); | ||
} | ||
|
||
return submitted ? ( | ||
<div> | ||
<p>제보해주셔서 감사합니다.</p> | ||
<button | ||
onClick={() => { | ||
setSubmitted(false); | ||
setErrorCategory(-1); | ||
setQuestionName(""); | ||
setDetailInput(""); | ||
}} | ||
> | ||
다른 오류 제보 | ||
</button> | ||
</div> | ||
<TabWrapper> | ||
<BlockText>제보해주셔서 감사합니다.</BlockText> | ||
<Button onClick={handleOtherErrorBtnClick}>다른 오류 제보</Button> | ||
</TabWrapper> | ||
) : ( | ||
<div> | ||
<div> | ||
<span>오류 유형: </span> | ||
<input | ||
<TabWrapper> | ||
<StepByStepInputItem> | ||
<InlineText>오류 유형: </InlineText> | ||
<RadioInput | ||
type="radio" | ||
id="errorCategory0" | ||
id="error-wrongAnswer" | ||
name="errorCategory" | ||
onClick={() => setErrorCategory(0)} | ||
onClick={handleErrorCategoryClick} | ||
/> | ||
<label htmlFor="errorCategory0">정답 통과가 안돼요</label> | ||
<input | ||
<Label htmlFor="error-wrongAnswer">정답 통과가 안돼요</Label> | ||
<RadioInput | ||
type="radio" | ||
id="errorCategory1" | ||
id="error-notCopied" | ||
name="errorCategory" | ||
onClick={() => setErrorCategory(1)} | ||
onClick={handleErrorCategoryClick} | ||
/> | ||
<label htmlFor="errorCategory1">코드 복사가 안돼요</label> | ||
<input | ||
<Label htmlFor="error-notCopied">코드 복사가 안돼요</Label> | ||
<RadioInput | ||
type="radio" | ||
id="errorCategory2" | ||
id="error-other" | ||
name="errorCategory" | ||
onClick={() => setErrorCategory(2)} | ||
onClick={handleErrorCategoryClick} | ||
/> | ||
<label htmlFor="errorCategory2">기타</label> | ||
</div> | ||
<Label htmlFor="error-other">기타</Label> | ||
</StepByStepInputItem> | ||
|
||
{errorCategory === -1 || errorCategory === 1 ? null : ( | ||
<div> | ||
<span>문제 이름:</span> | ||
<input | ||
{isQuestionNameUnvisible ? null : ( | ||
<StepByStepInputItem> | ||
<InlineText>문제 이름: </InlineText> | ||
<TextInput | ||
list="questionName" | ||
name="question" | ||
onInput={(e) => setQuestionName(e.target.value)} | ||
onInput={handleQuestionNameInput} | ||
defaultValue={questionName} | ||
/> | ||
<datalist id="questionName"> | ||
<option value="1번문제" /> | ||
<option value="2번문제" /> | ||
<option value="3번문제" /> | ||
</datalist> | ||
</div> | ||
<DataList id="questionName"> | ||
<Option value="1번문제" /> | ||
<Option value="2번문제" /> | ||
<Option value="3번문제" /> | ||
</DataList> | ||
</StepByStepInputItem> | ||
)} | ||
|
||
{errorCategory === -1 || (errorCategory === 0 && questionName === "") ? null : ( | ||
{isDetailContentUnvisible ? null : ( | ||
<> | ||
<div> | ||
<span>내용: </span> | ||
<textarea | ||
<StepByStepInputItem> | ||
<InlineText>내용: </InlineText> | ||
<TextArea | ||
rows="20" | ||
cols="100" | ||
onInput={(e) => setDetailInput(e.target.value)} | ||
defaultValue={detailInput} | ||
></textarea> | ||
</div> | ||
<div> | ||
<button | ||
id="submitBtn" | ||
disabled={errorCategory === 2 && detailInput === ""} | ||
onClick={() => setSubmitted(true)} | ||
> | ||
onInput={handleDetailContentInput} | ||
defaultValue={detailContent} | ||
></TextArea> | ||
</StepByStepInputItem> | ||
|
||
<StepByStepInputItem> | ||
<Button id="submitBtn" disabled={isSubmitBtnDisabled} onClick={handleSubmitBtnClick}> | ||
제출 | ||
</button> | ||
</div> | ||
</Button> | ||
</StepByStepInputItem> | ||
</> | ||
)} | ||
</div> | ||
</TabWrapper> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import { TabWrapper } from "./Style/StyledComponent"; | ||
|
||
export default function Introduction() { | ||
return ( | ||
<div> | ||
<p>IntroductionTab</p> | ||
{/* IntroductionTab content will go here */} | ||
</div> | ||
); | ||
return <TabWrapper>{/* IntroductionTab content will go here */}</TabWrapper>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,91 @@ | ||
import { useState } from "react"; | ||
import styled from "styled-components"; | ||
|
||
import { | ||
TabWrapper, | ||
BlockText, | ||
Button, | ||
StepByStepInputItem, | ||
InlineText, | ||
TextInput, | ||
DataList, | ||
Option, | ||
TextArea, | ||
} from "./Style/StyledComponent"; | ||
|
||
export default function SolutionReport() { | ||
const [submitted, setSubmitted] = useState(false); | ||
const [questionName, setQuestionName] = useState(""); | ||
const [detailInput, setDetailInput] = useState(""); | ||
const [detailContent, setDetailContent] = useState(""); | ||
|
||
const isDetailContentUnvisible = questionName === ""; | ||
const isSubmitBtnDisabled = detailContent === ""; | ||
|
||
function handleOtherSolutionBtnClick() { | ||
setSubmitted(false); | ||
setQuestionName(""); | ||
setDetailContent(""); | ||
} | ||
|
||
function handleQuestionNameInput(e) { | ||
setQuestionName(e.target.value); | ||
} | ||
|
||
function handleDetailContentInput(e) { | ||
setDetailContent(e.target.value); | ||
} | ||
|
||
function handleSubmitBtnClick() { | ||
setSubmitted(true); | ||
} | ||
|
||
return submitted ? ( | ||
<div> | ||
<p>제보해주셔서 감사합니다.</p> | ||
<button | ||
onClick={() => { | ||
setSubmitted(false); | ||
setQuestionName(""); | ||
setDetailInput(""); | ||
}} | ||
> | ||
다른 정답 제보 | ||
</button> | ||
</div> | ||
<TabWrapper> | ||
<BlockText>제보해주셔서 감사합니다.</BlockText> | ||
<Button onClick={handleOtherSolutionBtnClick}>다른 정답 제보</Button> | ||
</TabWrapper> | ||
) : ( | ||
<div> | ||
<div> | ||
<span>문제 이름:</span> | ||
<input | ||
<TabWrapper> | ||
<StepByStepInputItem> | ||
<InlineText>문제 이름: </InlineText> | ||
<TextInput | ||
list="questionName" | ||
name="question" | ||
onInput={(e) => setQuestionName(e.target.value)} | ||
onInput={handleQuestionNameInput} | ||
defaultValue={questionName} | ||
/> | ||
<datalist id="questionName"> | ||
<option value="1번문제" /> | ||
<option value="2번문제" /> | ||
<option value="3번문제" /> | ||
</datalist> | ||
</div> | ||
|
||
{questionName === "" ? null : ( | ||
<DataList id="questionName"> | ||
<Option value="1번문제" /> | ||
<Option value="2번문제" /> | ||
<Option value="3번문제" /> | ||
</DataList> | ||
</StepByStepInputItem> | ||
|
||
{isDetailContentUnvisible ? null : ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<> | ||
<div className="gitHubLogin"> | ||
<span>기여자 등록: </span> | ||
<button id="gitHubLoginBtn">GitHub 로그인</button> | ||
</div> | ||
<div> | ||
<span>내용: </span> | ||
<textarea | ||
<StepByStepInputItem> | ||
<InlineText>기여자 등록: </InlineText> | ||
<GitHubLoginBtn id="gitHubLoginBtn">GitHub 로그인</GitHubLoginBtn> | ||
</StepByStepInputItem> | ||
<StepByStepInputItem> | ||
<InlineText>내용: </InlineText> | ||
<TextArea | ||
rows="20" | ||
cols="100" | ||
onInput={(e) => setDetailInput(e.target.value)} | ||
defaultValue={detailInput} | ||
></textarea> | ||
</div> | ||
<div> | ||
<button id="submitBtn" disabled={detailInput === ""} onClick={() => setSubmitted(true)}> | ||
onInput={handleDetailContentInput} | ||
defaultValue={detailContent} | ||
></TextArea> | ||
</StepByStepInputItem> | ||
|
||
<StepByStepInputItem> | ||
<Button id="submitBtn" disabled={isSubmitBtnDisabled} onClick={handleSubmitBtnClick}> | ||
제출 | ||
</button> | ||
</div> | ||
</Button> | ||
</StepByStepInputItem> | ||
</> | ||
)} | ||
</div> | ||
</TabWrapper> | ||
); | ||
} | ||
|
||
const GitHubLoginBtn = styled.button``; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아래와 같은 폴더구조를 생각해보셔도 좋을 것 같아요!!
router.js
routes.js
App.js