Skip to content

Commit

Permalink
Feat: #39 props로 전달받은 정보로 모달 메뉴 아이템 렌더링
Browse files Browse the repository at this point in the history
  • Loading branch information
eve712 committed Jun 17, 2021
1 parent 27cd1f7 commit b818e65
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 21 deletions.
27 changes: 20 additions & 7 deletions FE/issue-tracker/src/components/newIssue/select/AssigneeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@ import { MenuList, MenuOptionGroup, MenuItemOption } from '@chakra-ui/react';
import { Avatar } from '@chakra-ui/avatar';
import { modalStyle, modalTitleStyle, modalListStyle } from '../style';

function AssigneeModal() {
type Props = {
assignees: { user_id: number; name: string; avatar_url: string }[] | null;
};

function AssigneeModal({ assignees }: Props) {
return (
<MenuList {...modalStyle}>
<MenuOptionGroup {...modalTitleStyle} type="checkbox" title="담당자 추가">
<MenuItemOption {...modalListStyle} value="Qbabo">
<ItemWrap>
<Avatar size="sm" src="./janmang.jpeg" />
<Text>Qbabo</Text>
</ItemWrap>
</MenuItemOption>
{assignees &&
assignees.map(({ user_id, name, avatar_url }) => {
return (
<MenuItemOption
{...modalListStyle}
value={user_id.toString()}
key={user_id}
>
<ItemWrap>
<Avatar size="sm" src={avatar_url} />
<Text>{name}</Text>
</ItemWrap>
</MenuItemOption>
);
})}
</MenuOptionGroup>
</MenuList>
);
Expand Down
33 changes: 27 additions & 6 deletions FE/issue-tracker/src/components/newIssue/select/LabelModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,36 @@ import { MenuList, MenuOptionGroup, MenuItemOption } from '@chakra-ui/react';
import Label from '@components/common/Label';
import { modalStyle, modalTitleStyle, modalListStyle } from '../style';

function LabelModal() {
type Props = {
labels:
| {
id: number;
title: string;
description: string;
color_code: string;
text_color: string;
}[]
| null;
};

function LabelModal({ labels }: Props) {
return (
<MenuList {...modalStyle}>
<MenuOptionGroup {...modalTitleStyle} type="checkbox" title="레이블 추가">
<MenuItemOption {...modalListStyle} value="Qbabo">
<ItemWrap>
<Label name="Qbabo" colorCode="#00A5B7" fontLight={true} />
</ItemWrap>
</MenuItemOption>
{labels &&
labels.map(({ id, title, color_code }) => {
return (
<MenuItemOption
{...modalListStyle}
value={id.toString()}
key={id}
>
<ItemWrap>
<Label name={title} colorCode={color_code} fontLight={true} />
</ItemWrap>
</MenuItemOption>
);
})}
</MenuOptionGroup>
</MenuList>
);
Expand Down
33 changes: 25 additions & 8 deletions FE/issue-tracker/src/components/newIssue/select/MilestoneModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,34 @@ import styled from 'styled-components';
import { MenuList, MenuOptionGroup, MenuItemOption } from '@chakra-ui/react';
import { modalStyle, modalTitleStyle, modalListStyle } from '../style';

function MilestoneModal() {
type Props = {
milestones:
| {
id: number;
title: string;
description: string;
due_date: string;
opend_issue_count: number;
closed_issue_count: number;
}[]
| null;
};

function MilestoneModal({ milestones }: Props) {
return (
<MenuList {...modalStyle}>
<MenuOptionGroup {...modalTitleStyle} type="radio" title="마일스톤 추가">
<MenuItemOption {...modalListStyle} value="DB설계">
<ItemWrap>
<span className="title">[BE] DB 설계</span>
<span className="due_date">No due date</span>
</ItemWrap>
</MenuItemOption>
{milestones &&
milestones.map(({ id, title, due_date }) => {
return (
<MenuItemOption {...modalListStyle} value={id.toString()}>
<ItemWrap>
<span className="title">{title}</span>
<span className="due_date">{due_date}</span>
</ItemWrap>
</MenuItemOption>
);
})}
</MenuOptionGroup>
</MenuList>
);
Expand All @@ -26,7 +44,6 @@ const ItemWrap = styled.div`
color: ${({ theme }) => theme.colors.gr_titleActive};
font-size: ${({ theme }) => theme.fontSizes.sm};
font-weight: ${({ theme }) => theme.fontWeights.bold};
margin-bottom: 4px;
}
.due_date {
color: ${({ theme }) => theme.colors.gr_label};
Expand Down

0 comments on commit b818e65

Please sign in to comment.