Nav bar opens all menus simultaneously upon clicking - html

This code snippet is my nav bar for an admin user. The intended behavior is that there are 3 icons (navigation menu, user menu, and manage button icons). The issue is that the drop down items from each of these icons all display when clicking on any of the icons. The intended behavior is to get each dropdown menu to display the selected information for that given icon.
function NavbarAdmin() {
const classes = navbarStyle();
const [anchorEl, setAnchorEl] = React.useState(null);
const isMenuOpen = Boolean(anchorEl);
const handleProfileMenuOpen = (event) => {
setAnchorEl(event.currentTarget);
};
const handleNavMenuOpen = (event) => {
setAnchorEl(event.currentTarget);
};
const handleManageMenuOpen = (event) => {
setAnchorEl(event.currentTarget);
};
const handleMenuClose = () => {
setAnchorEl(null);
};
const userMenu = (
<Menu
anchorEl={anchorEl}
anchorOrigin={{ vertical: 'top', horizontal: 'left' }}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'left' }}
open={isMenuOpen}
onClose={handleMenuClose}
>
<MenuItem onClick={handleMenuClose}>Profile</MenuItem>
<MenuItem onClick={handleMenuClose}>My account</MenuItem>
<MenuItem onClick={handleMenuClose}>Sign Out</MenuItem>
</Menu>
);
const navMenu = (
<Menu
anchorEl={anchorEl}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
open={isMenuOpen}
onClose={handleMenuClose}
>
<MenuItem onClick={handleMenuClose}>Home</MenuItem>
<MenuItem onClick={handleMenuClose}>Movies</MenuItem>
<MenuItem onClick={handleMenuClose}>Concessions</MenuItem>
<MenuItem onClick={handleMenuClose}>Showtimes</MenuItem>
</Menu>
);
const manageMenu = (
<Menu
anchorEl={anchorEl}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
open={isMenuOpen}
onClose={handleMenuClose}
>
<MenuItem onClick={handleMenuClose}>Movies</MenuItem>
<MenuItem onClick={handleMenuClose}>Seats</MenuItem>
<MenuItem onClick={handleMenuClose}>Test</MenuItem>
<MenuItem onClick={handleMenuClose}>Test</MenuItem>
<MenuItem onClick={handleMenuClose}>Test</MenuItem>
<MenuItem onClick={handleMenuClose}>Test</MenuItem>
</Menu>
);
return (
<div className={classes.grow}>
<AppBar position="static">
<Toolbar>
<IconButton
edge="start" className={classes.menuButton}
color="inherit"
aria-label="nav account"
aria-haspopup="true"
onClick={handleNavMenuOpen}
color="inherit"
>
<MenuIcon />
</IconButton>
<Typography className={classes.acptheater} variant="h6" noWrap>
ACP Theater
</Typography>
<div className={classes.grow} />
<div>
<IconButton aria-label="show messages" color="inherit">
<Badge badgeContent={1} color="secondary">
<MailIcon />
</Badge>
</IconButton>
<IconButton
edge="end" className={classes.menuButton}
aria-label="user account"
aria-haspopup="true"
onClick={handleProfileMenuOpen}
color="inherit"
>
<AccountCircle />
</IconButton>
<Button
edge="end" className={classes.menuButton}
aria-label="user account"
aria-haspopup="true"
onClick={handleManageMenuOpen}
color="inherit"color="inherit"
>
Manage</Button>
<Button color="inherit">Login</Button>
</div>
</Toolbar>
</AppBar>
{manageMenu}
{navMenu}
{userMenu}
</div>
);
}

