-
Notifications
You must be signed in to change notification settings - Fork 0
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
[3주차 기본/심화/생각 과제] Would You Like Something to Drink? #3
base: main
Are you sure you want to change the base?
Changes from 16 commits
08f39cf
40d190c
2edd1fe
89aa558
7f07e92
bf0795e
9a629c7
d4b0d5e
1bcd12a
250900a
d20f93a
85e43b1
69f39dd
598cc78
6c7717a
7375548
cfd25b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"dependencies": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# React + Vite | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
||
Currently, two official plugins are available: | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
import styled from "styled-components"; | ||
|
||
import React from "react"; | ||
|
||
const FirstStage = (FirstStageProps) => { | ||
const { | ||
tournamentStage, | ||
setTournamentStage, | ||
firstChoice, | ||
setFirstChoice, | ||
setSecondChoice, | ||
setThirdChoice, | ||
} = FirstStageProps; | ||
|
||
return ( | ||
<FirstStageContainer> | ||
<StageTitle>Choose your preference</StageTitle> | ||
<ChoiceBox> | ||
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. 이 ChoiceBox 내부도,,,!!
|
||
<Choice | ||
type="button" | ||
value="Coffee" | ||
onClick={() => { | ||
setFirstChoice("coffee"); | ||
}} | ||
className={firstChoice === "coffee" && "selected"} | ||
> | ||
Coffee | ||
</Choice> | ||
<Choice | ||
type="button" | ||
value="Tea" | ||
onClick={() => { | ||
setFirstChoice("tea"); | ||
}} | ||
className={firstChoice === "tea" && "selected"} | ||
> | ||
Tea | ||
</Choice> | ||
<Choice | ||
type="button" | ||
value="Halmi Latte" | ||
onClick={() => { | ||
setFirstChoice("halmi"); | ||
}} | ||
className={firstChoice === "halmi" && "selected"} | ||
> | ||
Halmi Latte | ||
</Choice> | ||
</ChoiceBox> | ||
<ButtonBox> | ||
<Button | ||
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. 22!!!!! 가형이 의견에 동의합니당!!! 나두 재사용하도록 고칠 거 옴총 많은데 😮💨 |
||
type="button" | ||
onClick={() => { | ||
setTournamentStage(tournamentStage - 1); | ||
setFirstChoice(""); | ||
setSecondChoice(""); | ||
setThirdChoice(""); | ||
}} | ||
> | ||
Previous | ||
</Button> | ||
{firstChoice === "" ? ( | ||
<Button | ||
type="button" | ||
onClick={() => { | ||
setTournamentStage(tournamentStage + 1); | ||
}} | ||
disabled | ||
> | ||
Next | ||
</Button> | ||
) : ( | ||
<Button | ||
type="button" | ||
onClick={() => { | ||
setTournamentStage(tournamentStage + 1); | ||
}} | ||
> | ||
Next | ||
</Button> | ||
)} | ||
</ButtonBox> | ||
</FirstStageContainer> | ||
); | ||
}; | ||
|
||
export default FirstStage; | ||
|
||
const FirstStageContainer = styled.section` | ||
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 말고 section 디테일 좋다 👍🏻👍🏻👍🏻 |
||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
width: calc(100vw - 20rem); | ||
height: calc(100vh - 20rem); | ||
|
||
border-radius: 2rem; | ||
|
||
background-color: ${({ theme }) => theme.colors.blue}; | ||
color: ${({ theme }) => theme.colors.white}; | ||
Comment on lines
+99
to
+100
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. theme 적용한곤가?? GlobalStyle밖에 사용 안 해봤는데 나도 적용해봐야겠다!!! |
||
`; | ||
|
||
const StageTitle = styled.p` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
width: 40rem; | ||
height: 3rem; | ||
|
||
border-radius: 0.5rem; | ||
margin: 3rem 0; | ||
|
||
background-color: ${({ theme }) => theme.colors.cream}; | ||
color: ${({ theme }) => theme.colors.navy}; | ||
|
||
${({ theme }) => theme.fonts.subtitle}; | ||
`; | ||
|
||
const ChoiceBox = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 5rem; | ||
`; | ||
|
||
const Choice = styled.button` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
width: calc((100vw - 60rem) / 2); | ||
height: 20rem; | ||
|
||
background-color: ${({ theme }) => theme.colors.cream}; | ||
color: ${({ theme }) => theme.colors.navy}; | ||
|
||
border: none; | ||
border-radius: 1rem; | ||
|
||
${({ theme }) => theme.fonts.body_bold}; | ||
|
||
&:hover, | ||
&.selected { | ||
background-color: ${({ theme }) => theme.colors.orange}; | ||
color: ${({ theme }) => theme.colors.white}; | ||
} | ||
`; | ||
|
||
const ButtonBox = styled.span` | ||
display: flex; | ||
gap: 5rem; | ||
`; | ||
|
||
const Button = styled.button` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
width: 8rem; | ||
height: 2rem; | ||
|
||
margin-top: 2rem; | ||
|
||
border-radius: 0.5rem; | ||
|
||
background-color: ${({ theme }) => theme.colors.cream}; | ||
color: ${({ theme }) => theme.colors.navy}; | ||
|
||
${({ theme }) => theme.fonts.body_bold}; | ||
|
||
&:hover { | ||
background-color: ${({ theme }) => theme.colors.orange}; | ||
color: ${({ theme }) => theme.colors.white}; | ||
} | ||
|
||
&:disabled { | ||
background-color: ${({ theme }) => theme.colors.disabled_button}; | ||
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. theme 진짜 좋은 것 같아... 가독성도 좋고 엄청 편리해보여!!!!! |
||
color: ${({ theme }) => theme.colors.navy}; | ||
cursor: not-allowed; | ||
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. 처음 보는 속성값이다!!! 찾아보니까 금지 표시 커서가 뜬다구 하네 신기신기!! |
||
} | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import styled from "styled-components"; | ||
import React, { useState } from "react"; | ||
import RandomResult from "./RandomResult"; | ||
|
||
const Random = () => { | ||
const [showResult, setShowResult] = useState(false); | ||
|
||
const renderRandom = () => { | ||
return showResult ? ( | ||
<RandomResult setShowResult={setShowResult} /> | ||
) : ( | ||
<> | ||
<HomeTitle>How would you like to choose your drink?</HomeTitle> | ||
<RandomBox>Random!</RandomBox> | ||
<StartBtn | ||
type="button" | ||
onClick={() => { | ||
setShowResult(true); | ||
}} | ||
> | ||
Start! | ||
</StartBtn> | ||
</> | ||
); | ||
}; | ||
|
||
return <RandomContainer>{renderRandom()}</RandomContainer>; | ||
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.
|
||
}; | ||
|
||
export default Random; | ||
|
||
const RandomContainer = styled.section` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
width: calc(100vw - 20rem); | ||
height: calc(100vh - 20rem); | ||
|
||
border-radius: 2rem; | ||
|
||
background-color: ${({ theme }) => theme.colors.blue}; | ||
color: ${({ theme }) => theme.colors.white}; | ||
`; | ||
|
||
const HomeTitle = styled.p` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
width: 40rem; | ||
height: 3rem; | ||
|
||
border-radius: 0.5rem; | ||
margin: 3rem 0; | ||
|
||
background-color: ${({ theme }) => theme.colors.cream}; | ||
color: ${({ theme }) => theme.colors.navy}; | ||
|
||
user-select: none; | ||
|
||
${({ theme }) => theme.fonts.subtitle}; | ||
`; | ||
|
||
const RandomBox = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
width: calc((100vw - 60rem)); | ||
height: 20rem; | ||
|
||
background-color: ${({ theme }) => theme.colors.cream}; | ||
color: ${({ theme }) => theme.colors.navy}; | ||
|
||
border-radius: 1rem; | ||
|
||
user-select: none; | ||
|
||
${({ theme }) => theme.fonts.body_bold}; | ||
`; | ||
|
||
const StartBtn = styled.button` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
width: 8rem; | ||
height: 2rem; | ||
|
||
margin-top: 2rem; | ||
|
||
border-radius: 0.5rem; | ||
|
||
background-color: ${({ theme }) => theme.colors.cream}; | ||
color: ${({ theme }) => theme.colors.navy}; | ||
|
||
${({ theme }) => theme.fonts.body_bold}; | ||
|
||
&:hover { | ||
background-color: ${({ theme }) => theme.colors.orange}; | ||
color: ${({ theme }) => theme.colors.white}; | ||
} | ||
`; |
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.
,,,나 이거 지웠는데 이 파일은 남겨두는 게 좋나,,,,,?
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.
지워두 될듯,, 나두 지워야징😅