chore: add back&forward for web​ (#4403)

This commit is contained in:
JimmFly
2023-09-20 01:49:39 +08:00
committed by GitHub
parent f395a955a2
commit 38417878fc

View File

@@ -28,36 +28,35 @@ export const SidebarHeader = (props: SidebarHeaderProps) => {
data-is-macos-electron={environment.isDesktop && environment.isMacOs} data-is-macos-electron={environment.isDesktop && environment.isMacOs}
> >
<SidebarSwitch show={open} /> <SidebarSwitch show={open} />
{environment.isDesktop && ( <div className={navHeaderNavigationButtons}>
<div className={navHeaderNavigationButtons}> <IconButton
<IconButton className={navHeaderButton}
className={navHeaderButton} data-testid="app-sidebar-arrow-button-back"
data-testid="app-sidebar-arrow-button-back" disabled={props.router?.history.current === 0}
disabled={props.router?.history.current === 0} onClick={() => {
onClick={() => { props.router?.back();
props.router?.back(); }}
}} >
> <ArrowLeftSmallIcon />
<ArrowLeftSmallIcon /> </IconButton>
</IconButton> <IconButton
<IconButton className={navHeaderButton}
className={navHeaderButton} data-testid="app-sidebar-arrow-button-forward"
data-testid="app-sidebar-arrow-button-forward" disabled={
disabled={ props.router
props.router ? (props.router.history.stack.length > 0 &&
? props.router.history.stack.length > 0 &&
props.router.history.current === props.router.history.current ===
props.router.history.stack.length - 1 props.router.history.stack.length - 1) ||
: false props.router.history.stack.length === 0
} : true
onClick={() => { }
props.router?.forward(); onClick={() => {
}} props.router?.forward();
> }}
<ArrowRightSmallIcon /> >
</IconButton> <ArrowRightSmallIcon />
</div> </IconButton>
)} </div>
</div> </div>
); );
}; };