-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2c3089
commit e981fd4
Showing
7 changed files
with
160 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...rce/src/components/AdminDashboard/FeedbackNotificationsComponents/SortByFeatureButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Button, Menu, MenuItem } from "@mui/material"; | ||
import { useState } from "react"; | ||
import ExpandLessIcon from "@mui/icons-material/ExpandLess"; | ||
import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; | ||
import { featureType } from "../../FeedbackDialog"; | ||
export const SortByFeatureButton = ({ | ||
onFeatureSelected, | ||
}: { | ||
onFeatureSelected: (feature: featureType) => void; | ||
}) => { | ||
const [isActive, setIsActive] = useState<boolean>(false); | ||
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null); | ||
const [isMenuOpen, setIsMenuOpen] = useState(false); | ||
|
||
const handleClose = () => { | ||
setAnchorEl(null); | ||
setIsMenuOpen(false); | ||
setIsActive(!isActive); | ||
}; | ||
|
||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { | ||
setIsActive(true); | ||
setAnchorEl(event.currentTarget); | ||
setIsMenuOpen(true); | ||
}; | ||
|
||
const handleFeatureType = (feature: featureType) => { | ||
onFeatureSelected(feature); | ||
handleClose(); | ||
}; | ||
return ( | ||
<> | ||
<Button | ||
disableRipple | ||
disableElevation | ||
sx={{ | ||
margin: "0px 8px", | ||
paddingRight: "12px", | ||
textTransform: "none", | ||
cursor: "pointer", | ||
backgroundColor: isActive ? "#88D4D7" : "initial", | ||
color: "black", | ||
border: "1px solid lightgrey", | ||
}} | ||
endIcon={isMenuOpen ? <ExpandLessIcon /> : <ExpandMoreIcon />} | ||
variant="outlined" | ||
onClick={handleClick} | ||
> | ||
Feature type | ||
</Button> | ||
<Menu anchorEl={anchorEl} open={Boolean(anchorEl)} onClose={handleClose}> | ||
{["other", "enhancement", "bug", "new feature"].map((type) => ( | ||
<MenuItem | ||
key={type} | ||
onClick={() => handleFeatureType(type as featureType)} | ||
> | ||
{type} | ||
</MenuItem> | ||
))} | ||
</Menu> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters