feat: close peer list when counter is clicked

This commit is contained in:
Jeremy Kahn 2022-10-25 21:49:27 -05:00
parent f0af2eb480
commit ba744407ba
2 changed files with 7 additions and 11 deletions

View File

@ -122,8 +122,8 @@ export const Shell = ({ appNeedsUpdate, children, userPeerId }: ShellProps) => {
setIsDrawerOpen(true) setIsDrawerOpen(true)
} }
const handlePeerListOpen = () => { const handlePeerListClick = () => {
setIsPeerListOpen(true) setIsPeerListOpen(!isPeerListOpen)
} }
const handleLinkButtonClick = async () => { const handleLinkButtonClick = async () => {
@ -138,10 +138,6 @@ export const Shell = ({ appNeedsUpdate, children, userPeerId }: ShellProps) => {
setIsDrawerOpen(false) setIsDrawerOpen(false)
} }
const handlePeerListClose = () => {
setIsPeerListOpen(false)
}
const handleHomeLinkClick = () => { const handleHomeLinkClick = () => {
setIsDrawerOpen(false) setIsDrawerOpen(false)
} }
@ -184,7 +180,7 @@ export const Shell = ({ appNeedsUpdate, children, userPeerId }: ShellProps) => {
isPeerListOpen={isPeerListOpen} isPeerListOpen={isPeerListOpen}
numberOfPeers={numberOfPeers} numberOfPeers={numberOfPeers}
title={title} title={title}
onPeerListOpen={handlePeerListOpen} onPeerListClick={handlePeerListClick}
/> />
<Drawer <Drawer
isDrawerOpen={isDrawerOpen} isDrawerOpen={isDrawerOpen}
@ -205,7 +201,7 @@ export const Shell = ({ appNeedsUpdate, children, userPeerId }: ShellProps) => {
<PeerList <PeerList
userId={userPeerId} userId={userPeerId}
isPeerListOpen={isPeerListOpen} isPeerListOpen={isPeerListOpen}
onPeerListClose={handlePeerListClose} onPeerListClose={handlePeerListClick}
peerList={peerList} peerList={peerList}
/> />
</Box> </Box>

View File

@ -50,7 +50,7 @@ interface ShellAppBarProps {
isPeerListOpen: boolean isPeerListOpen: boolean
numberOfPeers: number numberOfPeers: number
title: string title: string
onPeerListOpen: () => void onPeerListClick: () => void
} }
export const ShellAppBar = ({ export const ShellAppBar = ({
@ -61,7 +61,7 @@ export const ShellAppBar = ({
isPeerListOpen, isPeerListOpen,
numberOfPeers, numberOfPeers,
title, title,
onPeerListOpen, onPeerListClick,
}: ShellAppBarProps) => { }: ShellAppBarProps) => {
return ( return (
<AppBar <AppBar
@ -114,7 +114,7 @@ export const ShellAppBar = ({
edge="end" edge="end"
color="inherit" color="inherit"
aria-label="Peer list" aria-label="Peer list"
onClick={onPeerListOpen} onClick={onPeerListClick}
> >
<StepIcon icon={numberOfPeers} /> <StepIcon icon={numberOfPeers} />
</IconButton> </IconButton>