diff --git a/src/App.js b/src/App.js index bc4d145..e80aafa 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,14 @@ +import styled from "styled-components"; + import Contents from "./Components/Contents"; export default function App() { return ( <> -

๐Ÿค– ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค JS ์ •๋‹ต ํ†ต๊ณผ๊ธฐ

+ Codestin Search App ); } + +const Title = styled.h1``; diff --git a/src/Components/Contents.js b/src/Components/Contents.js index 4fe1bb1..ef40d11 100644 --- a/src/Components/Contents.js +++ b/src/Components/Contents.js @@ -1,4 +1,5 @@ import { BrowserRouter, Routes, Route, Link } from "react-router-dom"; +import styled from "styled-components"; import Introduction from "./Tabs/Introduction"; import ErrorReport from "./Tabs/ErrorReport"; @@ -7,17 +8,17 @@ import SolutionReport from "./Tabs/SolutionReport"; export default function TabNavigation() { return ( - + + }> }> @@ -26,3 +27,7 @@ export default function TabNavigation() { ); } + +const TabList = styled.ul``; + +const TabItem = styled.li``; diff --git a/src/Components/Tabs/ErrorReport.js b/src/Components/Tabs/ErrorReport.js index 10d9d9a..a9ebb43 100644 --- a/src/Components/Tabs/ErrorReport.js +++ b/src/Components/Tabs/ErrorReport.js @@ -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 ? ( -
-

์ œ๋ณดํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

- -
+ + ์ œ๋ณดํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. + + ) : ( -
-
- ์˜ค๋ฅ˜ ์œ ํ˜•: - + + ์˜ค๋ฅ˜ ์œ ํ˜•: + setErrorCategory(0)} + onClick={handleErrorCategoryClick} /> - - ์ •๋‹ต ํ†ต๊ณผ๊ฐ€ ์•ˆ๋ผ์š” + setErrorCategory(1)} + onClick={handleErrorCategoryClick} /> - - ์ฝ”๋“œ ๋ณต์‚ฌ๊ฐ€ ์•ˆ๋ผ์š” + setErrorCategory(2)} + onClick={handleErrorCategoryClick} /> - -
+ + - {errorCategory === -1 || errorCategory === 1 ? null : ( -
- ๋ฌธ์ œ ์ด๋ฆ„: - + ๋ฌธ์ œ ์ด๋ฆ„: + setQuestionName(e.target.value)} + onInput={handleQuestionNameInput} defaultValue={questionName} /> - - -
+ + + )} - {errorCategory === -1 || (errorCategory === 0 && questionName === "") ? null : ( + {isDetailContentUnvisible ? null : ( <> -
- ๋‚ด์šฉ: - -
-
- -
+ + )} -
+ ); } diff --git a/src/Components/Tabs/Introduction.js b/src/Components/Tabs/Introduction.js index 9246900..17d1b77 100644 --- a/src/Components/Tabs/Introduction.js +++ b/src/Components/Tabs/Introduction.js @@ -1,8 +1,5 @@ +import { TabWrapper } from "./Style/StyledComponent"; + export default function Introduction() { - return ( -
-

IntroductionTab

- {/* IntroductionTab content will go here */} -
- ); + return {/* IntroductionTab content will go here */}; } diff --git a/src/Components/Tabs/SolutionReport.js b/src/Components/Tabs/SolutionReport.js index a26cdca..5281a5a 100644 --- a/src/Components/Tabs/SolutionReport.js +++ b/src/Components/Tabs/SolutionReport.js @@ -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 ? ( -
-

์ œ๋ณดํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

- -
+ + ์ œ๋ณดํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. + + ) : ( -
-
- ๋ฌธ์ œ ์ด๋ฆ„: - + + ๋ฌธ์ œ ์ด๋ฆ„: + setQuestionName(e.target.value)} + onInput={handleQuestionNameInput} defaultValue={questionName} /> - - -
- - {questionName === "" ? null : ( + + + + + {isDetailContentUnvisible ? null : ( <> -
- ๊ธฐ์—ฌ์ž ๋“ฑ๋ก: - -
-
- ๋‚ด์šฉ: - -
-
- -
+ + )} -
+ ); } + +const GitHubLoginBtn = styled.button``; diff --git a/src/Components/Tabs/Style/StyledComponent.js b/src/Components/Tabs/Style/StyledComponent.js new file mode 100644 index 0000000..c2da699 --- /dev/null +++ b/src/Components/Tabs/Style/StyledComponent.js @@ -0,0 +1,27 @@ +// Tabs์—์„œ ๊ณตํ†ต์ ์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๋ถ€๋ถ„์„ ์œ„ํ•ด ํด๋”๊ตฌ์กฐ๋ฅผ ์ด๋ ‡๊ฒŒ ๋งŒ๋“ค์—ˆ๋Š”๋ฐ, ๋ญ”๊ฐ€ ์–ด์ƒ‰ํ•˜๋„ค์š”.. + +import styled from "styled-components"; + +export const TabWrapper = styled.div``; + +export const BlockText = styled.p``; + +export const Button = styled.button``; + +export const StepByStepInputItem = styled.div``; + +export const InlineText = styled.span``; + +export const RadioInput = styled.input``; + +export const Label = styled.label``; + +export const TextInput = styled.input``; + +export const DataList = styled.datalist``; + +export const Option = styled.option``; + +export const DetailContentWrapper = styled.div``; + +export const TextArea = styled.textarea``; diff --git a/src/recoil/atom 2.js b/src/recoil/atom 2.js deleted file mode 100644 index 9e958b5..0000000 --- a/src/recoil/atom 2.js +++ /dev/null @@ -1,6 +0,0 @@ -import { atom } from "recoil"; - -export const tabNoState = atom({ - key: "tabNoState", - default: 0, -}); diff --git a/src/recoil/atom.js b/src/recoil/atom.js deleted file mode 100644 index 9e958b5..0000000 --- a/src/recoil/atom.js +++ /dev/null @@ -1,6 +0,0 @@ -import { atom } from "recoil"; - -export const tabNoState = atom({ - key: "tabNoState", - default: 0, -});