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] Issue sidebar component #229

Merged
merged 3 commits into from
Nov 9, 2020
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 web/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"styled-components": "^5.2.1",
"styled-icons": "^10.22.0",
"styled-reset": "^4.3.0",
"ts-loader": "^8.0.10",
"typescript": "^4.0.5",
Expand Down
24 changes: 24 additions & 0 deletions web/client/src/components/issue-sidebar/item/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, {useState} from 'react'
import * as S from './style'

interface IssueSideBarItemProps {
menuName: string,
children: React.ReactNode
}

export default function IssueSideBarItem({menuName, children} : IssueSideBarItemProps) {
const [isHover, setIsHover] = useState<boolean>(false);

return (
<S.ItemWrapper>
<S.ItemHead>
<S.MenuName onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)} isHover={isHover}>{menuName}</S.MenuName>
<S.SettingIcon onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)} isHover={isHover}/>
</S.ItemHead>

<S.ItemBody>
{children}
</S.ItemBody>
</S.ItemWrapper>
)
}
Comment on lines +9 to +24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

childeren 을 받아서 재활용 할 수 있어서 좋은 것 같습니다!

38 changes: 38 additions & 0 deletions web/client/src/components/issue-sidebar/item/style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import styled from 'styled-components';
import {Settings} from '@styled-icons/ionicons-sharp/Settings';

export const SettingIcon = styled(Settings)<{isHover: boolean}>`
display: block;
color: ${props => props.isHover ? '#5490E2' : 'grey'};

width: 15px;
height: 15px;
`;

export const ItemWrapper = styled.div`
padding: 10px;


width: 280px;
`;

export const ItemHead = styled.div`
display: flex;
justify-content: space-between;
align-items: center;

margin-bottom: 10px;

box-sizing: border-box;
`;

export const MenuName = styled.div<{isHover: boolean}>`
color: ${props => props.isHover ? '#5490E2' : '#555'};
font-weight: 700;
`;

export const ItemBody = styled.div`
padding-bottom: 20px;

border-bottom : 1px solid #ccc;
`;
51 changes: 51 additions & 0 deletions web/client/src/components/issue-sidebar/sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react'
import * as S from './style';
import ProfileImage from '../../profile-image';
import IssueSideBarItem from '../item';

interface AsigneeProfileProps {
userName:string,
img: string
}

function AssigneeProfile ({userName, img} : AsigneeProfileProps) {
return (
<S.AssigneeProfileWrapper>
<ProfileImage img={img} size={20}/>
<S.AssigneeName>{userName}</S.AssigneeName>
</S.AssigneeProfileWrapper>
)
}

interface LabelProps {
name: string,
color: string
}

function Label({name, color} :LabelProps) {
return (
<S.LabelWrapper color={color}>{name}</S.LabelWrapper>
)
}


export default function IssueSideBar() {
return (
<>
<IssueSideBarItem menuName="Assignees">
<div>
<AssigneeProfile userName="moaikang" img=""/>
<AssigneeProfile userName="moaikang" img=""/>
</div>
</IssueSideBarItem>

<IssueSideBarItem menuName="Labels">
<Label name="라벨" color="#A3EEEF"/>
</IssueSideBarItem>

<IssueSideBarItem menuName="Milestone">
<div>Progress Commponent</div>
</IssueSideBarItem>
</>
)
}
27 changes: 27 additions & 0 deletions web/client/src/components/issue-sidebar/sidebar/style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import styled from 'styled-components';

export const AssigneeProfileWrapper = styled.div`
display: flex;
align-items: center;

margin-bottom: 7px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pixel 로 margin 을 설정하면 화면 크기에 따라 모양이 바뀌지 않을까요?

`

export const AssigneeName = styled.div`
margin-left: 10px;

font-weight: 700;
color: #333;
`;

export const LabelWrapper = styled.div<{color: string}>`
padding: 6px 5px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 margin 부분과 마찬가지 입니다


border-radius: 6px;

background: ${props => props.color};

font-weight: 700;

box-sizing:border-box;
`;