Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
feat(component): add helper object to manage pages
Browse files Browse the repository at this point in the history
  ## what
  - add helper object to keep track all pages in the App
  - create interface for basic structure of pages
    - contains:
      - linkName
      - url
      - icon
  - create object of type Record<string, IpageLinks> to store pages data

  ## how

  ## why
  - this will be used to create items on AppBar and AppDrawer
  - the reason it's an object and not array, is because I want to be
    selective which items are added to the drawer or appbar

  ## where

  ## usage
  • Loading branch information
Clumsy-Coder committed Aug 20, 2023
1 parent f44752b commit 9db8df1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/utils/pageLinks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { SvgIconTypeMap } from '@mui/material/SvgIcon';

import GithubIcon from '@mui/icons-material/GitHub';
import HomeIcon from '@mui/icons-material/Home';
import InfoIcon from '@mui/icons-material/Info';

/**
* Appbar link structure.
* Used for displaying links on Appbar or Drawer
*/
export interface IpageLinks {
linkName: string;
url: string;
icon: React.ReactElement<SvgIconTypeMap<'svg'>>;
}

/**
* Objects of pageLinks used by AppBar and Drawer.
*/
export const pageLinks: Record<string, IpageLinks> = {
home: {
linkName: 'Home',
url: '/',
icon: <HomeIcon />,
},
about: {
linkName: 'About',
url: '/about',
icon: <InfoIcon />,
},
githubRepo: {
linkName: 'Github repo',
url: 'https://github.com/clumsy-coder/pihole-dashboard',
icon: <GithubIcon />,
},
};

0 comments on commit 9db8df1

Please sign in to comment.