-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from all commits
0cd174e
35340c6
36be8f7
90b0771
ab14111
21992dc
72b672b
e0f4762
4a2b8e4
1fb2101
7eec740
0e60888
7f4102c
a4cefd5
8a03f98
d11bd20
0ed0e74
3d69f5d
87281a2
9d39da8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,77 @@ | ||
import React from "react"; | ||
|
||
import MenuList from "../../../common/MenuList"; | ||
|
||
import Button from "@material-ui/core/Button"; | ||
import Popover from "@material-ui/core/Popover"; | ||
import PopupState, { bindTrigger, bindPopover } from "material-ui-popup-state"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 신기하네요. MaterialUI 드롭다운 버튼 라이브러리인가요??? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; |
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; |
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" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ const GlobalStyle = createGlobalStyle` | |
${reset} | ||
|
||
* { | ||
font-size: 1rem; | ||
font-size: 14px; | ||
} | ||
|
||
html, body { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 작업하면서 절대경로를 추가했으니 PR 보낼 때 변경사항 알려드리겠습니다!