Skip to content
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

[FE][Feature] RetroList 회고 수정 모달 창 생성 #136

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AuthPage from '@/pages/AuthPage';
import CreateRetroPage from '@/pages/CreateRetroPage';
import HomePage from '@/pages/HomePage';
import MyPage from '@/pages/MyPage';
import RetroListPage from '@/pages/RetroListPage';
import SurveyPage from '@/pages/SurveyPage';
import WriteRetroPersonalPage from '@/pages/WriteRetroPersonalPage';
import WriteRetroRevisePage from '@/pages/WriteRetroRevisePage';
Expand Down
Binary file added src/assets/ModalClose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions src/components/RetroList/ContentsList.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import React, { useState } from 'react';
import BookmarkIcon_Y from '@/assets/BookmarkIcon_Y.png';
import LinkIcon from '@/assets/Link.png';
import MoreIcon from '@/assets/MoreIcon.png';
import ProgressBefore from '@/assets/Progress_Before.png';
import Thumbnail from '@/assets/Thumbnail.png';
import Modal from '@/components/RetroList/Modal';
import * as S from '@/styles/RetroList/ContentsList.styles';

interface Content {
Expand All @@ -21,6 +22,16 @@ interface ContentListProps {
}

const ContentList: React.FC<ContentListProps> = ({ status, viewMode, searchData }) => {
const [openModalId, setOpenModalId] = useState<number | null>(null);

const openModalForItem = (itemId: number) => {
setOpenModalId(itemId);
};

const closeModalForItem = () => {
setOpenModalId(null);
};

const data: Content[] = [
{ id: 1, title: '회고1', status: 'Teams', userId: null, teamId: 1 },
{ id: 2, title: '회고2', status: 'Teams', userId: null, teamId: 2 },
Expand Down Expand Up @@ -53,7 +64,8 @@ const ContentList: React.FC<ContentListProps> = ({ status, viewMode, searchData
<hr />
<S.InfoBox>
{item.title}
<S.MoreIcon src={MoreIcon} />
<S.MoreIcon src={MoreIcon} onClick={() => openModalForItem(item.id)} />
<Modal onClose={closeModalForItem} isOpen={openModalId === item.id} />
</S.InfoBox>
</S.Box>
))}
Expand Down
24 changes: 24 additions & 0 deletions src/components/RetroList/Modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import ModalClose from '@/assets/modalClose.png';
import * as S from '@/styles/RetroList/Modal.styles';

interface ModalProps {
onClose: () => void;
isOpen: boolean;
}

const Modal: React.FC<ModalProps> = ({ onClose, isOpen }) => {
return (
<S.ModalOverlay isOpen={isOpen}>
<S.ModalContent>
<div>
<S.CloseBox>
<S.CloseImg src={ModalClose} onClick={onClose} />
</S.CloseBox>
<S.Text>생성자가 아닌 참여자는 수정 권한이 없습니다.</S.Text>
</div>
</S.ModalContent>
</S.ModalOverlay>
);
};

export default Modal;
37 changes: 37 additions & 0 deletions src/styles/RetroList/Modal.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import styled from 'styled-components';

export const ModalOverlay = styled.div<{ isOpen: boolean }>`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: ${props => (props.isOpen ? 'flex' : 'none')};
justify-content: center;
align-items: center;
`;

export const ModalContent = styled.div`
background-color: white;
padding: 20px;
border-radius: 8px;
`;
export const CloseBox = styled.div`
display: flex;
justify-content: flex-end;
border-bottom: 1px solid #b5b5b5;
margin-bottom: 10px;
padding-bottom: 10px;
margin-top: 0;
`;

export const CloseImg = styled.img`
width: 10px;
height: 10px;
cursor: pointer;
`;

export const Text = styled.span`
color: #111b47;
`;
Loading