All three <Menu...s have anchorEl={anchorEl} - so whatever is set on state setAnchorEl() will match all three.
Those <Menu parameters should be hard-coded with the desired match value.
Example:
const handleProfileMenuOpen = (event) => {
setAnchorEl('menuProfile');
};
...
const userMenu = (
<Menu
anchorEl={'menuProfile'} <== this is the important one... right now all 3 are set to whatever was just clicked

function NavbarAdmin() {
const classes = navbarStyle();
const [anchorEl1, setAnchorEl1] = React.useState(null);
const [anchorEl2, setAnchorEl2] = React.useState(null);
const [anchorEl3, setAnchorEl3] = React.useState(null);
const isNavMenuOpen = Boolean(anchorEl1);
const isProfileMenuOpen = Boolean(anchorEl2);
const isManageMenuOpen = Boolean(anchorEl3);
const handleNavMenuOpen = (event) => {
setAnchorEl1(event.currentTarget);
}
const handleProfileMenuOpen = (event) => {
setAnchorEl2(event.currentTarget);
};
const handleManageMenuOpen = (event) => {
setAnchorEl3(event.currentTarget);
};
const handleNavMenuClose = () => {
setAnchorEl1(null);
};
const handleProfileMenuClose = () => {
setAnchorEl2(null);
};
const handleManageMenuClose = () => {
setAnchorEl3(null);
};
const navMenu = (
<Menu
anchorEl={anchorEl1}
anchorOrigin={{ vertical: 'top', horizontal: 'left' }}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'left' }}
open={isNavMenuOpen}
onClose={handleNavMenuClose}
>
<MenuItem onClick={handleNavMenuClose}>Home</MenuItem>
<MenuItem onClick={handleNavMenuClose}>Movies</MenuItem>
<MenuItem onClick={handleNavMenuClose}>Concessions</MenuItem>
<MenuItem onClick={handleNavMenuClose}>Showtimes</MenuItem>
</Menu>
)
const userMenu = (
<Menu
anchorEl={anchorEl2}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
open={isProfileMenuOpen}
onClose={handleProfileMenuClose}
>
<MenuItem onClick={handleProfileMenuClose}>Profile</MenuItem>
<MenuItem onClick={handleProfileMenuClose}>My account</MenuItem>
<MenuItem onClick={handleProfileMenuClose}>Sign Out</MenuItem>
</Menu>
);
const manageMenu = (
<Menu
anchorEl={anchorEl3}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
open={isManageMenuOpen}
onClose={handleManageMenuClose}
>
<MenuItem onClick={handleManageMenuClose}>Movies</MenuItem>
<MenuItem onClick={handleManageMenuClose}>Seats</MenuItem>
</Menu>
);

Related

How to right align a search bar

how to right align the search bar ? I've tried everything nothing seems to work. I want the 'Transaction' title on the left of the card and search bar on the right of the card
this is my code
export default function ContactsCard(Rows) {
return (
<Card sx={{ minWidth: 900, minHeight: 1, }}>
<CardContent>
<Stack direction="row" alignItems="center" gap={1}>
<RuleIcon sx={{ color: "text.secondary" }} />
<Typography sx={{ fontSize: 16, fontWeight: 'bold' }} textAlign='start' color="text.secondary" gutterBottom>
Transactions
</Typography>
<SearchBar rows={rows} />
</Stack>
<DataGridHelper title='Contact' rows={Rows} columns={columns} />
</CardContent>
</Card>
);
}
this how my table looks like now
Try adding a wrapper to the icon and typography with display="flex" flexDirection="column" and justifyContent="space-between" in Stack
export default function ContactsCard(Rows) {
return (
<Card sx={{ minWidth: 900, minHeight: 1, }}>
<CardContent>
<Stack direction="row" alignItems="center" justifyContent="space-between" gap={1}>
<Box display="flex" flexDirection="column">
<RuleIcon sx={{ color: "text.secondary" }} />
<Typography sx={{ fontSize: 16, fontWeight: 'bold' }} textAlign='start' color="text.secondary" gutterBottom>
Transactions
</Typography>
</Box>
<SearchBar rows={rows} />
</Stack>
<DataGridHelper title='Contact' rows={Rows} columns={columns} />
</CardContent>
</Card>
);
}

Reactjs Material UI Table component causes grid to expand

