diff --git a/packages/web/src/components/Drawer/index.tsx b/packages/web/src/components/Drawer/index.tsx index 98d428df..74bb0daf 100644 --- a/packages/web/src/components/Drawer/index.tsx +++ b/packages/web/src/components/Drawer/index.tsx @@ -3,16 +3,22 @@ import { DrawerProps } from '@mui/material/Drawer'; import Toolbar from '@mui/material/Toolbar'; import List from '@mui/material/List'; import Divider from '@mui/material/Divider'; -import ListItem from '@mui/material/ListItem'; -import ListItemIcon from '@mui/material/ListItemIcon'; -import ListItemText from '@mui/material/ListItemText'; -import InboxIcon from '@mui/icons-material/MoveToInbox'; -import MailIcon from '@mui/icons-material/Mail'; +import DashboardIcon from '@mui/icons-material/Dashboard'; +import AppsIcon from '@mui/icons-material/Apps'; +import LanguageIcon from '@mui/icons-material/Language'; +import OfflineBoltIcon from '@mui/icons-material/OfflineBolt'; + +import ListItemLink from 'components/ListItemLink'; import HideOnScroll from 'components/HideOnScroll'; +import useFormatMessage from 'hooks/useFormatMessage'; +import * as URLS from 'config/urls'; import { Drawer as BaseDrawer } from './style'; + export default function Drawer(props: DrawerProps) { + const formatMessage = useFormatMessage(); + return ( + - {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => ( - - - {index % 2 === 0 ? : } - - - - ))} + } + primary={formatMessage('drawer.dashboard')} + to={URLS.DASHBOARD} + /> + + } + primary={formatMessage('drawer.flows')} + to={URLS.FLOWS} + /> + + } + primary={formatMessage('drawer.apps')} + to={URLS.APPS} + /> + + } + primary={formatMessage('drawer.explore')} + to={URLS.EXPLORE} + /> + - - {['All mail', 'Trash', 'Spam'].map((text, index) => ( - - - {index % 2 === 0 ? : } - - - - ))} - ); } diff --git a/packages/web/src/components/ListItemLink/index.tsx b/packages/web/src/components/ListItemLink/index.tsx new file mode 100644 index 00000000..d0ce1b77 --- /dev/null +++ b/packages/web/src/components/ListItemLink/index.tsx @@ -0,0 +1,35 @@ +import { useMemo, forwardRef } from 'react'; +import ListItem from '@mui/material/ListItem'; +import ListItemIcon from '@mui/material/ListItemIcon'; +import ListItemText from '@mui/material/ListItemText'; +import { Link, LinkProps } from 'react-router-dom'; + +type ListItemLinkProps = { + icon: React.ReactNode; + primary: string; + to: string; +} + +export default function ListItemLink(props: ListItemLinkProps) { + const { icon, primary, to } = props; + + const CustomLink = useMemo( + () => + forwardRef>(function InLineLink( + linkProps, + ref, + ) { + return ; + }), + [to], + ); + + return ( +
  • + + {icon} + + +
  • + ); +}; diff --git a/packages/web/src/config/urls.ts b/packages/web/src/config/urls.ts new file mode 100644 index 00000000..3bb2587f --- /dev/null +++ b/packages/web/src/config/urls.ts @@ -0,0 +1,4 @@ +export const DASHBOARD = '/dashboard'; +export const APPS = '/apps'; +export const FLOWS = '/flows'; +export const EXPLORE = '/explore'; \ No newline at end of file diff --git a/packages/web/src/locales/en.json b/packages/web/src/locales/en.json index 9eb806a7..98f715b3 100644 --- a/packages/web/src/locales/en.json +++ b/packages/web/src/locales/en.json @@ -1,5 +1,9 @@ { "brandText": "automatisch", "searchPlaceholder": "Search...", - "welcomeText": "Here comes the dashboard homepage." + "welcomeText": "Here comes the dashboard homepage.", + "drawer.dashboard": "Dashboard", + "drawer.flows": "Flows", + "drawer.apps": "Apps", + "drawer.explore": "Explore" } \ No newline at end of file