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

View File

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