I have a Table component that is nested in a Grid component and I would like the Grid component to remain in its width when my Table component is rendered. My current code causes the Grid component to expand but I'm not sure how to prevent this? I'm pretty stuck :/
Before rendering the Table component when it has not received data:
After rendering the Table component when it received data:
Here are my codes from parent to child
Mainpage
return (
<Box>
<Box sx={{display: "grid", alignItems: "center", justifyContent: "center", paddingTop: "40px"}}>
<Typography variant="h4">Some Header</Typography>
</Box>
<Box sx={{display: "grid", alignItems: "center", justifyContent: "center", paddingTop: "30px"}}>
<Wallet></Wallet>
</Box>
<Box sx={{display: "grid", alignItems: "center", justifyContent: "center", paddingTop: "40px"}}>
<Typography variant="h5">Some Other Header</Typography>
</Box>
<Box sx={{display: "grid", alignItems: "center", justifyContent: "center", paddingTop: "10px"}}>
<Cmc></Cmc>
</Box>
</Box>
)
Wallet
return (
<Box>
<Grid container rowSpacing={2} sx={{paddingInline: "25px"}} width={"100%"}>
<Grid item xs={12}>
<Queryfield text={fields.staking} onFunction={getStakingAmounts}/>
<Stakingfield resData={resData.stakingRes}/>
</Grid>
<Grid item xs={12}>
<Queryfield text={fields.outstandingWithdrawals} onFunction={getOutstandingWithdrawals}/>
<Outstandingfield/>
</Grid>
<Grid item xs={12}>
<Queryfield text={fields.withdrawnAmounts} onFunction={getWithdrawnAmount}/>
<Withdrawnfield/>
</Grid>
</Grid>
</Box>
)
Queryfield
return (
<Box>
<Typography sx={{ paddingLeft: "0px" }}>{txt}</Typography>
<Box sx={{display: "inline-flex", width: "100%"}}>
<TextField onChange={handleQueryChange} label="Enter Address" fullWidth type="search" variant="filled" size="small" />
<Button variant="outlined" onClick={handleQuery}>Send</Button>
</Box>
</Box>
)
Stakingfield
const renderTable = () => {
if (stakingRes !== "") {
return (
<TableContainer component={Paper}>
<Table size="small">
<TableHead>
<TableRow>
<TableCell>Validator Address</TableCell>
<TableCell>Delegated Amount</TableCell>
<TableCell>Token</TableCell>
<TableCell>Shares</TableCell>
</TableRow>
</TableHead>
<TableBody>
{stakingRes.map((row, index) => (
<TableRow key={index}>
<TableCell component="th" scope="row">{row.validatorAddress}</TableCell>
<TableCell>{Number(row.delegatedAmount) / 10**18}</TableCell>
<TableCell>{row.denom}</TableCell>
<TableCell>{Number(row.shares) / 10**18}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
}
else {
return (
<div></div>
)
}
}
return (
<Box>
{renderTable()}
</Box>
)
I solved the issue.
For anyone wondering, the Table component in Material UI is not responsive. I used a DataGrid and it all worked out.

Can't get my values/data to insert into second MySQL db even though now errors show

The issue: My first table bugtracker_table on dashboard.js works fine when I submit data to it but my second table ticket_table on projects.js do not submit values even though it's pretty much the same code.
I even have the terminal that says: Executing (default): INSERT INTO ticket_table (id,ticket_title,ticket_description,type_menu,priority_menu,status_menu,createdAt,updatedAt) VALUES (DEFAULT,?,?,?,?,?,?,?);
But there is no data in table.
Dashboard.js
import React, { useState, useEffect } from "react";
import { DataTable } from "primereact/datatable";
import { Column } from "primereact/column";
import { Button } from "primereact/button";
// import ButtonDemo from './ButtonDemo';
import { Chart } from "primereact/chart";
import { InputText } from "primereact/inputtext";
import { InputTextarea } from "primereact/inputtextarea";
import { Modal, ModalFooter, ModalHeader } from "react-bootstrap";
import axios from "axios";
import { useHistory, Link } from "react-router-dom";
// import { Media } from "react-bootstrap/Media"
// import ProjectsTable from "./Tables/ProjectsTable";
// import TicketsPieChart from "./Tables/TicketsPieChart"
// import API from
//project table
//eslint-disable no-unused-vars
const TableDemo = () => {
// const toggle = () => {setShow(!show);}
const [project_name, setProjectName] = useState("");
const [description, setDescription] = useState("");
const [projects, setProjects] = useState([]);
const history = useHistory();
const projectsToShow = projects.map((project) => {
return {
...project,
project_name: <Link to={`/projects/${project.id}`}>{project.project_name}</Link>,
};
});
useEffect(() => {
getProjects();
}, []);
const getProjects = async () => {
const response = await axios.get("http://localhost:5002/bugtracker_table");
setProjects(response.data);
};
const saveProject = async (e) => {
e.preventDefault();
await axios.post("http://localhost:5002/bugtracker_table", {
project_name: project_name,
description: description,
});
history.push("/");
};
const [show, setShow] = useState(false);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
return (
<>
<div className="grid table-demo">
<div className="col-12">
<div className="card">
<h5>Projects</h5>
<div>
<Button label="New Project" className="p-button-rounded mr-2 mb-2 npbutton" onClick={handleShow} />
</div>
<Modal className="modal" show={show} onHide={handleClose}>
<form onSubmit={saveProject}>
<div className="grid p-fluid">
<div className="col-12 md:col-6">
<div className="card">
<Button icon="pi pi-times" className="p-button-rounded p-button-danger p-button-text mr-2 mb-2 x-button" onClick={handleClose}></Button>
<ModalHeader>
<h5>Projects</h5>
</ModalHeader>
<div className="grid formgrid">
<div className="col-12 mb-2 lg:col-4 lg:mb-0">
<InputText value={project_name} onChange={(e) => setProjectName(e.target.value)} type="text" placeholder="Enter project name"></InputText>
</div>
</div>
<h5>Project Description</h5>
<InputTextarea value={description} onChange={(e) => setDescription(e.target.value)} type="text" placeholder="Enter project description" autoResize rows="3" cols="30" />
<ModalFooter>
<Button label="Submit" className="p-button-rounded p-button-success mr-2 mb-2 success" />
{/* <Button onClick={handleClose}>Close</Button> */}
</ModalFooter>
</div>
</div>
</div>
</form>
</Modal>
{/* // <Link to="/ticketlist" className="col-12"> */}
<div>
{/* // className="card"></Link> */}
<DataTable
// sortMode="single" sortField="representative.name"
value={projectsToShow}
sortOrder={1}
scrollable
scrollHeight="400px"
responsiveLayout="scroll"
>
<Column field="project_name" header="Project Name" style={{ minWidth: "200px" }}></Column>
<Column field="description" header="Description" style={{ minWidth: "350px" }}></Column>
<Column field="createdAt" header="Created On" style={{ minWidth: "150px" }}></Column>
{projects.map((project, index) => (
<tr key={project.id}>
<td>{index + 1}</td>
<td>{project.description}</td>
<td>{project.createdAt}</td>
</tr>
))}
</DataTable>
</div>
</div>
</div>
<div className="grid p-fluid">
<div className="col-12 lg:col-6">
<div className="card flex flex-column align-items-center">
<h5>Tickets by Type</h5>
<Chart type="pie" focus={"type"} />
</div>
</div>
</div>
<div className="grid p-fluid">
<div className="col-12 lg:col-6">
<div className="card flex flex-column align-items-center">
<h5>Tickets by Priority</h5>
<Chart type="pie" focus={"priority"} />
</div>
</div>
</div>
<div className="grid p-fluid">
<div className="col-12 lg:col-6">
<div className="card flex flex-column align-items-center">
<h5>Tickets by Status</h5>
<Chart type="pie" focus={"status"} />
</div>
</div>
</div>
</div>
</>
);
};
export default React.memo(TableDemo);
Projects.js
import React, { useState, useEffect } from "react";
import { Column } from "primereact/column";
import { DataTable } from "primereact/datatable";
import { Button } from "primereact/button";
import { Modal, ModalFooter, ModalHeader } from "react-bootstrap";
import { InputText } from "primereact/inputtext";
import { InputTextarea } from "primereact/inputtextarea";
// import { InputNumber } from "primereact/inputnumber";
import { Dropdown } from "primereact/dropdown";
import axios from "axios";
const Projectz = () => {
const [ticket_title, setTicketTitle] = useState("");
const [ticket_description, setTicketDescription] = useState("");
// const [time_takes, setTimeTakes] = useState("");
const [type_menu, setTypeMenu] = useState("");
const [priority_menu, setPriorityMenu] = useState("");
const [status_menu, setStatusMenu] = useState("");
const [projects, setProjects] = useState([]);
useEffect(() => {
getProjects();
}, []);
const getProjects = async () => {
const response = await axios.get("http://localhost:5002/ticket_table");
setProjects(response.data);
};
const saveProject = async (e) => {
e.preventDefault();
await axios.post("http://localhost:5002/ticket_table", {
ticket_title: ticket_title,
ticket_description: ticket_description,
// time_takes: time_takes,
type_menu: type_menu,
priority_menu: priority_menu,
status_menu: status_menu,
});
};
const dropdownValues1 = [
{ name: "Issue", code: "ISS" },
{ name: "Bug", code: "BUG" },
{ name: "Error", code: "ERR" },
{ name: "Other", code: "OTH" },
];
const dropdownValues2 = [
{ name: "Low", code: "LOW" },
{ name: "Medium", code: "MED" },
{ name: "High", code: "HI" },
{ name: "Immediate", code: "IMM" },
];
const dropdownValues3 = [
{ name: "New", code: "NEW" },
{ name: "Open", code: "OP" },
{ name: "In Progress", code: "IP" },
{ name: "Resolved", code: "RES" },
{ name: "Additional Info Required", code: "AIR" },
];
const [show, setShow] = useState(false);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
return (
<>
<div className="grid table-demo">
<div className="col-12">
<div className="card">
<h5>Tickets</h5>
<div>
<Button label="New Ticket" className="p-button-rounded mr-2 mb-2 npbutton" onClick={handleShow} />
</div>
<Modal className="modal" show={show} onHide={handleClose}>
<form onSubmit={saveProject}>
<div className="grid p-fluid">
<div className="col-12 md:col-6">
<div className="card">
<ModalHeader>
<h5>Create Ticket</h5>
</ModalHeader>
<div className="grid formgrid">
<div className="col-12 mb-2 lg:col-4 lg:mb-0">
<InputText value={ticket_title} onChange={(e) => setTicketTitle(e.target.value)} type="text" placeholder="Enter ticket title"></InputText>
</div>
</div>
<h5>Ticket Description</h5>
<InputTextarea value={ticket_description} onChange={(e) => setTicketDescription(e.target.value)} type="text" placeholder="Enter ticket description" autoResize rows="3" cols="30" />
{/* <h5>Time Estimate (Hours)</h5> */}
{/* <InputNumber value={time_takes} onValueChange={(e) => setTimeTakes(e.value)} showButtons mode="decimal"></InputNumber> */}
<h5>Type</h5>
<Dropdown value={type_menu} onChange={(e) => setTypeMenu(e.value)} options={dropdownValues1} optionLabel="name" placeholder="Select" />
<h5>Priority</h5>
<Dropdown value={priority_menu} onChange={(e) => setPriorityMenu(e.value)} options={dropdownValues2} optionLabel="name" placeholder="Select" />
<h5>Status</h5>
<Dropdown value={status_menu} onChange={(e) => setStatusMenu(e.value)} options={dropdownValues3} optionLabel="name" placeholder="Select" />
<ModalFooter>
<Button label="Submit" className="p-button-rounded p-button-success mr-2 mb-2 success" />
<Button onClick={handleClose}>Close</Button>
</ModalFooter>
</div>
</div>
</div>
</form>
</Modal>
<div>
<DataTable
// sortMode="single" sortField="representative.name"
sortOrder={1}
scrollable
scrollHeight="400px"
responsiveLayout="scroll"
>
<Column field="ticket_title" header="Ticket Title" style={{ minWidth: "200px" }}></Column>
<Column field="description" header="Description" style={{ minWidth: "350px" }}></Column>
<Column field="status" header="Status" style={{ minWidth: "200" }}></Column>
<Column field="createdAt" header="Date" style={{ minWidth: "200px" }}></Column>
</DataTable>
</div>
</div>
</div>
</div>
<div className="grid table-demo">
<div className="col-12">
<div className="card">
<h5>Ticket Info</h5>
<div>
<DataTable
// value={projects}
// sortMode="single" sortField="representative.name"
// sortOrder={1}
// scrollable
// scrollHeight="400px"
// responsiveLayout="scroll"
>
{projects.map((project, index) => (
<tr key={project.id}>
<td>{index + 1}</td>
<td>{project.ticket_title}</td>
<td>{project.ticket_description}</td>
{/* <td>{ticket.time_takes}</td> */}
<td>{project.type_menu}</td>
<td>{project.priority_menu}</td>
<td>{project.status_menu}</td>
</tr>
))}
</DataTable>
</div>
</div>
</div>
</div>
</>
);
};
export default React.memo(Projectz);

MenuItem navigation inside AppBar in material-ui

I am trying to compose a navbar inside the AppBar in material-ui. I have the following code.
Currently, using #material-ui/core version 3.9.2.
class Header extends Component {
handleMenuOpen = ev => {
this.setState({ anchorAccountMenu: ev.currentTarget });
}
handleMenuClose = ev => {
this.setState({ anchorAccountMenu: null });
}
menuGotoUrl = siteUrl => ev => {
console.log(siteUrl);
this.props.history.push(siteUrl);
this.handleMenuClose(ev);
}
render() {
let { classes } = this.props;
let { anchorAccountMenu } = this.state;
const user = UserService.currentUser();
let userFirstChar = user.name.charAt(0).toUpperCase();
return (<AppBar><Toolbar>
{ /* Some more content here... */ }
<Button onClick={ this.handleMenuOpen }>
<span className={ classes.nameInButton }>{ `${user.name}` }</span>
<Avatar className={ classes.avatar }>{ userFirstChar }</Avatar>
</Button>
<Menu
id="user-menu" anchorEl={ anchorAccountMenu }
getContentAnchorEl= { null }
disableAutoFocusItem={ true }
anchorOrigin={{ vertical: "bottom", horizontal: "right" }}
transformOrigin={{ vertical: "top", horizontal: "right" }}
open={ !!anchorAccountMenu } onClose={ this.handleMenuClose }>
<MenuItem onClick={ this.menuGotoUrl("/profile/edit") }>
<ListItemIcon className={ classes.menuIcon }>
<Icon className="far fa-fw fa-user" />
</ListItemIcon>
<ListItemText inset primary="Profile" />
</MenuItem>
<MenuItem onClick={ this.handleLogout }>
<ListItemIcon className={ classes.menuIcon }>
<Icon className="fas fa-fw fa-sign-out-alt" />
</ListItemIcon>
<ListItemText inset primary="Logout" />
</MenuItem>
</Menu>
</Toolbar></AppBar>)
}
}
export default withRouter(withStyles(styles)(Header));
The problem is when I select the profile menuItem, it returns me error, instead of navigate to /profile/edit via react-routes-dom and close the menu.
Error:
react-dom.development.js:57 Uncaught Invariant Violation: Unable to find node on an unmounted component.
at invariant (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:57:19)
at findCurrentFiberUsingSlowPath (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4395:31)
at findCurrentHostFiber (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4407:27)
at findHostInstanceWithWarning (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:21470:25)
at Object.findDOMNode (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:22022:18)
at ref (webpack-internal:///./node_modules/#material-ui/core/MenuList/MenuList.js:203:46)
...
...
What am I missing here? Thanks.
I finally solve it by placing <Menu/> with <MenuList />. Not sure how's it different internally. This is also the alternative of building menu from material-ui from the doc.
Specifically, this is what I do:
render() {
let { classes } = this.props;
let { anchorAccountMenu } = this.state;
const user = UserService.currentUser();
let userFirstChar = user.name.charAt(0).toUpperCase();
return (<AppBar><Toolbar>
{ /* Some more content here... */ }
<Button onClick={ this.handleMenuOpen }>
<span className={ classes.nameInButton }>{ `${user.name}` }</span>
<Avatar className={ classes.avatar }>{ userFirstChar }</Avatar>
</Button>
<Popper open={ !!anchorAccountMenu } anchorEl={ anchorAccountMenu }
transition disablePortal>{ ({ TransitionProps }) => (
<Grow {...TransitionProps} id="menu-item-grow"
style={{ transformOrigin: 'center top' }}
><Paper><ClickAwayListener onClickAway={ this.handleMenuClose }>
<MenuList>
<MenuItem onClick={ this.menuGotoUrl("/profile/edit") }>
<ListItemIcon className={ classes.menuIcon }>
<Icon className="far fa-fw fa-user" />
</ListItemIcon>
<ListItemText inset primary="Profile" />
</MenuItem>
<MenuItem onClick={ this.handleLogout }>
<ListItemIcon className={ classes.menuIcon }>
<Icon className="fas fa-fw fa-sign-out-alt" />
</ListItemIcon>
<ListItemText inset primary="Logout" />
</MenuItem>
</MenuList>
</ClickAwayListener></Paper></Grow>
) }</Popper>
</Toolbar></AppBar>)
}
}

Ant design rc-time-picker position wrong on Modal with animation

<div>
<Button onClick={() => this.setState({ show: true })}>Open</Button>
<Modal
show={this.state.show}
onHide={() => this.setState({ show: false })}
animation={true}
>
<Modal.Header closeButton>
<Modal.Title>Modal</Modal.Title>
</Modal.Header>
<Modal.Body>
<TimePicker open getPopupContainer={triggerNode => triggerNode.parentNode}/>
<div style={{ height: '370px' }} />
</Modal.Body>
</Modal>
</div>
With animation enabled, it becomes https://i.imgur.com/0r1aULs.png
Without animation: https://i.imgur.com/YTdF8rT.png
Any clue how to fix it?