Return buttons now close the subpanel in mobile

This commit is contained in:
DrMint 2022-02-20 15:18:14 +01:00
parent 8731557f40
commit 7efeb08bb7
2 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import Link from "next/link";
import { MouseEventHandler } from "react";
type ButtonProps = {
className?: string;
@ -6,11 +7,13 @@ type ButtonProps = {
children: React.ReactChild | React.ReactChild[];
active?: boolean;
locale?: string;
onClick?: MouseEventHandler<HTMLDivElement>;
};
export default function Button(props: ButtonProps): JSX.Element {
const button = (
<div
onClick={props.onClick}
className={`grid place-content-center place-items-center border-[1px] border-dark text-dark rounded-full px-4 pt-[0.4rem] pb-[0.5rem] transition-all ${
props.className
} ${

View File

@ -1,5 +1,7 @@
import Button from "components/Button";
import { GetWebsiteInterfaceQuery } from "graphql/operations-types";
import { useDispatch } from "react-redux";
import { setSubPanelOpen } from "redux/AppLayoutSlice";
type ReturnButtonProps = {
href: string;
@ -8,8 +10,10 @@ type ReturnButtonProps = {
};
export default function ReturnButton(props: ReturnButtonProps): JSX.Element {
const dispatch = useDispatch();
return (
<Button href={props.href}>
<Button onClick={() => dispatch(setSubPanelOpen(false))} href={props.href}>
&emsp;{props.langui.global_return_label} {props.title}
</Button>
);