yeungalan 4 anos atrás
pai
commit
cae6774704
3 arquivos alterados com 10 adições e 8 exclusões
  1. 2 2
      photo/src/FolderList.js
  2. 1 1
      photo/src/ImageList.js
  3. 7 5
      photo/src/SearchAppMenu.js

+ 2 - 2
photo/src/FolderList.js

@@ -44,7 +44,7 @@ const useStyles = makeStyles((theme) => ({
  *   },
  * ];
  */
-export default function TitlebarGridList() {
+export default function TitlebarGridList(props) {
 
     const classes = useStyles();
 
@@ -57,7 +57,7 @@ export default function TitlebarGridList() {
     const onChanageFolder = (folderN) => {
         setFolderName(folderN);
         console.log("1" + folderName);
-        this.props.folderName(folderName);   
+        props.onChange(folderN);
     }
 
     useEffect(() => {

+ 1 - 1
photo/src/ImageList.js

@@ -19,7 +19,7 @@ class imageList extends React.Component {
     }
 
     componentDidMount() {
-        fetch("http://localhost:3000/listFile?path=" + this.state.path)
+        fetch("http://localhost:3000/listFile?path=" + this.props.path)
             .then(res => res.json())
             .then(
                 (result) => {

+ 7 - 5
photo/src/SearchAppMenu.js

@@ -224,17 +224,19 @@ export default function ButtonAppBar() {
         setAlertOpen(false);
     };
 
-    const [Imagelistopen, setImagelistOpen] = React.useState(false);
+    const [Imagelistopen, setImagelistOpen] = React.useState(true);
     const [Folderlistopen, setFolderlistOpen] = React.useState(false);
 
     const [folderName, setFolderName] = React.useState('');
 
+    
     const setFolderNameF = (folderN) => {
         setFolderName(folderN);
-        console.log("3" + folderN);
+        console.log("3" + folderName);
+        setImagelistOpen(true);
+        setFolderlistOpen(false);
     }
 
-
     const handleClick = value => () => {
         console.log(value);
         switch (value) {
@@ -325,8 +327,8 @@ export default function ButtonAppBar() {
             </Drawer>
             <main className={classes.content}>
                 <div className={classes.toolbar} />
-                {Imagelistopen && <ImageList folder={folderName}/>}
-                {Folderlistopen && <FolderList folderName={setFolderNameF}/>}
+                {Imagelistopen && <ImageList path={folderName}/>}
+                {Folderlistopen && <FolderList onChange={setFolderNameF} folderName={setFolderNameF}/>}
             </main>
             <Snackbar open={Alertopen} autoHideDuration={6000} onClose={handleAlertClose}>
                 <Alert onClose={handleAlertClose} severity="error">