From d07dbbd0d9267bd1b71458161f924a0e5bf5beeb Mon Sep 17 00:00:00 2001 From: Krishna Mahato Date: Tue, 7 Jun 2022 20:27:18 +0530 Subject: [PATCH] update(ui): Changed direction of row icons from column to row, and removed the extra space in folder navigation --- src/components/Header/index.css | 21 ++++ src/components/Header/index.jsx | 137 +++++++++++++------------ src/components/TreeContainer/index.css | 6 +- src/components/TreeContainer/index.jsx | 10 +- src/pages/Browse/index.jsx | 9 +- 5 files changed, 112 insertions(+), 71 deletions(-) create mode 100644 src/components/Header/index.css diff --git a/src/components/Header/index.css b/src/components/Header/index.css new file mode 100644 index 000000000..698b8e03e --- /dev/null +++ b/src/components/Header/index.css @@ -0,0 +1,21 @@ +/* + Copyright (C) 2022 Krishna Mahato (krishhtrishh9304@gmail.com) + + SPDX-License-Identifier: GPL-2.0 + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2 as published by the Free Software Foundation. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +.navIcons { + display: flex; + gap: 10px; +} diff --git a/src/components/Header/index.jsx b/src/components/Header/index.jsx index a741fe000..32e319b71 100644 --- a/src/components/Header/index.jsx +++ b/src/components/Header/index.jsx @@ -54,6 +54,9 @@ import { getNameInitials } from "shared/helper"; // Dark Theme Toggle Button import DarkThemeToggle from "../DarkThemeToggle/DarkThemeToggle"; +// custom css +import "./index.css"; + const Header = () => { const [currentGroup, setCurrentGroup] = useState( getLocalStorage("currentGroup") || getLocalStorage("user")?.default_group @@ -305,81 +308,83 @@ const Header = () => { )} - - - - - - {/* Help Pages */} - - - - - - - About - - - Getting Started - - - License Browser - - - Documentation - - - Third Party Licenses - - - - - {/* User Info */} - {getAllGroups() && ( +
- + - - {getAllGroups().map((group) => ( - - {group.name} - - ))} - - )} - - - - - {isAuth() ? ( + {/* Help Pages */} + + + + - - User: {getUserName()} + + About - - logout(null)}> - Log out + + Getting Started + + + License Browser + + + Documentation + + + Third Party Licenses - ) : ( - - Log in - + + + {/* User Info */} + {getAllGroups() && ( + + + + + + {getAllGroups().map((group) => ( + + {group.name} + + ))} + + )} - + + + + + {isAuth() ? ( + + + User: {getUserName()} + + + logout(null)}> + Log out + + + ) : ( + + Log in + + )} + +
diff --git a/src/components/TreeContainer/index.css b/src/components/TreeContainer/index.css index dd3ae000f..b59ef8670 100644 --- a/src/components/TreeContainer/index.css +++ b/src/components/TreeContainer/index.css @@ -26,8 +26,10 @@ padding-right: 0.5rem; } -.tree-list { - height: 50rem; +@media only screen and (min-width: 765px) { + .tree-list { + height: 50rem !important; + } } .folder-tree-list { diff --git a/src/components/TreeContainer/index.jsx b/src/components/TreeContainer/index.jsx index 9e1611289..e55210e31 100644 --- a/src/components/TreeContainer/index.jsx +++ b/src/components/TreeContainer/index.jsx @@ -21,7 +21,7 @@ import PropTypes from "prop-types"; import Tree, { renderers } from "react-virtualized-tree"; import "./index.css"; -const TreeContainer = ({ data, handleClick }) => { +const TreeContainer = ({ data, handleClick, folderCount }) => { const { Expandable } = renderers; const [state, setState] = useState(data); @@ -31,7 +31,12 @@ const TreeContainer = ({ data, handleClick }) => { return (
-
+
{({ style, node, ...rest }) => (
@@ -61,6 +66,7 @@ treeDataFormat.children = PropTypes.arrayOf(PropTypes.shape(treeDataFormat)); TreeContainer.propTypes = { data: PropTypes.arrayOf(PropTypes.shape(treeDataFormat)), handleClick: PropTypes.func.isRequired, + folderCount: PropTypes.number, }; export default TreeContainer; diff --git a/src/pages/Browse/index.jsx b/src/pages/Browse/index.jsx index 94b651ffa..d54837926 100644 --- a/src/pages/Browse/index.jsx +++ b/src/pages/Browse/index.jsx @@ -65,6 +65,7 @@ const Browse = () => { // Setting the list for all the folders names const [folderList, setFolderList] = useState(); + const [folderCount, setFolderCount] = useState(0); // State Variables for handling Error Boundaries // const [loading, setLoading] = useState(false); @@ -109,6 +110,8 @@ const Browse = () => { }, }; }); + // setting the folders and subfolders count before converting the array to tree + setFolderCount(folders.length); setFolderList( arrayToTree(folders, { parentProperty: "parent", @@ -199,7 +202,11 @@ const Browse = () => {

Folder Navigation

{folderList && ( - + )}