diff --git a/src/front/Components/DesignSystem/BlockList/index.tsx b/src/front/Components/DesignSystem/BlockList/index.tsx deleted file mode 100644 index e733a3ac..00000000 --- a/src/front/Components/DesignSystem/BlockList/index.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React, { useCallback } from "react"; -import classes from "./classes.module.scss"; -import Typography, { ETypo } from "../Typography"; -import ChevronIcon from "@Assets/Icons/chevron.svg"; -import Image from "next/image"; -import WarningBadge from "../WarningBadge"; - -export type IBlock = { - name: string; - id: string; - selected: boolean; - rightIcon?: JSX.Element; - hasFlag?: boolean; -}; - -type IProps = { - blocks: IBlock[]; - onSelectedBlock: (block: IBlock) => void; -}; -export default function BlockList({ blocks, onSelectedBlock }: IProps) { - const selectBlock = useCallback( - (e: React.MouseEvent) => { - onSelectedBlock && onSelectedBlock(blocks.find((folder) => folder.id === e.currentTarget.id)!); - }, - [blocks, onSelectedBlock], - ); - - return ( -
- {blocks.map((folder) => { - return ( -
-
-
- {folder.name} -
-
- {folder.hasFlag && } - {folder.rightIcon} - chevron -
-
-
- ); - })} -
- ); -} diff --git a/src/front/Components/DesignSystem/FolderArchivedListContainer/index.tsx b/src/front/Components/DesignSystem/FolderArchivedListContainer/index.tsx index 19797c52..c77c890c 100644 --- a/src/front/Components/DesignSystem/FolderArchivedListContainer/index.tsx +++ b/src/front/Components/DesignSystem/FolderArchivedListContainer/index.tsx @@ -5,12 +5,13 @@ import Link from "next/link"; import { NextRouter, useRouter } from "next/router"; import React from "react"; -import BlockList, { IBlock } from "../BlockList"; import Button from "../Button"; import SearchBar from "../SearchBar"; import classes from "./classes.module.scss"; import Rules, { RulesMode } from "@Front/Components/Elements/Rules"; import { AppRuleActions, AppRuleNames } from "@Front/Api/Entities/rule"; +import { IBlock } from "../SearchBlockList/BlockList/Block"; +import BlockList from "../SearchBlockList/BlockList"; type IProps = { folders: OfficeFolder[]; @@ -106,9 +107,10 @@ class FolderArchivedListContainerClass extends React.Component { return { id: folder.uid!, - name: folder.folder_number! + " - " + folder.name!, - selected: this.props.selectedFolder === folder.uid, - hasFlag: folder.documents?.some((document) => document.document_status === EDocumentStatus.DEPOSITED), + primaryText: folder.name, + isActive: this.props.selectedFolder === folder.uid, + secondaryText: folder.folder_number, + showAlert: folder.documents?.some((document) => document.document_status === EDocumentStatus.DEPOSITED), }; }); } diff --git a/src/front/Components/DesignSystem/FolderListContainer/index.tsx b/src/front/Components/DesignSystem/FolderListContainer/index.tsx index 4c3f0a39..3d04a58d 100644 --- a/src/front/Components/DesignSystem/FolderListContainer/index.tsx +++ b/src/front/Components/DesignSystem/FolderListContainer/index.tsx @@ -5,12 +5,14 @@ import Link from "next/link"; import { useRouter } from "next/router"; import React, { useCallback, useEffect } from "react"; -import BlockList, { IBlock } from "../BlockList"; import Button from "../Button"; import SearchBar from "../SearchBar"; import classes from "./classes.module.scss"; import Rules, { RulesMode } from "@Front/Components/Elements/Rules"; import { AppRuleActions, AppRuleNames } from "@Front/Api/Entities/rule"; +import { IBlock } from "../SearchBlockList/BlockList/Block"; +import BlockList from "../SearchBlockList/BlockList"; +import SearchBlockList from "../SearchBlockList"; type IProps = { folders: OfficeFolder[]; @@ -76,9 +78,10 @@ export default function FolderListContainer(props: IProps) { return [...pendingFolders, ...otherFolders].map((folder) => { return { id: folder.uid!, - name: folder.folder_number! + " - " + folder.name!, - selected: folderUid === folder.uid, - hasFlag: folder.documents?.some((document) => document.document_status === EDocumentStatus.DEPOSITED), + primaryText: folder.name, + secondaryText: folder.folder_number, + isActive: folderUid === folder.uid, + showAlert: folder.documents?.some((document) => document.document_status === EDocumentStatus.DEPOSITED), }; }); }, @@ -99,18 +102,18 @@ export default function FolderListContainer(props: IProps) { setBlocks(getBlocks(folders)); }, [folders, getBlocks]); - const navigatePath = Module.getInstance().get().modules.pages.Folder.pages.CreateFolder.props.path; + //const navigatePath = Module.getInstance().get().modules.pages.Folder.pages.CreateFolder.props.path; return (
-
-
- -
-
- -
-
- {!isArchived && ( + + {/* {!isArchived && (
- )} + )} */}
); } diff --git a/src/front/Components/DesignSystem/SearchBar/classes.module.scss b/src/front/Components/DesignSystem/SearchBar/classes.module.scss index e4350b4e..bfb3e58c 100644 --- a/src/front/Components/DesignSystem/SearchBar/classes.module.scss +++ b/src/front/Components/DesignSystem/SearchBar/classes.module.scss @@ -47,6 +47,7 @@ font-weight: var(--font-text-weight-semibold, 600); line-height: normal; letter-spacing: 0.08px; + width: 100%; &::placeholder { color: var(--input-placeholder-empty, #6d7e8a); diff --git a/src/front/Components/DesignSystem/SearchBar/index.tsx b/src/front/Components/DesignSystem/SearchBar/index.tsx index 9289a034..57a7af19 100644 --- a/src/front/Components/DesignSystem/SearchBar/index.tsx +++ b/src/front/Components/DesignSystem/SearchBar/index.tsx @@ -12,26 +12,18 @@ export default function SearchBar({ onChange, placeholder = "Rechercher" }: IPro const [isFocused, setIsFocused] = React.useState(false); const [value, setValue] = React.useState(""); - const handleOnChange = useCallback( - (event: React.ChangeEvent) => { - setValue(event.target.value); - onChange && onChange(event.target.value); + const changeValue = useCallback( + (value: string) => { + setValue(value); + onChange && onChange(value); }, [onChange], ); - const handleFocus = useCallback(() => { - setIsFocused(true); - }, []); - - const handleBlur = useCallback(() => { - setIsFocused(false); - }, []); - - const clearValue = useCallback(() => { - setValue(""); - onChange && onChange(""); - }, [onChange]); + const handleOnChange = (event: React.ChangeEvent) => changeValue(event.target.value); + const handleFocus = () => setIsFocused(true); + const handleBlur = () => setIsFocused(false); + const clearValue = () => changeValue(""); return (