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] Filter Menu Ui #30

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0cd174e
[FE/#10] Feat : popup-state설치 및 popup 버튼 구현
Elllin Jun 15, 2020
35340c6
[FE/#10] Feat : 필터 버튼 스타일 수정, 아이콘 추가
Elllin Jun 15, 2020
36be8f7
[FE/#10] Refactor : 스타일 인라인 추가에서 useStyles이용
Elllin Jun 15, 2020
90b0771
[FE/#10] Feat : header 제외 width 80%로 조절
Elllin Jun 15, 2020
ab14111
[FE/#10] Refactor : header padding 제거
Elllin Jun 15, 2020
21992dc
[FE/#10] Feat : 팝업창 크기 조절 및 hover시 background color 효과
Elllin Jun 15, 2020
72b672b
[FE/#10] Feat : 글로벌 스타일 폰트사이즈 변경
Elllin Jun 15, 2020
e0f4762
[FE/#10] Feat : nav 위치 변경 margin 추가
Elllin Jun 15, 2020
4a2b8e4
[FE/#10] Feat : 필터 버튼 border 추가 및 변수 지정
Elllin Jun 15, 2020
1fb2101
[FE/#10] Refactor : popup 전체 사이즈 및 폰트 사이즈 변경
Elllin Jun 15, 2020
7eec740
[FE/#10] Refactor : menu list를 다른 컴포넌트로 분리
Elllin Jun 15, 2020
0e60888
[FE/#10] Feat : menuList title추가
Elllin Jun 15, 2020
7f4102c
[FE/#10] Refactor : menu list 중복 렌더 컴포넌트 없앰
Elllin Jun 15, 2020
a4cefd5
[FE/#10] Chore : menu list 재사용 가능함으로 common 폴더로 이동
Elllin Jun 15, 2020
8a03f98
[FE/#10] Refactor : menuList title에 들어갈 text를 props를 통해 받음
Elllin Jun 15, 2020
d11bd20
[FE/#10] Refactor : menuList사용법 주석 추가
Elllin Jun 15, 2020
0ed0e74
[FE/#10] Refactor : app styled component 대신 container사용
Elllin Jun 15, 2020
3d69f5d
[FE/#10] Refactor : menuList에 key값 추가
Elllin Jun 16, 2020
87281a2
[FE/#10] Refactor : navigation에 nav태그 box로 변경
Elllin Jun 16, 2020
9d39da8
[FE/#10] Refactor : styled components 사용을material ui로 변경
Elllin Jun 16, 2020
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
26 changes: 26 additions & 0 deletions FE/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions FE/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@babel/runtime-corejs3": "^7.10.2",
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",
"material-ui-popup-state": "^1.5.4",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
Expand Down
5 changes: 5 additions & 0 deletions FE/src/App.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import React from "react";

import Header from "./components/common/Header";
import Navigation from "./components/Issues/Navigation/Navigation";

import GlobalStyle from "./style/GlobalStyle";
import Container from "@material-ui/core/Container";

const App = () => {
return (
<>
<GlobalStyle />
<Header />
<Container maxWidth="lg">
<Navigation />
</Container>
</>
);
};
Expand Down
8 changes: 7 additions & 1 deletion FE/src/components/Issues/Navigation/Filter/Filter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from "react";

import Menu from "./Menu";

const Filter = () => {
return <div />;
return (
<div>
<Menu></Menu>
</div>
);
};

export default Filter;
72 changes: 71 additions & 1 deletion FE/src/components/Issues/Navigation/Filter/Menu.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,77 @@
import React from "react";

import MenuList from "../../../common/MenuList";
Copy link
Contributor

Choose a reason for hiding this comment

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

제가 작업하면서 절대경로를 추가했으니 PR 보낼 때 변경사항 알려드리겠습니다!


import Button from "@material-ui/core/Button";
import Popover from "@material-ui/core/Popover";
import PopupState, { bindTrigger, bindPopover } from "material-ui-popup-state";
Copy link
Contributor

Choose a reason for hiding this comment

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

신기하네요. MaterialUI 드롭다운 버튼 라이브러리인가요???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

popover 이 부분을 참고하여 material-ui-popup-state install 후 사용하였습니다.

import ArrowDropDownIcon from "@material-ui/icons/ArrowDropDown";
import { makeStyles } from "@material-ui/core/styles";
import grey from "@material-ui/core/colors/grey";

const mockArr = ["Filter lssues", "Open issues", "Close issues"];
const MENU_LIST_TITLE = "Filter lssues";

const Menu = () => {
return <div />;
const menuList = mockArr.map((text, i) => <MenuList text={text} key={text + i} />);

return (
<>
<PopoverPopupState menuList={menuList} />
</>
);
};

const PopoverPopupState = ({ menuList }) => {
const classes = useStyles();

return (
<PopupState variant="popover" popupId="demo-popup-popover">
{(popupState) => (
<div>
<Button
className={classes.button}
variant="contained"
color="default"
size="small"
{...bindTrigger(popupState)}
>
<span className={classes.filterText}>Filters</span>
<span>
<ArrowDropDownIcon className={classes.downIcon} />
</span>
</Button>
<Popover
{...bindPopover(popupState)}
anchorOrigin={{
vertical: "bottom",
horizontal: "center",
}}
transformOrigin={{
vertical: "top",
horizontal: "center",
}}
>
<MenuList title={MENU_LIST_TITLE} />
{menuList}
</Popover>
</div>
)}
</PopupState>
);
};

const useStyles = makeStyles((theme) => ({
button: {
border: "1px solid" + grey[400],
},
filterText: {
fontSize: 13,
fontWeight: "bold",
},
downIcon: {
verticalAlign: "middle",
},
}));

export default Menu;
10 changes: 9 additions & 1 deletion FE/src/components/Issues/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import React from "react";

import Filter from "./Filter/Filter";

import Box from "@material-ui/core/Box";

const Navigation = () => {
return <div />;
return (
<Box component="nav" mt={6} mb={5}>
<Filter />
</Box>
);
};

export default Navigation;
1 change: 0 additions & 1 deletion FE/src/components/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const HeaderWrap = styled.header`
width: 100%;
height: 55px;
background-color: #24292e;
padding: 0 16px;
line-height: 55px;
`;

Expand Down
44 changes: 44 additions & 0 deletions FE/src/components/common/MenuList.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from "react";

import Typography from "@material-ui/core/Typography";
import Box from "@material-ui/core/Box";
import { makeStyles } from "@material-ui/core/styles";
import grey from "@material-ui/core/colors/grey";

const MenuList = ({ text, title }) => {
const classes = useStyles();

const boxClassName = title ? classes.titleBox : classes.popupBox;
const boxText = title ? title : text;
const boxFontWeight = title ? "bold" : "none";

return (
<Box py={1} px={2} className={boxClassName}>
<Typography style={{ fontSize: "13px", fontWeight: boxFontWeight }}>{boxText}</Typography>
</Box>
);
};

const useStyles = makeStyles((theme) => ({
popupBox: {
width: 250,
cursor: "pointer",
borderTop: "1px solid" + grey[300],
"&:hover": {
backgroundColor: grey[200],
},
},
titleBox: {
backgroundColor: grey[200],
},
}));

export default MenuList;

// 사용 용도는 두 가지가 있습니다
// 1. title로써 상단에 사용
// 2. menuList로써 hover와 마우스 클릭이 되는 list로 사용
// title로 사용 시 : props로 title을 사용하고 title에 들어갈 text를 넣어주면 됩니다.
// (예) <MenuList title="Filter lssues" />
//menuList로 사용 시 : props로 text를 사용하고 list에 들어갈 text를 넣어주면 됩니다.
// (예) <MenuList text="Open issues" />
2 changes: 1 addition & 1 deletion FE/src/style/GlobalStyle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const GlobalStyle = createGlobalStyle`
${reset}

* {
font-size: 1rem;
font-size: 14px;
}

html, body {
Expand Down