This repository has been archived by the owner on Feb 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
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
13dc350
commit b22c4b1
Showing
4 changed files
with
115 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import * as React from "react"; | ||
import { IconButton, Menu, MenuItem, ListItemText, ListItemSecondaryAction, Input, ListItemIcon, Typography } from "@material-ui/core"; | ||
import { Settings, NavigateNext, NavigateBefore } from "@material-ui/icons"; | ||
|
||
interface IConfigurationMenuProps { | ||
// | ||
} | ||
|
||
interface IPagedMenuProps { | ||
} | ||
|
||
const PagedMenu: React.FC<IPagedMenuProps> = (props) => { | ||
const [selected, setSelected] = React.useState<"service-runner" | "ethereum-rpc" | null>(null); | ||
const nameMap = { | ||
"service-runner": "Service Runner RPC", | ||
"ethereum-rpc": "Ethereum RPC", | ||
}; | ||
|
||
if (selected) { | ||
return ( | ||
<> | ||
<MenuItem onClick={() => setSelected(null)}> | ||
<ListItemIcon> | ||
<NavigateBefore /> | ||
</ListItemIcon> | ||
<ListItemText> | ||
Back | ||
</ListItemText> | ||
</MenuItem> | ||
<Input placeholder={`${nameMap[selected]} Host`} fullWidth={true}/> | ||
<Input placeholder={`${nameMap[selected]} Port`} fullWidth={true}/> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<MenuItem onClick={() => setSelected("service-runner")}> | ||
<ListItemText> | ||
Service Runner RPC | ||
</ListItemText> | ||
<ListItemSecondaryAction> | ||
<NavigateNext /> | ||
</ListItemSecondaryAction> | ||
</MenuItem> | ||
<MenuItem onClick={() => setSelected("ethereum-rpc")}> | ||
<ListItemText> | ||
Ethereum RPC | ||
</ListItemText> | ||
<ListItemSecondaryAction> | ||
<NavigateNext /> | ||
</ListItemSecondaryAction> | ||
</MenuItem> | ||
</> | ||
); | ||
|
||
}; | ||
|
||
const ConfigurationMenu: React.FC<IConfigurationMenuProps> = (props) => { | ||
const [anchorEl, setAnchorEl] = React.useState<any>(null); | ||
const open = !!anchorEl; | ||
|
||
function handleMenu(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) { | ||
setAnchorEl(event.currentTarget); | ||
} | ||
|
||
function handleClose() { | ||
setAnchorEl(null); | ||
} | ||
|
||
return ( | ||
<> | ||
<IconButton | ||
aria-label="Account of current user" | ||
aria-controls="menu-appbar" | ||
aria-haspopup="true" | ||
onClick={handleMenu} | ||
color="inherit" | ||
> | ||
<Settings /> | ||
</IconButton> | ||
<Menu | ||
id="menu-appbar" | ||
getContentAnchorEl={null} | ||
anchorEl={anchorEl} | ||
keepMounted | ||
open={open} | ||
PaperProps={{ | ||
style: { | ||
width: "250px", | ||
}, | ||
}} | ||
anchorOrigin={{ | ||
vertical: "bottom", | ||
horizontal: "center", | ||
}} | ||
transformOrigin={{ | ||
vertical: "top", | ||
horizontal: "center", | ||
}} | ||
onClose={handleClose} | ||
> | ||
<PagedMenu></PagedMenu> | ||
</Menu> | ||
</> | ||
); | ||
}; | ||
|
||
export default ConfigurationMenu; |
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,2 @@ | ||
import ConfigurationMenu from "./ConfigurationMenu"; | ||
export default ConfigurationMenu; |
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