From c8add5f828c6604a03e1acffcee4d1bc8ba61bdf Mon Sep 17 00:00:00 2001 From: seungju Date: Wed, 17 Apr 2024 12:08:52 +0900 Subject: [PATCH] feat: study invite modal --- modals/study/StudyInviteModal.tsx | 51 +++++++++++++--------------- pageTemplates/study/StudyDateBar.tsx | 9 ++++- pages/study/[id]/[date]/index.tsx | 2 +- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/modals/study/StudyInviteModal.tsx b/modals/study/StudyInviteModal.tsx index b3026eed7..eae2009ae 100644 --- a/modals/study/StudyInviteModal.tsx +++ b/modals/study/StudyInviteModal.tsx @@ -1,10 +1,9 @@ -import { Button, ModalFooter } from "@chakra-ui/react"; +import { Button } from "@chakra-ui/react"; import { useRouter } from "next/router"; import { useSession } from "next-auth/react"; import { useEffect, useState } from "react"; import styled from "styled-components"; -import { SQUARE_RANDOM_IMAGE } from "../../assets/images/imageUrl"; import { WEB_URL } from "../../constants/system"; import { ModalSubtitle } from "../../styles/layout/modal"; import { IModal } from "../../types/components/modalTypes"; @@ -43,7 +42,7 @@ function StudyInviteModal({ setIsModal, place }: IStudyInviteModal) { content: { title: "같이 스터디 할래?", description: place?.fullname, - imageUrl: SQUARE_RANDOM_IMAGE[randomNum], + imageUrl: place.image, link: { mobileWebUrl: url, webUrl: url, @@ -68,30 +67,28 @@ function StudyInviteModal({ setIsModal, place }: IStudyInviteModal) { const footerOptions: IFooterOptions = { children: ( - - - - - - + + + + ), }; diff --git a/pageTemplates/study/StudyDateBar.tsx b/pageTemplates/study/StudyDateBar.tsx index d78b42108..eb828f4a3 100644 --- a/pageTemplates/study/StudyDateBar.tsx +++ b/pageTemplates/study/StudyDateBar.tsx @@ -3,15 +3,20 @@ import { faPlus } from "@fortawesome/pro-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import dayjs from "dayjs"; import { useParams } from "next/navigation"; +import { useState } from "react"; import styled from "styled-components"; +import StudyInviteModal from "../../modals/study/StudyInviteModal"; +import { IPlace } from "../../types/models/studyTypes/studyDetails"; import { dayjsToFormat } from "../../utils/dateTimeUtils"; interface IStudyDateBar { isPrivateStudy: boolean; + place: IPlace; } -function StudyDateBar({ isPrivateStudy }: IStudyDateBar) { +function StudyDateBar({ isPrivateStudy, place }: IStudyDateBar) { const { date } = useParams<{ date: string }>(); + const [isInviteModal, setIsInviteModal] = useState(false); return ( <> @@ -27,11 +32,13 @@ function StudyDateBar({ isPrivateStudy }: IStudyDateBar) { rightIcon={} padding="0 var(--gap-2)" borderColor="var(--gray-5)" + onClick={() => setIsInviteModal(true)} > 친구초대 )} + {isInviteModal && } ); } diff --git a/pages/study/[id]/[date]/index.tsx b/pages/study/[id]/[date]/index.tsx index 1e112a2bb..82564bb96 100644 --- a/pages/study/[id]/[date]/index.tsx +++ b/pages/study/[id]/[date]/index.tsx @@ -78,7 +78,7 @@ export default function Page() { )} - + {!isPrivateStudy && ( )}