Merge branch 'staging' into dev
This commit is contained in:
commit
288b2bb3e4
@ -64,6 +64,7 @@ export default function FolderListContainer(props: IProps) {
|
||||
const [blocks, setBlocks] = React.useState<IBlock[]>(getBlocks(folders));
|
||||
|
||||
const onSelectedFolder = (block: IBlock) => {
|
||||
props.onCloseLeftSide && props.onCloseLeftSide();
|
||||
const folder = folders.find((folder) => folder.uid === block.id);
|
||||
if (!folder) return;
|
||||
props.onSelectedFolder && props.onSelectedFolder(folder);
|
||||
|
@ -1,15 +1,12 @@
|
||||
import DeedTypes from "@Front/Api/LeCoffreApi/Admin/DeedTypes/DeedTypes";
|
||||
import Button from "@Front/Components/DesignSystem/Button";
|
||||
import SearchBar from "@Front/Components/DesignSystem/SearchBar";
|
||||
import Module from "@Front/Config/Module";
|
||||
import { DeedType } from "le-coffre-resources/dist/Admin";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import React, { useCallback } from "react";
|
||||
|
||||
import classes from "./classes.module.scss";
|
||||
import { IBlock } from "@Front/Components/DesignSystem/SearchBlockList/BlockList/Block";
|
||||
import BlockList from "@Front/Components/DesignSystem/SearchBlockList/BlockList";
|
||||
import SearchBlockList from "@Front/Components/DesignSystem/SearchBlockList";
|
||||
|
||||
type IProps = {
|
||||
deedTypes: DeedType[];
|
||||
@ -18,20 +15,9 @@ type IProps = {
|
||||
};
|
||||
|
||||
export default function DeedListContainer(props: IProps) {
|
||||
const [filteredUsers, setFilteredUsers] = useState<DeedType[]>(props.deedTypes);
|
||||
const router = useRouter();
|
||||
const { deedTypeUid } = router.query;
|
||||
|
||||
const filterDeeds = useCallback(
|
||||
(input: string) => {
|
||||
const filteredUsers = props.deedTypes.filter((deedType) => {
|
||||
return deedType.name?.toLowerCase().includes(input.toLowerCase());
|
||||
});
|
||||
setFilteredUsers(filteredUsers);
|
||||
},
|
||||
[props.deedTypes],
|
||||
);
|
||||
|
||||
const onSelectedBlock = useCallback(
|
||||
(block: IBlock) => {
|
||||
props.onCloseLeftSide && props.onCloseLeftSide();
|
||||
@ -43,13 +29,8 @@ export default function DeedListContainer(props: IProps) {
|
||||
|
||||
return (
|
||||
<div className={classes["root"]}>
|
||||
<div className={classes["header"]}>
|
||||
<div className={classes["searchbar"]}>
|
||||
<SearchBar onChange={filterDeeds} placeholder="Chercher un type d'acte" />
|
||||
</div>
|
||||
<div className={classes["folderlist-container"]}>
|
||||
<BlockList
|
||||
blocks={filteredUsers.map((deed) => {
|
||||
<SearchBlockList
|
||||
blocks={props.deedTypes.map((deed) => {
|
||||
return {
|
||||
primaryText: deed.name,
|
||||
id: deed.uid!,
|
||||
@ -57,14 +38,11 @@ export default function DeedListContainer(props: IProps) {
|
||||
};
|
||||
})}
|
||||
onSelectedBlock={onSelectedBlock}
|
||||
bottomButton={{
|
||||
link: Module.getInstance().get().modules.pages.DeedTypes.pages.Create.props.path,
|
||||
text: "Créer un type d'acte",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className={classes["create-container"]}>
|
||||
<Link href={Module.getInstance().get().modules.pages.DeedTypes.pages.Create.props.path}>
|
||||
<Button fullwidth={true}>Créer un type d'acte</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user