45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { ChevronDownIcon } from "@heroicons/react/20/solid";
|
|
import Button, { EButtonStyleType, EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
|
import { NextRouter, useRouter } from "next/router";
|
|
import React from "react";
|
|
|
|
type IProps = {
|
|
url?: string;
|
|
};
|
|
|
|
type IPropsClass = IProps & {
|
|
router: NextRouter;
|
|
};
|
|
type IState = {};
|
|
class BackArrowClass extends React.Component<IPropsClass, IState> {
|
|
public constructor(props: IPropsClass) {
|
|
super(props);
|
|
|
|
this.handleClick = this.handleClick.bind(this);
|
|
}
|
|
|
|
public override render(): JSX.Element {
|
|
return (
|
|
<Button
|
|
leftIcon={<ChevronDownIcon style={{ transform: "rotate(180deg)", width: "22px", height: "22px" }} />}
|
|
variant={EButtonVariant.PRIMARY}
|
|
styleType={EButtonStyleType.TEXT}
|
|
onClick={this.handleClick}>
|
|
Retour
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
private handleClick() {
|
|
if (this.props.url) {
|
|
this.props.router.push(this.props.url);
|
|
}
|
|
this.props.router.back();
|
|
}
|
|
}
|
|
|
|
export default function BackArrow(props: IProps) {
|
|
const router = useRouter();
|
|
return <BackArrowClass {...props} router={router} />;
|
|
}
|