Commit 88e6bd35 authored by jang dong hyeok's avatar jang dong hyeok
Browse files

.

parent 036ec8c6
......@@ -18,11 +18,11 @@ export const SurveyRouter = () => {
<Route index element={<Home />} />
<Route path="login" element={<Login />} />
<Route path="signup" element={<SignUp />} />
<Route path="surveys/edit/" element={<EditResultButton />}>
<Route path=":surveyId" element={<EditSurvey />} />
<Route path=":surveyId/result" element={<ResultSurvey />} />
<Route path="surveys/:surveyId/" element={<EditResultButton />}>
<Route path="edit" element={<EditSurvey />} />
<Route path="result" element={<ResultSurvey />} />
</Route>
<Route path="surveys/:surveyId" element={<AnswerSurveyForm />} />
<Route path="survey/:surveyId" element={<AnswerSurveyForm />} />
<Route
path="profile"
element={
......
......@@ -9,13 +9,13 @@ export const Header = () => {
return (
<div className="bg-white border-b-2 border-b-themeColor px-2 sm:px-4 py-2.5">
<div className="container flex flex-wrap justify-between items-center mx-auto">
<div className="container flex flex-col md:flex-row flex-wrap justify-between items-center mx-auto">
<Link to="/" className="font-bold text-2xl text-themeColor">
Simple Survey Form
</Link>
<div className="md:flex items-center justify-end md:flex-1 lg:w-0">
{user.isLoggedIn ? (
<div>
<div className="pt-2">
<button
onClick={() => logout(() => navigate("/"))}
className="font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md"
......@@ -29,7 +29,7 @@ export const Header = () => {
</Link>
</div>
) : (
<div>
<div className="pt-2">
<Link to="/login">
<button className="font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md">
로그인
......
......@@ -16,7 +16,7 @@ export const Home = () => {
return (
<div className="flex flex-col place-items-center">
<div className="justify-end text-center text-3xl text-black h-16 mt-12">
<div className="justify-end text-center text-2xl md:text-3xl text-black h-16 mt-12">
가장 쉽게 설문지를 만드세요!
</div>
<div className="flex flex-col place-items-center container">
......
......@@ -16,7 +16,7 @@ export const MySurveyCard = ({ data }: Props) => {
const [success, setSuccess] = useState(false);
const editSurvey = () => {
navigate(`/surveys/edit/${data._id}`, {
navigate(`/surveys/${data._id}/edit`, {
replace: true,
state: { save: true },
});
......
......@@ -21,7 +21,7 @@ export const Profile = () => {
async function createSurvey() {
const newSurvey: SurveyType = await surveyApi.createSurvey(survey);
navigate(`/surveys/edit/${newSurvey._id}`, {
navigate(`/surveys/${newSurvey._id}/edit`, {
replace: true,
});
}
......@@ -36,7 +36,6 @@ export const Profile = () => {
return (
<div className="flex flex-col items-center">
<div className="mt-10 text-xl font-bold">나의 설문조사</div>
<img src={`${baseImageUrl}/9e24ad36a2947b08c89913b01`} />
<div className="grid grid-cols-1 md:grid-cols-4 sm:grid-cols-2 gap-4 mt-6">
<button
onClick={createSurvey}
......
......@@ -156,7 +156,7 @@ export const Question = ({
onChange={handleSelect}
disabled={save}
value={element.type}
className="w-36 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-themeColor w-full mr-3 p-2.5"
className="w-32 md:w-36 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-themeColor w-full mr-3 p-2.5"
>
{Array.from(QUESTION_TYPES.entries()).map(([key, value]) => (
<option
......
......@@ -17,7 +17,7 @@ export const EditResultButton = () => {
<div>
<div className="flex place-content-center mt-6">
<NavLink
to={`/surveys/edit/${surveyId}`}
to={`/surveys/${surveyId}/edit`}
style={({ isActive }) =>
isActive
? {
......@@ -33,7 +33,7 @@ export const EditResultButton = () => {
<div className="text-xl m-3 ">설문지 수정</div>
</NavLink>
<NavLink
to={`/surveys/edit/${surveyId}/result`}
to={`/surveys/${surveyId}/result`}
style={({ isActive }) =>
isActive
? {
......
......@@ -14,6 +14,7 @@ export const createSurvey = asyncWrap(
let survey = req.body;
survey.user = userId;
console.log("survey body", survey);
delete survey._id;
const newSurvey = await surveyDb.createSurvey(survey);
return res.json(newSurvey);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment