✨ Refacto back arrow if no url is provided
This commit is contained in:
parent
c1f7cc1a97
commit
0ec1a998e5
@ -1,9 +1,11 @@
|
||||
import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||
import Link from "next/link";
|
||||
import React from "react";
|
||||
import classes from "./classes.module.scss";
|
||||
import SearchBar from "../SearchBar";
|
||||
|
||||
import Button from "../Button";
|
||||
import FolderList from "../FolderList";
|
||||
import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||
import SearchBar from "../SearchBar";
|
||||
import classes from "./classes.module.scss";
|
||||
|
||||
type IProps = {
|
||||
folders: IDashBoardFolder[];
|
||||
@ -37,7 +39,9 @@ export default class FolderListContainer extends React.Component<IProps, IState>
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Button fullwidth={"true"}>Créer un dossier</Button>
|
||||
<Link href={"/dossier/creer-dossier"}>
|
||||
<Button fullwidth={true}>Créer un dossier</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -1,29 +1,45 @@
|
||||
import ChevronIcon from "@Assets/Icons/chevron.svg";
|
||||
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||
import Link from "next/link";
|
||||
import { NextRouter, useRouter } from "next/router";
|
||||
import React from "react";
|
||||
|
||||
type IProps = {
|
||||
url: string;
|
||||
url?: string;
|
||||
};
|
||||
|
||||
type IPropsClass = IProps & {
|
||||
router: NextRouter;
|
||||
};
|
||||
type IState = {};
|
||||
export default class BackArrow extends React.Component<IProps, IState> {
|
||||
public constructor(props: IProps) {
|
||||
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 (
|
||||
<Link href={this.props.url}>
|
||||
<Button
|
||||
icon={ChevronIcon}
|
||||
iconposition={"left"}
|
||||
iconstyle={{ transform: "rotate(180deg)", width: "22px", height: "22px" }}
|
||||
variant={EButtonVariant.LINE}>
|
||||
Retour
|
||||
</Button>
|
||||
</Link>
|
||||
<Button
|
||||
icon={ChevronIcon}
|
||||
iconposition={"left"}
|
||||
iconstyle={{ transform: "rotate(180deg)", width: "22px", height: "22px" }}
|
||||
variant={EButtonVariant.LINE}
|
||||
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} />;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ export default class CreateFolder extends BasePage<IProps, IState> {
|
||||
return (
|
||||
<DefaultDoubleSidePage title={"Dossier"} image={RightImage} type="image">
|
||||
<div className={classes["root"]}>
|
||||
<BackArrow url="/" />
|
||||
<BackArrow />
|
||||
<Typography typo={ITypo.H1} color={ITypoColor.BLACK} className={classes["title"]}>
|
||||
Créer un dossier
|
||||
</Typography>
|
||||
|
Loading…
x
Reference in New Issue
Block a user