diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..69002fa --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,16 @@ +/* -------------------------------------------------------------------------- */ +/* Libraries */ +/* -------------------------------------------------------------------------- */ +import React from "react"; +/* -------------------------------------------------------------------------- */ +/* Application root component */ +/* -------------------------------------------------------------------------- */ +/** + * Application root component + * @return {JSX.Element} + */ +function App() { + return
Hello world!
; +} + +export default App; diff --git a/src/assets/svg/fundomental.svg b/src/assets/svg/fundamental.svg similarity index 100% rename from src/assets/svg/fundomental.svg rename to src/assets/svg/fundamental.svg diff --git a/src/components/BaseLayout.tsx b/src/components/BaseLayout.tsx index d9fa40f..2c143c9 100644 --- a/src/components/BaseLayout.tsx +++ b/src/components/BaseLayout.tsx @@ -1,5 +1,5 @@ import React from "react"; -// import { Footer } from "./parts/Footer"; +import { Footer } from "./parts/Footer"; import Header from "./parts/Header"; type Props = { header?: React.ReactElement; diff --git a/src/components/ContextMenu.tsx b/src/components/ContextMenu.tsx deleted file mode 100644 index 0073083..0000000 --- a/src/components/ContextMenu.tsx +++ /dev/null @@ -1,115 +0,0 @@ -/* -------------------------------------------------------------------------- */ -/* Imports */ -/* -------------------------------------------------------------------------- */ -import React, { Fragment } from "react"; -import { Menu, Transition } from "@headlessui/react"; -import { PropsPartion } from "./ContextMenuItem"; -import classNames from "classnames"; -import { ReactComponent as SelectIcon } from "assets/svg/select-arrow.svg"; -type ChildType = React.ReactElement; -type ChildrenType = ChildType[] | ChildType; - -/* -------------------------------------------------------------------------- */ -/* Component props */ -/* -------------------------------------------------------------------------- */ - -type MenuProps = { - emphasis?: "high" | "low"; - disabled?: boolean; - className?: string | undefined; - button: React.ReactNode; - children: ChildrenType; -}; -/* -------------------------------------------------------------------------- */ -/* Styles */ -/* -------------------------------------------------------------------------- */ - -const MenuButtonStyle = ` -inline-flex -justify-center w-full -cursor-default -rounded -border border-gray-100 -outline-8 -py-2 -px-2 -text-base`; - -const MenuItemStyle = ` -absolute -left-0 -mt-2 w-60 -origin-top-left -rounded -shadow-lg -focus:outline-none -py-2 px-4 sm:text-sm`; - -/* -------------------------------------------------------------------------- */ -/* Component implementation */ -/* -------------------------------------------------------------------------- */ -/** - * Use width ContextMenuAction.tsx , for example: - * - * alert('click')} - * > - * ... - * - */ -export default function ContextMenu({ - button, - children, - className, - emphasis = "low", -}: MenuProps) { - return ( - - {({ open }) => ( - <> - - {button} - - - - - {children} - - - - )} - - ); -} diff --git a/src/components/ContextMenuAction.tsx b/src/components/ContextMenuAction.tsx deleted file mode 100644 index 8d1e653..0000000 --- a/src/components/ContextMenuAction.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import classNames from "classnames"; -import React from "react"; - -type Props = { - action: Function; - caption: string; - disabled?: boolean; - icon?: React.ReactNode; - className?: string | undefined; -}; - -export default function ContextMenuAction({ - action, - caption, - disabled, - icon, - className, -}: Props) { - return ( - action(e)} - className={classNames([ - "group flex px-2 rounded items-center text-base hover:bg-gray-100", - className, - ])} - > - {icon &&
{icon}
} - {caption} -
- ); -} diff --git a/src/components/Header.tsx b/src/components/Header.tsx deleted file mode 100644 index d9934f5..0000000 --- a/src/components/Header.tsx +++ /dev/null @@ -1,163 +0,0 @@ -import classNames from "classnames"; -import { useState } from "react"; -/* -------------------------------------------------------------------------- */ -/* Components */ -/* -------------------------------------------------------------------------- */ -import ContextMenuAction from "./ContextMenuAction"; -import ContextMenu from "./ContextMenu"; -import Logofreeland from "./Logofreeland"; -import { Button } from "./Button/Button"; -import Avatar from "./Avatar"; -import Navbar from "./Navbar"; -import Bell from "./Bell"; -import Logo from "./Logo"; -import Link from "./Link"; - -/* -------------------------------------------------------------------------- */ -/* Icons */ -/* -------------------------------------------------------------------------- */ -import { ReactComponent as SVGFavoriteOutlined } from "assets/svg/favorite-outlined.svg"; -import { ReactComponent as SVGFolder } from "assets/svg/folder.svg"; -import { ReactComponent as SVGFile } from "assets/svg/file.svg"; -import { ReactComponent as SVGEye } from "assets/svg/eye.svg"; - -const Header = () => { - const [authenticated, setAuthenticated] = useState(false); - const onClick = () => setAuthenticated(true); - - /* -------------------------------------------------------------------------- */ - /* Implement Header Component */ - /* -------------------------------------------------------------------------- */ - return ( -
- {/* Logo and Menu */} -
- {/* Logo - start - className="w-7 sm:w-10 " /> */} - - - - - {/* Logo - end - */} - - {/* Menu( Create new - My library - About ) Start */} -
- {/* Link Create now - start - */} - - Create new - - {/* Link Create now - end - */} - - {/* Dropdown Menu My library - start - */} - - console.log("My publications")} - icon={} - > - - console.log("My Favorites")} - icon={} - > - - console.log("My Collections")} - icon={} - > - - console.log("Recent Viewed")} - icon={} - > - - {/* Dropdown Menu My library - End - */} - - {/* Dropdown Menu About - start - */} - - console.log("About Freeland")} - > - - console.log("Contact Us")} - > - - console.log("Help")} - > - - {/* Dropdown Menu About - End - */} -
- {/* Menu( Create new - My library - About ) End */} -
- - {/* Sign in - Sign up - Notification - Avatar - Burger */} -
- {!authenticated - ? [ - , - , - ] - : [ - , - - , - ]} - {/* Burger component will be shown for the small screens */} - -
-
- ); -}; - -export default Header; diff --git a/src/components/Logotype.tsx b/src/components/Logotype.tsx deleted file mode 100644 index a699268..0000000 --- a/src/components/Logotype.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import {ReactComponent as SVGLogotype} from 'assets/svg/logotype.svg'; -import { Link } from 'react-router-dom'; - -type Props = { - name?: string; -} - -/** - * Horizontal variant of logotype component - * @param {string} name Name of service to attach to logotype - * @return {React.ReactNode} - */ -export default function Logotype({name}: Props): JSX.Element { - return ( -
-
- - - -
-
- {name ?? ''} {process.env.REACT_APP_CMS_APP_NAME?.toLowerCase()} -
-
- ); -} diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 81fc892..12da354 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -5,8 +5,8 @@ import classNames from "classnames"; /* -------------------------------------------------------------------------- */ /* Components */ /* -------------------------------------------------------------------------- */ -import ContextMenuAction from "./ContextMenuAction"; -import ContextMenu from "./ContextMenu"; +import ContextMenuAction from "./drop-down-menu/ContextMenuAction"; +import ContextMenu from "./drop-down-menu/ContextMenu"; import { Button } from "./Button/Button"; /* -------------------------------------------------------------------------- */ diff --git a/src/components/drop-down-menu/ContextMenu.tsx b/src/components/drop-down-menu/ContextMenu.tsx index 16b7c0c..e3c7866 100644 --- a/src/components/drop-down-menu/ContextMenu.tsx +++ b/src/components/drop-down-menu/ContextMenu.tsx @@ -5,7 +5,7 @@ import React, { Fragment } from "react"; import { Menu, Transition } from "@headlessui/react"; import { PropsPartion } from "./ContextMenuItem"; import classNames from "classnames"; -import { ReactComponent as SelectIcon } from "assets/svg/select-arrow.svg"; +import { SVGCaretDown } from "components/icons"; type ChildType = React.ReactElement; type ChildrenType = ChildType[] | ChildType; @@ -25,13 +25,13 @@ type MenuProps = { /* -------------------------------------------------------------------------- */ const MenuButtonStyle = ` +items-center inline-flex justify-center w-full cursor-default rounded border border-gray-100 outline-8 -bg-white py-2 pl-4 pr-1 @@ -43,7 +43,7 @@ left-0 mt-2 w-60 origin-top-left rounded -bg-white +bg-white shadow-lg focus:outline-none py-2 px-4 sm:text-sm`; @@ -51,17 +51,17 @@ py-2 px-4 sm:text-sm`; /* -------------------------------------------------------------------------- */ /* Component implementation */ /* -------------------------------------------------------------------------- */ -/** -* Use width ContextMenuAction.tsx , for example: -* -* alert('click')} -* > -* ... -* -*/ +/** + * Use width ContextMenuAction.tsx , for example: + * + * alert('click')} + * > + * ... + * + */ export default function ContextMenu({ button, children, @@ -69,48 +69,50 @@ export default function ContextMenu({ emphasis = "low", }: MenuProps) { return ( - - {({ open }) => ( - <> - + {({ open }) => ( + <> + + {button} + + + + - {button} - - - - - {children} - - - - )} - + {children} + + + + )} + ); } diff --git a/src/components/drop-down-menu/ContextMenuAction.tsx b/src/components/drop-down-menu/ContextMenuAction.tsx index 2023fb1..8d1e653 100644 --- a/src/components/drop-down-menu/ContextMenuAction.tsx +++ b/src/components/drop-down-menu/ContextMenuAction.tsx @@ -1,7 +1,6 @@ import classNames from "classnames"; import React from "react"; - type Props = { action: Function; caption: string; @@ -18,19 +17,16 @@ export default function ContextMenuAction({ className, }: Props) { return ( - - + ); } - diff --git a/src/components/icons.tsx b/src/components/icons.tsx index 9cf238a..7dd54ab 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -34,7 +34,7 @@ export { ReactComponent as SVGFilter } from "assets/svg/filter.svg"; export { ReactComponent as SVGFlag } from "assets/svg/flag.svg"; export { ReactComponent as SVGFolder } from "assets/svg/folder.svg"; export { ReactComponent as SVGFormula } from "assets/svg/formula.svg"; -export { ReactComponent as SVGFundomental } from "assets/svg/fundomental.svg"; +export { ReactComponent as SVGFundamental } from "assets/svg/fundamental.svg"; export { ReactComponent as SVGGrid } from "assets/svg/grid.svg"; export { ReactComponent as SVGHamburger } from "assets/svg/hamburger.svg"; export { ReactComponent as SVGHelp } from "assets/svg/help.svg"; diff --git a/src/components/parts/Header.tsx b/src/components/parts/Header.tsx index 99650bb..12e8a4e 100644 --- a/src/components/parts/Header.tsx +++ b/src/components/parts/Header.tsx @@ -1,113 +1,174 @@ -/* -------------------------------------------------------------------------- */ -/* Libs */ -/* -------------------------------------------------------------------------- */ -import React, { useEffect } from "react"; -import { useNavigate } from "react-router-dom"; +import classNames from "classnames"; +import { useState } from "react"; /* -------------------------------------------------------------------------- */ /* Components */ /* -------------------------------------------------------------------------- */ -import ContextMenu from "components/containers/contextmenu/ContextMenu"; -import Logotype from "components/Logotype"; -import Avatar from "components/containers/Avatar"; -import ContextMenuAction from "components/containers/contextmenu/ContextMenuAction"; -/* -------------------------------------------------------------------------- */ -/* SVG */ -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ -/* Hooks */ -/* -------------------------------------------------------------------------- */ -import { useUserStore } from "user/data/userSlice"; -import { useUserViewModel } from "user/controller/userViewModel"; -import { useUIStore } from "ui/data/uiSlice"; -import { useUIViewModel } from "ui/controller/uiViewModel"; -import { useTranslation } from "react-i18next"; -import ServicesNavigationContext from "services/views/ServicesNavigationContext"; -import { useAuthStore } from "auth/data/authSlice"; -import { useAuthViewModel } from "auth/controller/useAuthViewModel"; +import ContextMenuAction from "../drop-down-menu/ContextMenuAction"; +import ContextMenu from "../drop-down-menu/ContextMenu"; +import Logofreeland from "../Logofreeland"; +import { Button } from "../Button/Button"; +import Avatar from "../Avatar"; +import Navbar from "../Navbar"; +import Logo from "../Logo"; +import { RouterLink } from "components/typography/RouterLink"; /* -------------------------------------------------------------------------- */ -/* Main application header */ +/* Icons */ /* -------------------------------------------------------------------------- */ -type Props = { - title?: string; -} -/** - * Main application header - * @return {JSX.Element} - */ -export default function Header({title}: Props) { +import { + SVGBellNotification, + SVGBell, + SVGFavoriteOutlined, + SVGFolder, + SVGFile, + SVGEye, +} from "components/icons"; - const {t} = useTranslation(); - const userStore = useUserStore(); - const uiStore = useUIStore(); - const authStore = useAuthStore(); - const {signOut} = useAuthViewModel(authStore); - const { user, isLoading, getUser } = useUserViewModel(userStore); - const { showSearchbar } = useUIViewModel(uiStore); +const Header = () => { + const [authenticated, setAuthenticated] = useState(false); + const onClick = () => setAuthenticated(true); + const [notification, setNotification] = useState(false); - useEffect(() => { - getUser(); - }, [getUser]); - - const navigate = useNavigate(); + /* -------------------------------------------------------------------------- */ + /* Implement Header Component */ + /* -------------------------------------------------------------------------- */ return ( -
-
- - -
-
- - } - className="absolute w-full min-h-14 sm:w-80 -bottom-3 - sm:top-auto sm:bottom-auto right-0 - mt-5 z-10 sm:transform -translate-1/2 - origin-top-center flex flex-col items-center justify-center !pt-8" + {/* Logo and Menu */} +
+ {/* Logo - start - className="w-7 sm:w-10 " /> */} + + + + + {/* Logo - end - */} + + {/* Menu( Create new - My library - About ) Start */} +
- -
- -
-
- {isLoading - ? " " - : t("hellousr", { - username: [user?.lastname, user?.firstname].join(" "), - })} -
-
- {isLoading ? " " : user?.email} -
- { - navigate('/personal-information'); - }} - disabled={isLoading} - className="group w-full py-2 -mx-4 px-4 hover:bg-gray-200/20 rounded-md hover:text-blue-400 transition-colors" - caption="Account settings" - - /> - { - navigate(""); - }} - disabled={isLoading} - className="group w-full py-2 -mx-4 px-4 hover:bg-gray-200/20 rounded-md hover:text-blue-400 transition-colors" - caption={t("account.connect")} - - /> - - + {/* Link Create now - start - */} + + Create new + + {/* Link Create now - end - */} + + {/* Dropdown Menu My library - start - */} + + console.log("My publications")} + icon={} + > + + console.log("My Favorites")} + icon={} + > + + console.log("My Collections")} + icon={} + > + + console.log("Recent Viewed")} + icon={} + > + + {/* Dropdown Menu My library - End - */} + + {/* Dropdown Menu About - start - */} + + console.log("About Freeland")} + > + + console.log("Contact Us")} + > + + console.log("Help")} + > + + {/* Dropdown Menu About - End - */} +
+ {/* Menu( Create new - My library - About ) End */}
-
+ + {/* Sign in - Sign up - Notification - Avatar - Burger */} +
+ {!authenticated + ? [ + , + , + ] + : [ + , + + , + ]} + {/* Burger component will be shown for the small screens */} + +
+ ); -} +}; + +export default Header;