diff --git a/src/App.tsx b/src/App.tsx index 5fb7ad1..e44f77f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,6 @@ import React from "react"; import "./App.css"; import { Route, Routes } from "react-router-dom"; -import MainPage from "./pages/MainPage"; import Navbar from "./components/common/Navbar"; import JDDetailPage from "./pages/JDDetailPage"; import JDPlusPage from "./pages/JDPlusPage"; @@ -18,6 +17,7 @@ import InfoPage from "./pages/InfoPage"; import ApplyEditPage from "./pages/ApplyEditPage"; import ApplyPage from "./pages/ApplyPage"; import JDEditPage from "./pages/JDEditPage"; +import ExperienceEditPage from "./pages/ExperienceEditPage"; const App: React.FC = () => { return ( @@ -60,6 +60,12 @@ const App: React.FC = () => { element={} /> + } path="/"> + } + /> + } /> } path="/"> } /> diff --git a/src/components/JD/ExpContainer.tsx b/src/components/JD/ExpContainer.tsx index 29dc753..e7f56b3 100644 --- a/src/components/JD/ExpContainer.tsx +++ b/src/components/JD/ExpContainer.tsx @@ -8,12 +8,12 @@ import JDChip from "./JDChip"; import ArrowIcon from "../../assets/icons/icon_arrow_right_main500.svg"; interface JobContainerProps { - expId: number; + expId: number | string; } const ExperienceBox: React.FC = ({ expId }) => { - const expData = ExpData[expId - 1]; - const [detailId, setDetailId] = useRecoilState(detailStore); + const expData = ExpData[0]; + const [detailId, setDetailId] = useRecoilState(detailStore); return ( @@ -68,32 +68,32 @@ const ExperienceBox: React.FC = ({ expId }) => { export default ExperienceBox; const ScrollDiv = styled.div` - width: 100%; - overflow-y: auto; - &::-webkit-scrollbar { - width: 4px; - } - &::-webkit-scrollbar-thumb { - border-radius: 2px; - background: #ccc; - } - ::-webkit-scrollbar-track { - } + width: 100%; + overflow-y: auto; + &::-webkit-scrollbar { + width: 4px; + } + &::-webkit-scrollbar-thumb { + border-radius: 2px; + background: #ccc; + } + ::-webkit-scrollbar-track { + } `; const ExpContainer = styled.div` - display: flex; - flex-direction: column; - width: 100%; - height: 40rem; - align-items: flex-start; - gap: 0.625rem; - //padding: 2rem; - flex-shrink: 0; - border-radius: 0.9rem; - border: 1px solid var(--neutral-200, #EEEFF7); - background: var(--neutral-0, #FFF); - //min-height: 100rem; + display: flex; + flex-direction: column; + width: 100%; + height: 40rem; + align-items: flex-start; + gap: 0.625rem; + //padding: 2rem; + flex-shrink: 0; + border-radius: 0.9rem; + border: 1px solid var(--neutral-200, #eeeff7); + background: var(--neutral-0, #fff); + //min-height: 100rem; `; const TagContainer = styled.div` @@ -114,7 +114,7 @@ const ButtonContainer = styled.div` flex-direction: row; align-items: center; color: ${(props) => props.theme.colors.neutral600}; - div{ + div { width: 100%; ${(props) => props.theme.fonts.cap3}; } @@ -145,7 +145,7 @@ const SubContainer = styled.div` gap: 0.75rem; color: ${(props) => props.theme.colors.neutral500}; ${(props) => props.theme.fonts.body4}; - border-bottom: 1px solid ${(props) => props.theme.colors.neutral300}; + border-bottom: 1px solid ${(props) => props.theme.colors.neutral300}; padding-bottom: 1.25rem; `; @@ -161,42 +161,42 @@ const TopContainer = styled.div` `; const ExpBottomBox = styled.div` - height: 27rem; - color: var(--neutral-700, #343A5D); - //overflow-y: scroll; - margin: 0rem 0rem 2rem 2rem; + height: 27rem; + color: var(--neutral-700, #343a5d); + //overflow-y: scroll; + margin: 0rem 0rem 2rem 2rem; `; const ChipWrapper = styled.div` - display: flex; - align-items: center; - text-align: center; + display: flex; + align-items: center; + text-align: center; `; const QuestionsWrapper = styled.div` - width: 100%; - display: flex; - padding-right: 1.5rem; - flex-direction: column; - justify-content: start; - margin-top: 1.25rem; - .question-title{ - margin-top: 0.5rem; - ${(props) => props.theme.fonts.subtitle3}; - color: ${(props) => props.theme.colors.neutral700}; - } + width: 100%; + display: flex; + padding-right: 1.5rem; + flex-direction: column; + justify-content: start; + margin-top: 1.25rem; + .question-title { + margin-top: 0.5rem; + ${(props) => props.theme.fonts.subtitle3}; + color: ${(props) => props.theme.colors.neutral700}; + } `; const AnswerWrapper = styled.div` - width: 100%; - display: flex; - padding: 1rem 1.125rem; - align-items: center; - gap: 0.625rem; - border-radius: 0.75rem; - height: 6rem; - background: ${(props) => props.theme.colors.neutral50}; - margin-top: 0.75rem; + width: 100%; + display: flex; + padding: 1rem 1.125rem; + align-items: center; + gap: 0.625rem; + border-radius: 0.75rem; + height: 6rem; + background: ${(props) => props.theme.colors.neutral50}; + margin-top: 0.75rem; `; const AnswerText = styled.div<{ isEmpty: boolean }>` diff --git a/src/components/JD/Experience.tsx b/src/components/JD/Experience.tsx index e2ce511..97cd274 100644 --- a/src/components/JD/Experience.tsx +++ b/src/components/JD/Experience.tsx @@ -5,17 +5,20 @@ import { detailStore } from "../../store/jdStore"; import { Question } from "../../types/type"; import bookmarkFillIcon from "../../assets/icons/icon_bookmark_fill.svg"; import bookmarkBlankIcon from "../../assets/icons/icon_bookmark_blank.svg"; +import dayjs from "dayjs"; interface ExpProps { type?: "card" | "section"; - id: number; + id: string | number; title: string; tags: string[]; maintag: string; subtag: string; - period: string; + period?: string; bookmark?: boolean; question?: number; + startedAt?: string; + endedAt?: string; detail?: Question[]; checkedKeywords?: string[]; onClick?: () => void; @@ -29,7 +32,8 @@ const Experience: React.FC = ({ maintag, subtag, bookmark, - period, + startedAt, + endedAt, question, detail, checkedKeywords, @@ -90,7 +94,10 @@ const Experience: React.FC = ({
{maintag + ">" + subtag}
|
-
{period}
+
+ {dayjs(new Date(startedAt || new Date())).format("YYYY.MM.DD")}~ + {dayjs(new Date(endedAt || new Date())).format("YYYY.MM.DD")} +
{question ? ( diff --git a/src/components/common/Navbar.tsx b/src/components/common/Navbar.tsx index db8cf62..9c92af4 100644 --- a/src/components/common/Navbar.tsx +++ b/src/components/common/Navbar.tsx @@ -34,7 +34,7 @@ const Navbar = () => { - + {user?.token ? ( <> { const [completed, setCompleted] = useState(false); //작성 완료 const [isAllFilled, setIsAllFilled] = useState(false); // 문항이 빈칸이 없는지 검사 - const [detailId, setDetailId] = useRecoilState(detailStore); //경험의 고유 id(0이 아니여야함) + const [detailId, setDetailId] = useRecoilState(detailStore); //경험의 고유 id(0이 아니여야함) const [isModalOpen, setIsModalOpen] = useState(false); // 문항 삭제 모달 const [discardModal, setdiscardModal] = useState(false); // 작성내용 버리기 모달 const [deleteIdx, setDeleteIdx] = useState(-1); //modal 열기전 삭제할 index 저장 @@ -346,7 +346,7 @@ const StyledDivContainer = styled.div` flex-direction: column; align-items: center; position: relative; - background-color: #FBFBFD; + background-color: #fbfbfd; overflow-x: hidden; `; @@ -393,7 +393,7 @@ const TopTitleBar = styled.div` const Title = styled.h1` display: flex; flex-direction: row; - color:#343A5D; + color: #343a5d; align-items: center; `; @@ -406,68 +406,68 @@ const TopWrapper = styled.div` `; const TextCountWrapper = styled.div` - display: flex; - justify-content: end; - width: 100%; - color: ${(props) => props.theme.colors.neutral500}; - ${(props) => props.theme.fonts.cap3} + display: flex; + justify-content: end; + width: 100%; + color: ${(props) => props.theme.colors.neutral500}; + ${(props) => props.theme.fonts.cap3} `; const SaveButton = styled.button<{ isNotNull: boolean }>` - display: inline-flex; - padding: 0.625rem 4rem; - justify-content: center; - align-items: center; - color:#FFF; - gap: 0.625rem; - font-size: 1rem; - font-style: normal; - font-weight: 700; - border: 1px solid transparent; - border-radius: 0.5rem; - background: ${(props) => props.theme.colors.neutral500}; + display: inline-flex; + padding: 0.625rem 4rem; + justify-content: center; + align-items: center; + color: #fff; + gap: 0.625rem; + font-size: 1rem; + font-style: normal; + font-weight: 700; + border: 1px solid transparent; + border-radius: 0.5rem; + background: ${(props) => props.theme.colors.neutral500}; ${(props) => props.isNotNull && css` - background: ${(props) => props.theme.colors.main500}; + background: ${(props) => props.theme.colors.main500}; `} `; const EditButton = styled.button<{ iscanEdit: boolean }>` - display: inline-flex; - padding: 0.625rem 4rem; - justify-content: center; - align-items: center; - color:#A6AAC0; - gap: 0.625rem; - font-size: 1rem; - font-style: normal; - font-weight: 700; - border-radius: 0.5rem; - border: 1px solid ${(props) => props.theme.colors.main500}; - background: #FFF; - ${(props) => props.theme.fonts.button2} - color: ${(props) => props.theme.colors.main500}; + display: inline-flex; + padding: 0.625rem 4rem; + justify-content: center; + align-items: center; + color: #a6aac0; + gap: 0.625rem; + font-size: 1rem; + font-style: normal; + font-weight: 700; + border-radius: 0.5rem; + border: 1px solid ${(props) => props.theme.colors.main500}; + background: #fff; + ${(props) => props.theme.fonts.button2} + color: ${(props) => props.theme.colors.main500}; ${(props) => props.iscanEdit && css` - border: 1px solid var(--neutral-500, #A6AAC0); - color: ${(props) => props.theme.colors.neutral500}; + border: 1px solid var(--neutral-500, #a6aac0); + color: ${(props) => props.theme.colors.neutral500}; `} `; const ToggleWrapper = styled.div` - display: inline-flex; - flex-direction: row; - color: var(--neutral-700, #343A5D); - font-family: Pretendard; - font-size: 1rem; - font-style: normal; - font-weight: 500; - line-height: 1.25rem; - letter-spacing: -0.02rem; - gap: 0.75rem; - align-items: center; + display: inline-flex; + flex-direction: row; + color: var(--neutral-700, #343a5d); + font-family: Pretendard; + font-size: 1rem; + font-style: normal; + font-weight: 500; + line-height: 1.25rem; + letter-spacing: -0.02rem; + gap: 0.75rem; + align-items: center; `; const MainContainer = styled.div` @@ -476,11 +476,11 @@ const MainContainer = styled.div` position: relative; justify-content: center; overflow: hidden; - background-color: #FBFBFD; + background-color: #fbfbfd; `; const CenteredContainer = styled(motion.div)` - /* width: 100%; + /* width: 100%; border-radius: 10px; background: transparent; padding: 2rem; @@ -488,46 +488,46 @@ const CenteredContainer = styled(motion.div)` flex-direction: column; min-height: 30rem; margin: 0.5rem 0.25rem 0.5rem 0.5rem; */ - width: 100%; - border-radius: 10px; - background: transparent; - padding: 2rem; - display: flex; - flex-direction: column; - //min-height: 100rem; + width: 100%; + border-radius: 10px; + background: transparent; + padding: 2rem; + display: flex; + flex-direction: column; + //min-height: 100rem; `; const ScrollDiv = styled.div` - overflow-y: auto; - overflow-x: hidden; - &::-webkit-scrollbar { - width: 4px; - } - &::-webkit-scrollbar-thumb { - border-radius: 2px; - background: #ccc; - } - ::-webkit-scrollbar-track { - } + overflow-y: auto; + overflow-x: hidden; + &::-webkit-scrollbar { + width: 4px; + } + &::-webkit-scrollbar-thumb { + border-radius: 2px; + background: #ccc; + } + ::-webkit-scrollbar-track { + } `; const EditContainer = styled.div` - width: 100%; - align-items: flex-start; - min-height: 15rem; - padding: 2rem 0rem; - gap: 0.625rem; - flex-shrink: 0; - border-radius: 0.9rem; - border: 1px solid var(--neutral-200, #EEEFF7); - background: var(--neutral-0, #FFF); + width: 100%; + align-items: flex-start; + min-height: 15rem; + padding: 2rem 0rem; + gap: 0.625rem; + flex-shrink: 0; + border-radius: 0.9rem; + border: 1px solid var(--neutral-200, #eeeff7); + background: var(--neutral-0, #fff); `; const ActiveContainer = styled(motion.div)<{ isActive: boolean }>` width: 45%; border-radius: 10px; - margin: 0 3.5rem; - margin-top : 10rem; + margin: 0 3.5rem; + margin-top: 10rem; background: ${(props) => (props.isActive ? "#FFF" : "#F7F7FB")}; //background: red; box-shadow: 5px 5px 10px 0px rgba(166, 170, 192, 0.09); @@ -535,7 +535,7 @@ const ActiveContainer = styled(motion.div)<{ isActive: boolean }>` `; const buttonActiveStyle = css` - background: #7D82FF; + background: #7d82ff; `; interface ButtonProps { @@ -551,7 +551,7 @@ const JDButton = styled.button` flex-shrink: 0; border: none; border-radius: 0.66019rem 0rem 0rem 0.66019rem; - background: var(--neutral-300, #EAEBF3); + background: var(--neutral-300, #eaebf3); ${({ active }) => active && buttonActiveStyle} `; @@ -564,56 +564,56 @@ const ExperienceButton = styled.button` flex-shrink: 0; border: none; border-radius: 0.66019rem 0rem 0rem 0.66019rem; - background: var(--neutral-300, #EAEBF3); + background: var(--neutral-300, #eaebf3); ${({ active }) => active && buttonActiveStyle} `; const QuestionsWrapper = styled.div` - height: 30rem; - color: var(--neutral-700, #343A5D); - padding: 0 2rem; - .img_box { - display: flex; - align-items: center; - justify-content: center; - } - //overflow-y: scroll; + height: 30rem; + color: var(--neutral-700, #343a5d); + padding: 0 2rem; + .img_box { + display: flex; + align-items: center; + justify-content: center; + } + //overflow-y: scroll; `; const AnswersWrapper = styled.div` - height: 30rem; - color: var(--neutral-700, #343A5D); - padding: 0 2rem; - //overflow-y: scroll; + height: 30rem; + color: var(--neutral-700, #343a5d); + padding: 0 2rem; + //overflow-y: scroll; `; const Answer = styled.div` - margin-bottom: 1.75rem; - ${(props) => props.theme.fonts.body5}; + margin-bottom: 1.75rem; + ${(props) => props.theme.fonts.body5}; `; const AnswerHeader = styled.h3` - color: var(--neutral-700, #343A5D); - /* subtitle 3 (semibold 16pt) */ - ${(props) => props.theme.fonts.subtitle3} - margin-bottom: 1rem; + color: var(--neutral-700, #343a5d); + /* subtitle 3 (semibold 16pt) */ + ${(props) => props.theme.fonts.subtitle3} + margin-bottom: 1rem; `; const AnswerContent = styled.p` - color: var(--neutral-700, #343A5D); - /* body 5 (regular 13pt) */ - border-top: 1px solid #EAEBF3; - padding: 1.25rem; - ${(props) => props.theme.fonts.body5}; + color: var(--neutral-700, #343a5d); + /* body 5 (regular 13pt) */ + border-top: 1px solid #eaebf3; + padding: 1.25rem; + ${(props) => props.theme.fonts.body5}; `; const ButtonText = styled.div` - display: flex; - width: 1rem; - ${(props) => props.theme.fonts.body5}; - height: 5rem; - flex-direction: column; - justify-content: center; - flex-shrink: 0; - color: ${({ active }) => (active ? "#FFFFFF" : "#63698D")}; + display: flex; + width: 1rem; + ${(props) => props.theme.fonts.body5}; + height: 5rem; + flex-direction: column; + justify-content: center; + flex-shrink: 0; + color: ${({ active }) => (active ? "#FFFFFF" : "#63698D")}; `; diff --git a/src/pages/ExperienceDetailPage.tsx b/src/pages/ExperienceDetailPage.tsx index 4e25922..a3ad11a 100644 --- a/src/pages/ExperienceDetailPage.tsx +++ b/src/pages/ExperienceDetailPage.tsx @@ -8,74 +8,129 @@ import ExpData from "../services/JD/ExpData"; import { questions } from "../assets/data/questions"; import Chip from "../components/common/Chip"; import Textarea from "../components/common/Textarea"; +import { + deleteExperience, + getExperience, +} from "../services/Experience/experienceApi"; +import { ExperienceDetailType } from "../types/experience"; +import { getCookie } from "../services/cookie"; +import Modal from "../components/common/Modal"; +import warningImg from "../assets/images/warningIcon.png"; const ExperienceDetailPage = () => { + const user = getCookie("user"); + const { id: expId } = useParams(); const navigate = useNavigate(); const theme = useTheme(); + const [expData, setExpData] = React.useState(); + const primeTag = expData?.parentTag.name || "상위태그값없음"; + const subTag = expData?.childTag.name || "하위태그값없음"; + const expKeywords = expData?.strongPoints?.map((item) => item.name) || []; - const { id } = useParams(); + // 삭제 모달 + const [isModalOpen, setIsModalOpen] = React.useState(false); + + // 모달 관리 + const openModal = () => { + setIsModalOpen(true); + }; + const closeModal = () => { + setIsModalOpen(false); + }; + + const handleDelete = () => { + if (expId) { + deleteExperience(expId, user?.token).then((res) => { + console.log(res); + navigate(`/experience`); + }); + } + }; React.useEffect(() => { - window.scrollTo({ - top: 0, - behavior: "auto", - }); - }, []); + if (expId) { + getExperience(expId, user?.token).then((res) => { + console.log(res); + setExpData(res.data); + }); + } + }, [expId, user?.token]); return ( - - -
- - 나의 경험 상세보기 -
- 수정하기 -
- - -
- - {questions.map((item, index) => ( - -
- -
-