-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: [#1] get api
- Loading branch information
Showing
5 changed files
with
227 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import axios from "axios"; | ||
|
||
export const surveyGetApi = async () => { | ||
try { | ||
const response = await axios.get( | ||
"https://jsonplaceholder.typicode.com/posts/" | ||
); | ||
return response.data; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
export const surveyPostApi = async (userAnswer: string[]) => { | ||
try { | ||
const response = await axios.post( | ||
"https://tell-me.store/healthcheck", | ||
userAnswer | ||
); | ||
return response; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; |
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,78 @@ | ||
import { styled } from "styled-components"; | ||
|
||
interface ProgressGageBarStatusProps | ||
extends React.HTMLAttributes<HTMLDivElement> { | ||
status: number; | ||
} | ||
|
||
export const SProgressGageBar = styled.div` | ||
width: 327px; | ||
height: 10px; | ||
background-color: #6f63e0; | ||
opacity: 0.2; | ||
margin: 0 auto; | ||
border-radius: 100px; | ||
`; | ||
|
||
export const SProgressGageBarStatus = styled.div<ProgressGageBarStatusProps>` | ||
position: relative; | ||
margin-top: -10px; | ||
width: ${(props) => props.status * 32.7}px; | ||
height: 10px; | ||
margin-left: 24px; | ||
background-color: #6f63e0; | ||
border-radius: 100px; | ||
z-index: 1; | ||
`; | ||
|
||
export const SExtraButton = styled.div` | ||
width: 44px; | ||
height: 44px; | ||
border-radius: 100px; | ||
background-color: #6f63e0; | ||
opacity: 0.2; | ||
`; | ||
|
||
export const SSelectAnswerButton = styled.button` | ||
margin: 0 10px; | ||
width: 152px; | ||
height: 60px; | ||
background-color: white; | ||
color: #6f63e0; | ||
border: none; | ||
font-size: 18px; | ||
font-weight: 700; | ||
`; | ||
|
||
export const SLoadProfileButton = styled.button` | ||
width: 327px; | ||
height: 60px; | ||
border-radius: 30px; | ||
background-color: #6f63e0; | ||
border: none; | ||
color: white; | ||
font-size: 18px; | ||
`; | ||
|
||
export const SGagebarContainer = styled.div` | ||
padding-top: 10px; | ||
margin-bottom: 8px; | ||
margin-left: 83%; | ||
color: #a299f3; | ||
`; | ||
|
||
export const SSurveyContainer = styled.div` | ||
margin: 50px 20px; | ||
padding: 50px 20px; | ||
backgroundcolor: #f9f9fd; | ||
opacity: 0.7; | ||
borderradius: 30px; | ||
`; | ||
|
||
export const SIconImage = styled.div` | ||
width: 52px; | ||
height: 52px; | ||
border-radius: 100px; | ||
background-color: skyblue; | ||
margin: 0 auto; | ||
`; |
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,67 @@ | ||
import React from "react"; | ||
import { SSelectAnswerButton } from "./SurveyPageStyle"; | ||
|
||
interface Question { | ||
id: string; | ||
userId: string; | ||
img: string; | ||
title: string; | ||
} | ||
|
||
interface Props { | ||
survey: Question[]; | ||
surveyProgress: number; | ||
onAnswerClick: (e: React.MouseEvent<HTMLButtonElement>) => void; | ||
} | ||
|
||
const SurveySection: React.FC<Props> = ({ | ||
survey, | ||
surveyProgress, | ||
onAnswerClick, | ||
}: Props) => { | ||
return ( | ||
survey[0] && ( | ||
<> | ||
<div style={{ margin: "30px 0" }}> | ||
<p>질문 {surveyProgress}</p> | ||
<p>{survey[surveyProgress - 1].title}</p> | ||
<div style={{ display: "flex", justifyContent: "center" }}> | ||
<div | ||
style={{ | ||
width: "272px", | ||
height: "258px", | ||
borderRadius: "20px", | ||
backgroundColor: "skyblue", | ||
}} | ||
> | ||
img | ||
</div> | ||
</div> | ||
<div | ||
style={{ | ||
display: "flex", | ||
justifyContent: "center", | ||
margin: "20px", | ||
}} | ||
> | ||
<SSelectAnswerButton | ||
onClick={onAnswerClick} | ||
value={survey[surveyProgress - 1].userId} | ||
> | ||
{survey[surveyProgress - 1].userId} | ||
</SSelectAnswerButton> | ||
<div>|</div> | ||
<SSelectAnswerButton | ||
onClick={onAnswerClick} | ||
value={survey[surveyProgress - 1].id} | ||
> | ||
{survey[surveyProgress - 1].id} | ||
</SSelectAnswerButton> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
); | ||
}; | ||
|
||
export default SurveySection; |
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