<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anyars Yussif</title>
    <description>The latest articles on DEV Community by Anyars Yussif (@anyarsencarta).</description>
    <link>https://dev.to/anyarsencarta</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3176002%2F2e2633d6-b294-4c67-9d5b-6d9995354979.jpeg</url>
      <title>DEV Community: Anyars Yussif</title>
      <link>https://dev.to/anyarsencarta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anyarsencarta"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>Anyars Yussif</dc:creator>
      <pubDate>Thu, 22 May 2025 09:12:48 +0000</pubDate>
      <link>https://dev.to/anyarsencarta/-4n55</link>
      <guid>https://dev.to/anyarsencarta/-4n55</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/maxprilutskiy/html5-elements-you-didnt-know-you-need-gan" class="crayons-story__hidden-navigation-link"&gt;HTML5 Elements You Didn't Know You Need&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/maxprilutskiy" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F689136%2Fbfd83da5-0a32-4f35-aada-6fb2e3f80bed.png" alt="maxprilutskiy profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/maxprilutskiy" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Max Prilutskiy
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Max Prilutskiy
                
              
              &lt;div id="story-author-preview-content-2508450" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/maxprilutskiy" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F689136%2Fbfd83da5-0a32-4f35-aada-6fb2e3f80bed.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Max Prilutskiy&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/maxprilutskiy/html5-elements-you-didnt-know-you-need-gan" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;May 21 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/maxprilutskiy/html5-elements-you-didnt-know-you-need-gan" id="article-link-2508450"&gt;
          HTML5 Elements You Didn't Know You Need
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/javascript"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;javascript&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/html"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;html&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/css"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;css&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/maxprilutskiy/html5-elements-you-didnt-know-you-need-gan" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;235&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/maxprilutskiy/html5-elements-you-didnt-know-you-need-gan#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              54&lt;span class="hidden s:inline"&gt; comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            8 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>Build the UI of an Admin Dashboard for a Pharmacy Management Application using Next.js</title>
      <dc:creator>Anyars Yussif</dc:creator>
      <pubDate>Sun, 18 May 2025 15:26:32 +0000</pubDate>
      <link>https://dev.to/anyarsencarta/build-the-ui-of-an-admin-dashboard-for-a-pharmacy-management-application-using-nextjs-201e</link>
      <guid>https://dev.to/anyarsencarta/build-the-ui-of-an-admin-dashboard-for-a-pharmacy-management-application-using-nextjs-201e</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcddfe95m5vu5vtrkkpbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcddfe95m5vu5vtrkkpbd.png" alt="Image description" width="800" height="547"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, I will guide you to build the UI of an Admin dashboard for a Pharmacy Management Application using Next.js. By the end of this lesson, you will have better understanding of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js file based routing.&lt;/li&gt;
&lt;li&gt;how to add tailwind css classes.&lt;/li&gt;
&lt;li&gt;how to add light and dark mode with a toggle.&lt;/li&gt;
&lt;li&gt;how to use third party libraries like shadcn, and recharts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Watch a &lt;a href="https://youtu.be/YPpzXWA1WR0?si=KUd_NSYcFRdo4ID6" rel="noopener noreferrer"&gt;sneak peak&lt;/a&gt; of what you will be building.&lt;/p&gt;

&lt;p&gt;In case you get stuck, you can visit the &lt;a href="https://github.com/anyars-encarta/encarta_pharmacy" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; repository for reference and please, give it a star!&lt;/p&gt;

&lt;p&gt;You could use any code editor to follow along, but for this tutorial, I recommend Visual Studio Code. I assume you are an intermediate developer. So, I would skip explaining some basic concepts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Setup
&lt;/h2&gt;

&lt;p&gt;To start, create a folder on your computer, open up your code editor, and drag the folder you created unto your code editor. Open the terminal and run the command below to spin up your Next.js application:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx create-next-app@latest ./&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Make sure to add the &lt;strong&gt;./&lt;/strong&gt;. Running the command without it would require you to specify the path for your application during the installation. The &lt;strong&gt;./&lt;/strong&gt; would ensure that the app is installed in your current directory.&lt;/p&gt;

&lt;p&gt;Accept all the default options till the setup is complete.&lt;/p&gt;

&lt;p&gt;Once the app is installed, take note of the files and folders created. We will be spending most of our time in the &lt;strong&gt;app&lt;/strong&gt; directory with little to do in the other files. Delete the public folder, open &lt;a href="https://drive.google.com/file/d/1jI244fgTlWBJoEH0iS82D3nhOilbjWoW/view?usp=sharing" rel="noopener noreferrer"&gt;this link&lt;/a&gt;, download, extract the content and copy the public folder into the root directory.&lt;/p&gt;

&lt;p&gt;Open the &lt;strong&gt;app/globals.css&lt;/strong&gt; file, delete the content and add a default-font. This means, that font would be applied throughout the application. Update it like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import "tailwindcss";

body {
  font-family: "Inter", sans-serif;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the &lt;strong&gt;app/page.tsx&lt;/strong&gt; file and delete the entire content. Type &lt;em&gt;rafce&lt;/em&gt; and select the first option from the intellisense to spin up a new functional component. If that doesn’t work for you, it means you don’t have the ES7+ snippets installed. Go to your extensions and search for &lt;strong&gt;ES7+&lt;/strong&gt;. Install &lt;strong&gt;ES7+ React/Redux/React-Native snippets&lt;/strong&gt;. Back to the &lt;strong&gt;page.tsx&lt;/strong&gt;, typing &lt;em&gt;rafce&lt;/em&gt; and selecting the first option should spin up the functional component.&lt;/p&gt;

&lt;p&gt;Now, let’s check and see if our app and the tailwind css are working by running &lt;code&gt;npm run dev&lt;/code&gt; in the terminal. Open a browser and visit &lt;strong&gt;&lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;/strong&gt;. You should see the text &lt;strong&gt;page&lt;/strong&gt; on the interface.&lt;/p&gt;

&lt;p&gt;Let’s give the div a &lt;code&gt;className&lt;/code&gt; of &lt;code&gt;text-red-500&lt;/code&gt;. If the text color changes to red, it means tailwind CSS is working and we can dive right in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Routing
&lt;/h2&gt;

&lt;p&gt;Let’s take a look at routing. The &lt;strong&gt;layout.tsx&lt;/strong&gt; is the entry point of our application and the &lt;strong&gt;page.tsx&lt;/strong&gt; gets rendered through the &lt;strong&gt;layout.tsx&lt;/strong&gt;. That is the &lt;code&gt;{children}&lt;/code&gt; you see in the &lt;strong&gt;layout.tsx&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;Any information added directly in the &lt;strong&gt;layout.tsx&lt;/strong&gt; automatically appears on all pages in the app. Inside the &lt;strong&gt;layout.tsx&lt;/strong&gt;, lets update the bottom code like below. We are adding the word “Amazing” below &lt;code&gt;{children}&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function RootLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;html lang="en"&amp;gt;
      &amp;lt;body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      &amp;gt;
        {children}
        Amazing
      &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the word “Amazing” appear below page on the browser. Now you can remove the “Amazing” word from the &lt;strong&gt;layout.tsx&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;We are going to create our own route groups since the app will involve navigating from one route to another. Firstly, lets delete the &lt;strong&gt;app/page.tsx&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;Create a new folder inside the app directory and name it &lt;strong&gt;(root)&lt;/strong&gt;. A folder with a name inside parenthesis is used to group routes without affecting the url structure. Inside the &lt;strong&gt;(root)&lt;/strong&gt; folder, create a file and name it &lt;strong&gt;layout.tsx&lt;/strong&gt; and update it like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function MainLayout({
    children,
  }: Readonly&amp;lt;{
    children: React.ReactNode;
  }&amp;gt;) {
    return (
      &amp;lt;div&amp;gt;
        {children}
      &amp;lt;/div&amp;gt;
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every route group must have its own &lt;strong&gt;layout.tsx&lt;/strong&gt; file which will be responsible for rendering the pages within that group. Notice that, this &lt;strong&gt;layout.tsx&lt;/strong&gt; differs from the &lt;strong&gt;RootLayout&lt;/strong&gt;. It only renders &lt;code&gt;{children}&lt;/code&gt; within a &lt;code&gt;div&lt;/code&gt; tag.&lt;/p&gt;

&lt;p&gt;Still inside the &lt;strong&gt;(root)&lt;/strong&gt; folder, create another folder and name it &lt;strong&gt;dashboard&lt;/strong&gt;. Inside the dashboard, create a &lt;strong&gt;page.tsx&lt;/strong&gt; file, run &lt;em&gt;rafce&lt;/em&gt; to spin up a functional component and update it like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Dashboard = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;Dashboard&amp;lt;/div&amp;gt;
  )
}

export default Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a folder’s name is placed in parenthesis, it means you could navigate to the routes inside that folder without involving the name in parenthesis. Now, visit &lt;a href="http://localhost:3000/dashboard" rel="noopener noreferrer"&gt;http://localhost:3000/dashboard&lt;/a&gt; in your browser. It should have been &lt;a href="http://localhost:3000/(root)/dashboard" rel="noopener noreferrer"&gt;http://localhost:3000/(root)/dashboard&lt;/a&gt;, but the (root) is skipped.&lt;/p&gt;

&lt;p&gt;You should see the word “Dashboard” on the browser.&lt;/p&gt;

&lt;p&gt;Lets create additional routes inside the &lt;strong&gt;(root)&lt;/strong&gt; folder like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmihptjyd57ke681rt9p5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmihptjyd57ke681rt9p5.png" alt="Image description" width="471" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating the folders, create a &lt;strong&gt;page.tsx&lt;/strong&gt; file in each folder. Now run &lt;em&gt;rafce&lt;/em&gt; in each &lt;strong&gt;page.tsx&lt;/strong&gt; and create functional components inside them. Name each component with the name of it’s folder. Example, when I run &lt;em&gt;rafce&lt;/em&gt; inside medicines-list, I will rename the component like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const MedicinesList = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;MedicinesList&amp;lt;/div&amp;gt;
  )
}

export default MedicinesList
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running &lt;em&gt;rafce&lt;/em&gt; inside purchase-orders, I will rename like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const PurchaseOrders = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;PurchaseOrders&amp;lt;/div&amp;gt;
  )
}

export default PurchaseOrders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now with the folders and files created, we could navigate through them. In the browser url, navigate to the following pages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://localhost:3000/customers" rel="noopener noreferrer"&gt;http://localhost:3000/customers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://localhost:3000/medicines-list" rel="noopener noreferrer"&gt;http://localhost:3000/medicines-list&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://localhost:3000/prescriptions" rel="noopener noreferrer"&gt;http://localhost:3000/prescriptions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://localhost:3000/pos" rel="noopener noreferrer"&gt;http://localhost:3000/pos&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you could see Customers, MedicinesList, Prescriptions, POS in each case on the browser, it means you have successfully implemented routing in Next.js. Congrats!&lt;/p&gt;

&lt;p&gt;Challenge yourself! In your browser, update the url to display the contents of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Purchase Orders&lt;/li&gt;
&lt;li&gt;Stock Alerts&lt;/li&gt;
&lt;li&gt;Suppliers&lt;/li&gt;
&lt;li&gt;Reports&lt;/li&gt;
&lt;li&gt;Invoices&lt;/li&gt;
&lt;li&gt;Returns&lt;/li&gt;
&lt;li&gt;Try creating routes for Profile, Settings, and Sign In.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pages inside the &lt;strong&gt;(root)&lt;/strong&gt; directory are rendered through the &lt;strong&gt;layout.tsx&lt;/strong&gt; file inside the &lt;strong&gt;(root)&lt;/strong&gt; directory. The &lt;code&gt;{children}&lt;/code&gt; within the &lt;code&gt;div&lt;/code&gt; represent the pages. Therefore, if we add any text or component directly inside the &lt;strong&gt;layout.tsx&lt;/strong&gt; file, that text or component would be rendered alongside any page being rendered through &lt;code&gt;{children}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Considering that our app will have a Navbar and a Menu bar which are expected to be visible irrespective of the page being rendered, we could add the Navbar and Menu bar directly inside the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;From the &lt;a href="https://youtu.be/YPpzXWA1WR0?si=KUd_NSYcFRdo4ID6" rel="noopener noreferrer"&gt;sneak peak&lt;/a&gt; video, you could see that the dashboard has two sections; left and right. The left side contains a logo, the app name and the side menu. The right side contains the Navbar and the pages.&lt;/p&gt;

&lt;p&gt;Firstly, let’s give the parent container in the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; a full height by giving it a &lt;code&gt;className&lt;/code&gt; of &lt;code&gt;h-screen&lt;/code&gt;, make it a flex box, give it a background color, and make the text white. Update the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function MainLayout({
    children,
  }: Readonly&amp;lt;{
    children: React.ReactNode;
  }&amp;gt;) {
    return (
      &amp;lt;div className='h-screen flex bg-gray-950 text-white'&amp;gt;
        {children}
      &amp;lt;/div&amp;gt;
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s add two divs to separate the left and right sides. The left side &lt;code&gt;div&lt;/code&gt; will take 14% of the screen and the right side will take 86%. Note that the &lt;code&gt;{children}&lt;/code&gt; is part of the right side &lt;code&gt;div&lt;/code&gt;. Update the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function MainLayout({
    children,
  }: Readonly&amp;lt;{
    children: React.ReactNode;
  }&amp;gt;) {
    return (
      &amp;lt;div className='h-screen flex bg-gray-950 text-white'&amp;gt;
        &amp;lt;div className='w-[14%] bg-gray-800'&amp;gt;Left&amp;lt;/div&amp;gt;
        &amp;lt;div className='w-[86%]'&amp;gt;
          Right
        {children}
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the left &lt;code&gt;div&lt;/code&gt; has a width of 14% and the right side has a width of 86%. Let’s give the left &lt;code&gt;div&lt;/code&gt; some padding and a right border. Update the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function MainLayout({
    children,
  }: Readonly&amp;lt;{
    children: React.ReactNode;
  }&amp;gt;) {
    return (
      &amp;lt;div className='h-screen flex bg-gray-950 text-white'&amp;gt;
        &amp;lt;div className='w-[14%] bg-gray-800 p-4 border-r border-gray-400'&amp;gt;Left&amp;lt;/div&amp;gt;
        &amp;lt;div className='w-[86%]'&amp;gt;
          Right
        {children}
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the top of the left side &lt;code&gt;div&lt;/code&gt;, let’s a add a &lt;code&gt;Link&lt;/code&gt; imported from &lt;code&gt;next/link&lt;/code&gt; which will contain the logo and the name of the app. Update the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image";
import Link from "next/link";

export default function MainLayout({
    children,
  }: Readonly&amp;lt;{
    children: React.ReactNode;
  }&amp;gt;) {
    return (
      &amp;lt;div className='h-screen flex bg-gray-950 text-white'&amp;gt;
        &amp;lt;div className='w-[14%] bg-gray-800 p-4 border-r border-gray-400'&amp;gt;
          &amp;lt;Link
            href="/dashboard"
            className="flex items-center justify-center gap-2"
          &amp;gt;
            &amp;lt;Image src="/logo.png" alt="Logo" width={32} height={32} /&amp;gt;
            &amp;lt;span className="font-bold"&amp;gt;
              Point of Care Pharmacy
            &amp;lt;/span&amp;gt;
          &amp;lt;/Link&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div className='w-[86%]'&amp;gt;
          Right
        {children}
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added a &lt;code&gt;Link&lt;/code&gt; which redirects to the dashboard and contains an image and a span with the name of the app. I made the link a flex box with centered contents and a gap of 2. The logo is given width and height of 32. The text in the span is boldened.&lt;/p&gt;

&lt;p&gt;Since the app would be mobile responsive, let’s add some responsiveness to the classNames.&lt;/p&gt;

&lt;p&gt;Firstly, the left side &lt;code&gt;div&lt;/code&gt; will be 14% initially, then 8% on md screens, 16% on lg screens, and 14% on xl screens. Also, the content of the link are centered but would be justified to the start on lg screens. The span will initially be hidden but would be visible on lg screens. Update the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image";
import Link from "next/link";

export default function MainLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;div className="h-screen flex bg-gray-950 text-white"&amp;gt;
      &amp;lt;div className="w-[14%] md:w-[8%] lg:w-[16%] xl:w-[14%] bg-gray-800 p-4 border-r border-gray-400"&amp;gt;
        &amp;lt;Link
          href="/"
          className="flex items-center justify-center lg:justify-start gap-2"
        &amp;gt;
          &amp;lt;Image src="/logo.png" alt="Logo" width={32} height={32} /&amp;gt;
          &amp;lt;span className="hidden lg:block font-bold"&amp;gt;
            Point of Care Pharmacy
          &amp;lt;/span&amp;gt;
        &amp;lt;/Link&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div className="w-[86%]"&amp;gt;
        Right
        {children}
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below the link, let’s add the side menu items. We will create that in a separate component and import it into the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; below the link.&lt;/p&gt;

&lt;p&gt;Create a folder in the root directory and name it &lt;strong&gt;components&lt;/strong&gt;. Inside the &lt;strong&gt;components&lt;/strong&gt; folder, create a file and name it &lt;strong&gt;SideMenu.tsx&lt;/strong&gt;. Inside the &lt;strong&gt;SideMenu.tsx&lt;/strong&gt; file, run &lt;em&gt;rafce&lt;/em&gt; to spin up a functional component. It should look like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const SideMenu = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;SideMenu&amp;lt;/div&amp;gt;
  )
}

export default SideMenu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import the SideMenu component into the &lt;strong&gt;MainLayout.tsx&lt;/strong&gt; below the link like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import SideMenu from "@/components/SideMenu";
import Image from "next/image";
import Link from "next/link";

export default function MainLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;div className="h-screen flex bg-gray-950 text-white"&amp;gt;
      &amp;lt;div className="w-[14%] md:w-[8%] lg:w-[16%] xl:w-[14%] bg-gray-800 p-4 border-r border-gray-400"&amp;gt;
        &amp;lt;Link
          href="/"
          className="flex items-center justify-center lg:justify-start gap-2"
        &amp;gt;
          &amp;lt;Image src="/logo.png" alt="Logo" width={32} height={32} /&amp;gt;
          &amp;lt;span className="hidden lg:block font-bold"&amp;gt;
            Point of Care Pharmacy
          &amp;lt;/span&amp;gt;
        &amp;lt;/Link&amp;gt;

        &amp;lt;SideMenu /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div className="w-[86%]"&amp;gt;
        Right
        {children}
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s open the &lt;strong&gt;SideMenu.tsx&lt;/strong&gt; file and implement it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side Menu
&lt;/h2&gt;

&lt;p&gt;First, we have to create a file which will contain the menu items. Then we can import the file into the &lt;strong&gt;SideMenu.tsx&lt;/strong&gt; and map through them to display the menu items.&lt;/p&gt;

&lt;p&gt;Create a folder in the root directory and name it &lt;strong&gt;constants&lt;/strong&gt;. Inside the &lt;strong&gt;constants&lt;/strong&gt; folder, create a file and name it &lt;strong&gt;menu.ts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;According to the routes we created, we are supposed to have a list of menu items consisting of Dashboard, Customers, Invoices, Medicines List, POS, Prescriptions, Purchase Orders, Reports, Returns, Settings, Staff Management, Stock Alerts, and Suppliers. Let’s put the menu items under two separate titles; &lt;strong&gt;MENU&lt;/strong&gt;, and &lt;strong&gt;OTHER&lt;/strong&gt;. So, create an array containing those titles like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const menuItems = [
    {
        title: "MENU",
        items: [],
    },
    {
        title: "OTHER",
        items: [],
    },
 ];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each title object will contain an array of items beneath them like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const menuItems = [
  {
    title: "MENU",
    items: [
      {
        icon: "/dashboard.png",
        label: "Dashboard",
        href: "/dashboard",
      },
      {
        icon: "/customer.png",
        label: "Customers",
        href: "customers",
      },
      {
        icon: "/medicine_list.png",
        label: "Medicines List",
        href: "/medicines-list",
      },
      {
        icon: "/purchase_orders.png",
        label: "Purchase Orders",
        href: "/purchase-orders",
      },
      {
        icon: "/stock_alert.png",
        label: "Stock Alerts",
        href: "/stock-alerts",
      },
      {
        icon: "/suppliers.png",
        label: "Suppliers",
        href: "/suppliers",
      },
      {
        icon: "/prescription.png",
        label: "Prescriptions",
        href: "/prescriptions",
      },
      {
        icon: "/report.png",
        label: "Reports",
        href: "/reports",
      },
      {
        icon: "/invoice.png",
        label: "Invoices",
        href: "invoices",
      },
      {
        icon: "/pos.png",
        label: "POS",
        href: "/pos",
      },
      {
        icon: "/return.png",
        label: "Returns",
        href: "/returns",
      },
      {
        icon: "/staff_management.png",
        label: "Staff Management",
        href: "/staff-management",
      },
    ],
  },
  {
    title: "OTHER",
    items: [
      {
        icon: "/profile.png",
        label: "Profile",
        href: "/profile",
      },
      {
        icon: "/settings.png",
        label: "Settings",
        href: "/settings",
      },
      {
        icon: "/logout.png",
        label: "Logout",
        href: "/sign-in",
      },
    ],
  },
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;export&lt;/code&gt; keyword added at the top allows the &lt;code&gt;menuItems&lt;/code&gt; to be imported inside any component in the app. Now we can import the &lt;code&gt;menuItems&lt;/code&gt; into the &lt;strong&gt;sideMenu.tsx&lt;/strong&gt; and map through them like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { menuItems } from "@/constants/menu";
import Image from "next/image";
import Link from "next/link";
import React from "react";

const SideMenu = () =&amp;gt; {
  return (
    &amp;lt;div className="mt-4 text-sm"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i}&amp;gt;
          &amp;lt;span className=""&amp;gt;{item.title}&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Quite a lot happened here. First, I added some classNames to the container &lt;code&gt;div&lt;/code&gt; to give some margin at the top and made the texts small.&lt;/p&gt;

&lt;p&gt;Then I mapped through the &lt;code&gt;menuItems&lt;/code&gt; taking the &lt;code&gt;item&lt;/code&gt; and it’s index &lt;code&gt;i&lt;/code&gt;. For each &lt;code&gt;item&lt;/code&gt;, I instantly returned a &lt;code&gt;div&lt;/code&gt; and gave it a &lt;code&gt;key&lt;/code&gt; of the index &lt;code&gt;i&lt;/code&gt;. Inside the &lt;code&gt;div&lt;/code&gt;, I rendered a span into which I rendered the &lt;code&gt;item.title&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I mentioned the word &lt;strong&gt;instantly&lt;/strong&gt;. There are two types of returns; &lt;strong&gt;normal return&lt;/strong&gt; and &lt;strong&gt;instant return&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Below is a &lt;strong&gt;normal return&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{menuItems.map((item, i) =&amp;gt; {
  return (
    &amp;lt;div key={i}&amp;gt;
      &amp;lt;span className=""&amp;gt;{item.title}&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
  )
})}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a &lt;strong&gt;normal return&lt;/strong&gt;, a set of curly braces &lt;code&gt;{}&lt;/code&gt; follows the &lt;code&gt;=&amp;gt;&lt;/code&gt; and you will have to use &lt;code&gt;return ()&lt;/code&gt;. You then render the contents inside the &lt;code&gt;()&lt;/code&gt; of the &lt;code&gt;return&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Below is an &lt;strong&gt;instant return&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{menuItems.map((item, i) =&amp;gt; (
  &amp;lt;div key={i}&amp;gt;
    &amp;lt;span className=""&amp;gt;{item.title}&amp;lt;/span&amp;gt;
  &amp;lt;/div&amp;gt;
))}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In an &lt;strong&gt;instant return&lt;/strong&gt;, a set of parenthesis &lt;code&gt;()&lt;/code&gt; follows the &lt;code&gt;=&amp;gt;&lt;/code&gt; and you can directly render the contents without the need for any &lt;code&gt;return ()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now back to the course, let’s make the outer &lt;code&gt;div&lt;/code&gt; a flex box, arranged in a column with a gap of 2. The &lt;code&gt;span&lt;/code&gt; will initially be &lt;code&gt;hidden&lt;/code&gt; but show on lg screens. It will also have a text color, light font and a margin top and bottom of 4, like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { menuItems } from "@/constants/menu";
import Image from "next/image";
import Link from "next/link";
import React from "react";

const SideMenu = () =&amp;gt; {
  return (
    &amp;lt;div className="mt-4 text-sm"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
            &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
              {item.title}
            &amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember that the &lt;code&gt;menuItems&lt;/code&gt; file we created is an array with nested array of items. Therefore, each item contains an array of items. So we have to map through &lt;code&gt;item.items&lt;/code&gt; to get the items beneath the titles in the menu, like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { menuItems } from "@/constants/menu";
import Image from "next/image";
import Link from "next/link";
import React from "react";

const SideMenu = () =&amp;gt; {
  return (
    &amp;lt;div className="mt-4 text-sm"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
            &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
              {item.title}
            &amp;lt;/span&amp;gt;

          {item.items.map((subItem, j) =&amp;gt; {
            return (
              &amp;lt;Link href={subItem.href} key={j}&amp;gt;
                &amp;lt;Image
                  src={subItem.icon}
                  alt={subItem.label}
                  width={20}
                  height={20}
                /&amp;gt;
                &amp;lt;span&amp;gt;{subItem.label}&amp;lt;/span&amp;gt;
              &amp;lt;/Link&amp;gt;
            );
          })}
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that I used a &lt;strong&gt;normal return&lt;/strong&gt; in the second map. I will then give the &lt;code&gt;Link&lt;/code&gt;, and &lt;code&gt;span&lt;/code&gt; classNames like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { menuItems } from "@/constants/menu";
import Image from "next/image";
import Link from "next/link";
import React from "react";

const SideMenu = () =&amp;gt; {
  return (
    &amp;lt;div className="mt-4 text-sm"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
            &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
              {item.title}
            &amp;lt;/span&amp;gt;

          {item.items.map((subItem, j) =&amp;gt; {
            return (
              &amp;lt;Link
                href={subItem.href}
                key={j}
                className="flex items-center justify-center lg:justify-start gap-4 text-gray-500 md:px-2 rounded-md hover:bg-purple-500 w-full"
              &amp;gt;
                &amp;lt;Image
                  src={subItem.icon}
                  alt={subItem.label}
                  width={20}
                  height={20}
                  className='invert my-4'
                /&amp;gt;
                &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
                  {subItem.label}
                &amp;lt;/span&amp;gt;
              &amp;lt;/Link&amp;gt;
            );
          })}
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, you could realize that the menu items are overflowing. To fix this, add &lt;code&gt;overflow-y-scroll h-[90vh]&lt;/code&gt; classNames to the outer &lt;code&gt;div&lt;/code&gt; of the &lt;strong&gt;SideMenu.tsx&lt;/strong&gt;. After adding the &lt;code&gt;overflow-y-scroll&lt;/code&gt;, you will see an ugly looking scroll bar. Open your &lt;strong&gt;globals.css&lt;/strong&gt; file and add the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add &lt;code&gt;no-scrollbar&lt;/code&gt; &lt;code&gt;className&lt;/code&gt; to the outer &lt;code&gt;div&lt;/code&gt; of the &lt;strong&gt;SideMenu.tsx&lt;/strong&gt;. The scrollbar should disappear. Below is the updated &lt;strong&gt;SideMenu.tsx&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { menuItems } from "@/constants/menu";
import Image from "next/image";
import Link from "next/link";
import React from "react";

const SideMenu = () =&amp;gt; {
  return (
    &amp;lt;div className="mt-4 text-sm overflow-y-scroll h-[90vh] no-scrollbar"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
            &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
              {item.title}
            &amp;lt;/span&amp;gt;

          {item.items.map((subItem, j) =&amp;gt; {
            return (
              &amp;lt;Link
                href={subItem.href}
                key={j}
                className="flex items-center justify-center lg:justify-start gap-4 text-gray-500 md:px-2 rounded-md hover:bg-purple-500 w-full"
              &amp;gt;
                &amp;lt;Image
                  src={subItem.icon}
                  alt={subItem.label}
                  width={20}
                  height={20}
                  className='invert my-4'
                /&amp;gt;
                &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
                  {subItem.label}
                &amp;lt;/span&amp;gt;
              &amp;lt;/Link&amp;gt;
            );
          })}
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, clicking on the menu items should navigate you to their respective pages. Hovering over them should also give you a nice background hover effect. If you were able to implement routes for the Profile, Settings, and Sign In pages, you should be able to navigate to them as well. Great job for coming this far! Give yourself a tap in the back!&lt;/p&gt;

&lt;h2&gt;
  
  
  Menu Items Background Color
&lt;/h2&gt;

&lt;p&gt;When I click on a menu item, I want the background color of that item to be highlighted. to achieve that, I will make use of &lt;code&gt;usePathname()&lt;/code&gt; hook coming from &lt;code&gt;next/navigation&lt;/code&gt;. It allows you to grab the current URL’s pathname.&lt;/p&gt;

&lt;p&gt;At the extreme top of the SideMenu component, let’s declare a constant, name it &lt;code&gt;pathname&lt;/code&gt; and assign it to the &lt;code&gt;usePathname()&lt;/code&gt; hook, like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const SideMenu = () =&amp;gt; {
  const pathname = usePathname();

  return (
    &amp;lt;div className="mt-4 text-sm overflow-y-scroll h-[90vh] no-scrollbar"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
            &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
              {item.title}
            &amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be sure to &lt;code&gt;import { usePathname } from “next/navigation”&lt;/code&gt;. Now, inside our map function, we have to declare an &lt;code&gt;isActive&lt;/code&gt; constant to check the active state, like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { menuItems } from "@/constants/menu";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import React from "react";

const SideMenu = () =&amp;gt; {
  const pathname = usePathname();

  return (
    &amp;lt;div className="mt-4 text-sm overflow-y-scroll h-[90vh] no-scrollbar"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
          &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
              &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
                {item.title}
              &amp;lt;/span&amp;gt;

            {item.items.map((subItem, j) =&amp;gt; {
              const isActive =
              (pathname.includes(subItem.href.toLowerCase()) &amp;amp;&amp;amp;
              subItem.href.length &amp;gt; 1) ||
              pathname === subItem.href.toLowerCase();

              return (
                &amp;lt;Link
                  href={subItem.href}
                  key={j}
                  className="flex items-center justify-center lg:justify-start gap-4 text-gray-500 md:px-2 rounded-md hover:bg-purple-500 w-full"
                &amp;gt;
                  &amp;lt;Image
                    src={subItem.icon}
                    alt={subItem.label}
                    width={20}
                    height={20}
                    className="invert my-4"
                  /&amp;gt;
                  &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
                    {subItem.label}
                  &amp;lt;/span&amp;gt;
                &amp;lt;/Link&amp;gt;
              );
            })}
          &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You could notice I added this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const isActive =
  (pathname.includes(subItem.href.toLowerCase()) &amp;amp;&amp;amp;
            subItem.href.length &amp;gt; 1) ||
          pathname === subItem.href.toLowerCase();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is basically checking if the &lt;code&gt;subItem.href&lt;/code&gt; exists and is contained in the &lt;code&gt;pathname&lt;/code&gt; (url path) or if the &lt;code&gt;pathname&lt;/code&gt; is equal to the &lt;code&gt;subItem.href&lt;/code&gt;. Of course, it converts them to lowercase before the check. If it contains the &lt;code&gt;subItem.href&lt;/code&gt;, then it is active. Otherwise, it is inactive.&lt;/p&gt;

&lt;p&gt;With that, we could update the classNames of the &lt;code&gt;Link&lt;/code&gt; to update the background color based on if the link is active or otherwise, like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { menuItems } from "@/constants/menu";
import { cn } from "@/lib/utils";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import React from "react";

const SideMenu = () =&amp;gt; {
  const pathname = usePathname();

  return (
    &amp;lt;div className="mt-4 text-sm overflow-y-scroll h-[90vh] no-scrollbar"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
          &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
              &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
                {item.title}
              &amp;lt;/span&amp;gt;

            {item.items.map((subItem, j) =&amp;gt; {
              const isActive =
              (pathname.includes(subItem.href.toLowerCase()) &amp;amp;&amp;amp;
              subItem.href.length &amp;gt; 1) ||
              pathname === subItem.href.toLowerCase();

              return (
                &amp;lt;Link
                  href={subItem.href}
                  key={j}
                  className={cn(isActive ? "bg-purple-500" : "","flex items-center justify-center lg:justify-start gap-4 text-gray-500 md:px-2 rounded-md hover:bg-purple-500 w-full")}
                &amp;gt;
                  &amp;lt;Image
                    src={subItem.icon}
                    alt={subItem.label}
                    width={20}
                    height={20}
                    className="invert my-4"
                  /&amp;gt;
                  &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
                    {subItem.label}
                  &amp;lt;/span&amp;gt;
                &amp;lt;/Link&amp;gt;
              );
            })}
          &amp;lt;/div&amp;gt;
        ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A series of things are happening here as well. Firstly, we are using a hook (&lt;code&gt;usePathname&lt;/code&gt;), so our component has to be a client component. You will have to add a &lt;code&gt;“use client”&lt;/code&gt; directive at the top of the file.&lt;/p&gt;

&lt;p&gt;Secondly, I am using a &lt;code&gt;cn&lt;/code&gt; function inside the &lt;code&gt;className&lt;/code&gt; of the &lt;code&gt;Link&lt;/code&gt;. The &lt;code&gt;cn&lt;/code&gt; is a utility function that allows to &lt;strong&gt;merge&lt;/strong&gt; classNames. You could see that, I used a ternary operator &lt;code&gt;isActive ? “bg-purple-500” : “”&lt;/code&gt; to dynamically apply the background color, then I added other tailwind classes after a comma. that is the power of the &lt;code&gt;cn&lt;/code&gt; function. The background color is applied only if it is active.&lt;/p&gt;

&lt;p&gt;To be able to use the &lt;code&gt;cn&lt;/code&gt; function, you first have to install &lt;code&gt;tailwind-merge&lt;/code&gt; and &lt;code&gt;clsx&lt;/code&gt;. So, open your terminal and run &lt;code&gt;npm i tailwind-merge clsx&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After, create a folder in the root directory and name it &lt;strong&gt;lib&lt;/strong&gt;. Inside the &lt;strong&gt;lib&lt;/strong&gt; folder, create a file and name it &lt;strong&gt;utils.ts&lt;/strong&gt;. Update the &lt;strong&gt;utils.ts&lt;/strong&gt; file like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, when you click on a menu item, it will have a background color. Great job!&lt;/p&gt;

&lt;p&gt;If you could remember, the menu item descriptions are initially &lt;code&gt;hidden&lt;/code&gt; and only visible on lg screens. See the span below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
  {subItem.label}
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The challenge would be that if the user is using a device with a screen size smaller than lg, it is only the menu icons they will see and it will be difficult for them to identify the icons by just looking at them. Therefore, it would be helpful if the user could get the name of the menu through a tooltip when they hover over the icon. To achieve that, we are using &lt;strong&gt;shadcn tooltip&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shadcn Tooltip
&lt;/h2&gt;

&lt;p&gt;Since this is a text tutorial, we can’t go through the &lt;a href="https://ui.shadcn.com/" rel="noopener noreferrer"&gt;shadcn&lt;/a&gt; documentation together. I will therefore tell you the things we need to do and the code we need to copy from the documentations to use in our application.&lt;/p&gt;

&lt;p&gt;You first have to visit &lt;a href="https://ui.shadcn.com/" rel="noopener noreferrer"&gt;shadcn&lt;/a&gt;, click &lt;strong&gt;Get Started&lt;/strong&gt; and select the stack you are using, which is Next.js in our case. Next, you have to initialize &lt;a href="https://ui.shadcn.com/" rel="noopener noreferrer"&gt;shadcn&lt;/a&gt; by running the command below in your terminal:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx shadcn@latest init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;code&gt;y&lt;/code&gt; to proceed when prompted to install &lt;a href="https://ui.shadcn.com/" rel="noopener noreferrer"&gt;shadcn&lt;/a&gt;. Choose slate as the base color (just my choice though!).&lt;/p&gt;

&lt;p&gt;Select &lt;code&gt;Use — legacy-peer-deps&lt;/code&gt;. This is to help resolve package versions compatibility issues.&lt;/p&gt;

&lt;p&gt;Next, we have to search for the particular component we want to use, which is &lt;strong&gt;Tooltip&lt;/strong&gt;. So, on the &lt;a href="https://ui.shadcn.com/" rel="noopener noreferrer"&gt;shadcn&lt;/a&gt; website, press &lt;strong&gt;control + K&lt;/strong&gt; or &lt;strong&gt;command + K&lt;/strong&gt; and type &lt;strong&gt;tooltip&lt;/strong&gt;. You would be guided to install it using the command below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx shadcn@latest add tooltip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;make sure to select &lt;code&gt;Use — legacy-peer-deps&lt;/code&gt; and proceed. You will notice that a folder named &lt;strong&gt;ui&lt;/strong&gt; is created inside your &lt;strong&gt;components&lt;/strong&gt; folder. Inside the &lt;strong&gt;ui&lt;/strong&gt; folder, you will see a file named &lt;strong&gt;tooltip.tsx&lt;/strong&gt;. You will not have to do anything inside that file anyway. I just wanted you to know that it was created for you.&lt;/p&gt;

&lt;p&gt;Next, we have to import the items below at the the top of our component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "@/components/ui/tooltip"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have now come to where the magic happens! The only code block we need to implement the tooltip functionality from &lt;a href="https://ui.shadcn.com/" rel="noopener noreferrer"&gt;shadcn&lt;/a&gt; is below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;TooltipProvider&amp;gt;
  &amp;lt;Tooltip&amp;gt;
    &amp;lt;TooltipTrigger&amp;gt;Hover&amp;lt;/TooltipTrigger&amp;gt;
    &amp;lt;TooltipContent&amp;gt;
      &amp;lt;p&amp;gt;Add to library&amp;lt;/p&amp;gt;
    &amp;lt;/TooltipContent&amp;gt;
  &amp;lt;/Tooltip&amp;gt;
&amp;lt;/TooltipProvider&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only thing we need to do here is to specify the item we want to trigger the tooltip on, and also specify the text we want to display as the tooltip.&lt;/p&gt;

&lt;p&gt;In our case, it is the menu icon we want to use to trigger the tooltip and when the user hovers over the menu icon, the label for that item is displayed as the tooltip. So we will update our code like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { menuItems } from "@/constants/menu";
import { cn } from "@/lib/utils";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import React from "react";
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "@/components/ui/tooltip";

const SideMenu = () =&amp;gt; {
  const pathname = usePathname();

  return (
    &amp;lt;div className="mt-4 text-sm overflow-y-scroll h-[90vh] no-scrollbar"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
          &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
            {item.title}
          &amp;lt;/span&amp;gt;

          {item.items.map((subItem, j) =&amp;gt; {
            const isActive =
              (pathname.includes(subItem.href.toLowerCase()) &amp;amp;&amp;amp;
                subItem.href.length &amp;gt; 1) ||
              pathname === subItem.href.toLowerCase();

            return (
              &amp;lt;Link
                href={subItem.href}
                key={j}
                className={cn(
                  isActive ? "bg-purple-500" : "",
                  "flex items-center justify-center lg:justify-start gap-4 text-gray-500 md:px-2 rounded-md hover:bg-purple-500 w-full"
                )}
              &amp;gt;
                &amp;lt;TooltipProvider&amp;gt;
                  &amp;lt;Tooltip&amp;gt;
                    &amp;lt;TooltipTrigger&amp;gt;
                      &amp;lt;Image
                        src={subItem.icon}
                        alt={subItem.label}
                        width={20}
                        height={20}
                        className="invert my-4"
                      /&amp;gt;
                    &amp;lt;/TooltipTrigger&amp;gt;
                    &amp;lt;TooltipContent&amp;gt;
                      &amp;lt;p&amp;gt;{subItem.label}&amp;lt;/p&amp;gt;
                    &amp;lt;/TooltipContent&amp;gt;
                  &amp;lt;/Tooltip&amp;gt;
                &amp;lt;/TooltipProvider&amp;gt;

                &amp;lt;span className="hidden lg:block text-gray-400 font-light my-4"&amp;gt;
                  {subItem.label}
                &amp;lt;/span&amp;gt;
              &amp;lt;/Link&amp;gt;
            );
          })}
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I basically pasted the code where we are rendering the image. I replaced the text “Hover” with the image tag. I replaced the “Add to library” text in the &lt;code&gt;p&lt;/code&gt; tag with &lt;code&gt;{subItem.label}&lt;/code&gt;. Now, when you hover over the menu icons, you should see the tooltips appear. Well-done for coming this far!&lt;/p&gt;

&lt;p&gt;Now that we are done with the &lt;strong&gt;SideMenu.tsx&lt;/strong&gt;, lets implement the Navbar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Navbar
&lt;/h2&gt;

&lt;p&gt;Inside the components folder, create a new file and name it &lt;strong&gt;Navbar.tsx&lt;/strong&gt;. Run &lt;em&gt;rafce&lt;/em&gt; to spin up the functional component.&lt;/p&gt;

&lt;p&gt;Let’s import and render the Navbar inside the MainLayout (the &lt;strong&gt;layout.tsx&lt;/strong&gt; file inside the &lt;strong&gt;(root)&lt;/strong&gt; folder), like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Navbar from "@/components/Navbar";
import SideMenu from "@/components/SideMenu";
import Image from "next/image";
import Link from "next/link";

export default function MainLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;div className="h-screen flex bg-gray-950 text-white"&amp;gt;
      &amp;lt;div className="w-[14%] md:w-[8%] lg:w-[16%] xl:w-[14%] bg-gray-800 p-4 border-r border-gray-400"&amp;gt;
        &amp;lt;Link
          href="/dashboard"
          className="flex items-center justify-center lg:justify-start gap-2"
        &amp;gt;
          &amp;lt;Image src="/logo.png" alt="Logo" width={32} height={32} className='invert'/&amp;gt;
          &amp;lt;span className="hidden lg:block font-bold"&amp;gt;
            Point of Care Pharmacy
          &amp;lt;/span&amp;gt;
        &amp;lt;/Link&amp;gt;

        &amp;lt;SideMenu /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div className="w-[86%]"&amp;gt;
        &amp;lt;Navbar /&amp;gt;
        {children}
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, le’s open the Navbar and start implementing it.&lt;/p&gt;

&lt;p&gt;From the &lt;a href="https://www.youtube.com/watch?v=YPpzXWA1WR0&amp;amp;feature=youtu.be" rel="noopener noreferrer"&gt;sneak peak&lt;/a&gt;, the navbar contains two sections; a search field on the left and other items on the right. So, the parent container will be a flex box with a space between them like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className='flex items-center justify-between p-4 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10'&amp;gt;

    &amp;lt;/div&amp;gt;
  )
}

export default Navbar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also added some padding and widths for various screen sizes. I added a bottom border and a &lt;code&gt;z-index&lt;/code&gt; of 10 to make sure it appears above other items during scrolling. I also made it &lt;code&gt;fixed&lt;/code&gt; with a background color.&lt;/p&gt;

&lt;p&gt;Since the Navbar contains two sections, we have to have two divs inside. For now, let’s create the divs with the texts “Left” and “Right” inside of each.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className='flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10'&amp;gt;
        &amp;lt;div&amp;gt;Left&amp;lt;/div&amp;gt;

        &amp;lt;div&amp;gt;Right&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Navbar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice that, the other component that was showing alongside the Navbar is now hidden. It is actually behind the Navbar. Remember I told you that, the &lt;code&gt;{childre}&lt;/code&gt; in the &lt;strong&gt;layout.tsx&lt;/strong&gt; represent the pages being rendered. Since the &lt;code&gt;{children}&lt;/code&gt; are now falling behind the Navbar, let’s give the &lt;code&gt;{children}&lt;/code&gt; some margin-top to push it down. Update the MainLayout like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Navbar from "@/components/Navbar";
import SideMenu from "@/components/SideMenu";
import Image from "next/image";
import Link from "next/link";

export default function MainLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;div className="h-screen flex bg-gray-950 text-white"&amp;gt;
      &amp;lt;div className="w-[14%] md:w-[8%] lg:w-[16%] xl:w-[14%] bg-gray-800 p-4 border-r border-gray-400"&amp;gt;
        &amp;lt;Link
          href="/dashboard"
          className="flex items-center justify-center lg:justify-start gap-2"
        &amp;gt;
          &amp;lt;Image
            src="/logo.png"
            alt="Logo"
            width={32}
            height={32}
            className="invert"
          /&amp;gt;
          &amp;lt;span className="hidden lg:block font-bold"&amp;gt;
            Point of Care Pharmacy
          &amp;lt;/span&amp;gt;
        &amp;lt;/Link&amp;gt;

        &amp;lt;SideMenu /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div className="w-[86%]"&amp;gt;
        &amp;lt;Navbar /&amp;gt;

        &amp;lt;div className="mt-16 p-4"&amp;gt;{children}&amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I just kept the &lt;code&gt;{children}&lt;/code&gt; inside a &lt;code&gt;div&lt;/code&gt; and gave it a margin top of 16px and a padding of 4px.&lt;/p&gt;

&lt;p&gt;Now back to the Navbar and implementing the left side, update the code like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className='flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10'&amp;gt;
        &amp;lt;div className='hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2'&amp;gt;Left&amp;lt;/div&amp;gt;

        &amp;lt;div&amp;gt;Right&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Navbar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I just gave the &lt;code&gt;div&lt;/code&gt; some classNames to make it hidden at the beginning and only visible on md screens and above. I also made it a flex box, rounded, with a ring around it. I also added some horizontal padding.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;div&lt;/code&gt; is supposed to have a search icon and a search input. So, update it like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;Right&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Navbar;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added an image and a search input. The search input has a width of 200px, padding of 2, transparent background with no outline.&lt;/p&gt;

&lt;p&gt;Now, let’s look at the right side of the Navbar. The right side contains a profile image, notifications icon with a counter, messages icon and a theme toggle. The items have to be flex with some gap between them. Update the code like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className='flex items-center justify-end gap-6 w-full'&amp;gt;
        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Navbar;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After making the &lt;code&gt;div&lt;/code&gt; &lt;code&gt;flex&lt;/code&gt; with &lt;code&gt;gap&lt;/code&gt; between the items, I added a user avatar and made it rounded. Don’t forget to &lt;code&gt;import Image from "next/image"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To the left of the user avatar, there is a full name and a user role beneath it. That should be another &lt;code&gt;flex&lt;/code&gt; &lt;code&gt;div&lt;/code&gt;. Adding that will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image";
import React from "react";

const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;
            Admin
          &amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Navbar;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I just added a &lt;code&gt;flex&lt;/code&gt; &lt;code&gt;div&lt;/code&gt; with a column direction above the avatar. Then I added two spans; one for the full name and the other for the user role.&lt;/p&gt;

&lt;p&gt;Next is the notifications icon. Since it has a counter, it also has to be inside another &lt;code&gt;div&lt;/code&gt;. So, above the &lt;code&gt;div&lt;/code&gt; containing the full name and role, add another &lt;code&gt;div&lt;/code&gt; with classNames like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image";
import React from "react";

const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center justify-center cursor-pointer"&amp;gt;
          &amp;lt;Image
            src="/notifications.png"
            alt="notification"
            width={20}
            height={20}
            className="invert"
          /&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;Admin&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Navbar;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, I added a &lt;code&gt;flex&lt;/code&gt; &lt;code&gt;div&lt;/code&gt; above the names with an image within it.&lt;/p&gt;

&lt;p&gt;To add the counter, add another &lt;code&gt;div&lt;/code&gt; right below the notifications image like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image";
import React from "react";

const Navbar = () =&amp;gt; {
  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center justify-center cursor-pointer"&amp;gt;
          &amp;lt;Image
            src="/notifications.png"
            alt="notification"
            width={20}
            height={20}
            className="invert"
          /&amp;gt;

          &amp;lt;div className="bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
            &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;Admin&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Navbar;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I added a &lt;code&gt;div&lt;/code&gt; below the notifications image with a &lt;code&gt;span&lt;/code&gt; that renders 0 within. I gave the &lt;code&gt;div&lt;/code&gt; a width and height and made it &lt;code&gt;flex&lt;/code&gt;, centered, and rounded. I also gave it a background color.&lt;/p&gt;

&lt;p&gt;Once you do this, you will notice that the image and the 0 are side by side each other, but the 0 is supposed to be at the top-right corner of the image. To achieve this, set their parent &lt;code&gt;div&lt;/code&gt; as &lt;code&gt;relative&lt;/code&gt; and the &lt;code&gt;div&lt;/code&gt; containing the &lt;code&gt;span&lt;/code&gt; as &lt;code&gt;absolute&lt;/code&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
   &amp;lt;Image
     src="/notifications.png"
     alt="notification"
     width={20}
     height={20}
     className="invert"
   /&amp;gt;

   &amp;lt;div className="absolute bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
      &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
   &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can use positioning to move the span around. I found these values to work the best: &lt;code&gt;-top-3 -right-3&lt;/code&gt;. Adding the values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
  &amp;lt;Image
    src="/notifications.png"
    alt="notification"
    width={20}
    height={20}
    className="invert"
  /&amp;gt;

   &amp;lt;div className="absolute -top-3 -right-3 bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
      &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
   &amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can now add the message icon above the notification parent. Add an image tag above the notification parent &lt;code&gt;div&lt;/code&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;Image
          src="/message.png"
          alt="Logo"
          width={20}
          height={20}
          className="invert"
        /&amp;gt;

        &amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
          &amp;lt;Image
            src="/notifications.png"
            alt="notification"
            width={20}
            height={20}
            className="invert"
          /&amp;gt;

          &amp;lt;div className="absolute -top-3 -right-3 bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
            &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;Admin&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Theme and Theme Toggler
&lt;/h2&gt;

&lt;p&gt;Next, let’s add the theme toggler. Before we do that, lets install &lt;code&gt;next-themes&lt;/code&gt;. So, open your terminal and run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i next-themes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s add a &lt;code&gt;div&lt;/code&gt; with classNames above the message icon like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/message.png"
          alt="Logo"
          width={20}
          height={20}
          className="invert"
        /&amp;gt;

        &amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
          &amp;lt;Image
            src="/notifications.png"
            alt="notification"
            width={20}
            height={20}
            className="invert"
          /&amp;gt;

          &amp;lt;div className="absolute -top-3 -right-3 bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
            &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;Admin&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside that &lt;code&gt;div&lt;/code&gt;, let’s add a &lt;code&gt;checkbox&lt;/code&gt; input with an associated &lt;code&gt;label&lt;/code&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
          &amp;lt;input
            type="checkbox"
            className="checkbox"
            id="checkbox"
          /&amp;gt;

          &amp;lt;label
            htmlFor="checkbox"
            className="label"
          &amp;gt;
          &amp;lt;/label&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/message.png"
          alt="Logo"
          width={20}
          height={20}
          className="invert"
        /&amp;gt;

        &amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
          &amp;lt;Image
            src="/notifications.png"
            alt="notification"
            width={20}
            height={20}
            className="invert"
          /&amp;gt;

          &amp;lt;div className="absolute -top-3 -right-3 bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
            &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;Admin&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;checkbox&lt;/code&gt; input and &lt;code&gt;label&lt;/code&gt; have been given classNames of &lt;code&gt;checkbox&lt;/code&gt; and &lt;code&gt;label&lt;/code&gt; respectively. The code below shows what each className does. Update your &lt;strong&gt;globals.css&lt;/strong&gt; with the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.checkbox {
  opacity: 0;
  position: absolute;
}

.label {
  transform: scale(1.5);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the &lt;code&gt;label&lt;/code&gt;, let’s add two font awesome icons like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
          &amp;lt;input
            type="checkbox"
            className="checkbox"
            id="checkbox"
          /&amp;gt;

          &amp;lt;label
            htmlFor="checkbox"
            className="label"
          &amp;gt;
            &amp;lt;i className="fas fa-sun" /&amp;gt;
            &amp;lt;i className="fas fa-moon" /&amp;gt;
          &amp;lt;/label&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/message.png"
          alt="Logo"
          width={20}
          height={20}
          className="invert"
        /&amp;gt;

        &amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
          &amp;lt;Image
            src="/notifications.png"
            alt="notification"
            width={20}
            height={20}
            className="invert"
          /&amp;gt;

          &amp;lt;div className="absolute -top-3 -right-3 bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
            &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;Admin&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The icons added are the sun and moon. The icons have also been given classNames of &lt;code&gt;fa-sun&lt;/code&gt; and &lt;code&gt;fa-moon&lt;/code&gt;. Let’s update the &lt;code&gt;globals.css&lt;/code&gt; with the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.fa-moon {
  color: pink;
  font-size: 9px;
}

.fa-sun {
  color: yellow;
  font-size: 9px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This just adds colors and sizes to the icons. let’s add some styles to the &lt;code&gt;label&lt;/code&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
          &amp;lt;input
            type="checkbox"
            className="checkbox"
            id="checkbox"
          /&amp;gt;

          &amp;lt;label
            htmlFor="checkbox"
            className="flex justify-between w-8 h-4 bg-black rounded-2xl p-1 relative label"
          &amp;gt;
            &amp;lt;i className="fas fa-sun" /&amp;gt;
            &amp;lt;i className="fas fa-moon" /&amp;gt;
          &amp;lt;/label&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/message.png"
          alt="Logo"
          width={20}
          height={20}
          className="invert"
        /&amp;gt;

        &amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The classNames make the items inside the &lt;code&gt;label&lt;/code&gt; &lt;code&gt;flex&lt;/code&gt;, give it some width and height, make it rounded, and &lt;code&gt;relative&lt;/code&gt;, because there is going to be an &lt;code&gt;absolute&lt;/code&gt; self-closing &lt;code&gt;div&lt;/code&gt; inside. Let’s add the &lt;code&gt;absolute&lt;/code&gt; &lt;code&gt;div&lt;/code&gt; which is basically a ball like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
          &amp;lt;input
            type="checkbox"
            className="checkbox"
            id="checkbox"
          /&amp;gt;

          &amp;lt;label
            htmlFor="checkbox"
            className="flex justify-between w-8 h-4 bg-black rounded-2xl p-1 relative label"
          &amp;gt;
            &amp;lt;i className="fas fa-sun" /&amp;gt;
            &amp;lt;i className="fas fa-moon" /&amp;gt;

            &amp;lt;div className="w-3 h-3 absolute bg-yellow-600 rounded-full ball" /&amp;gt;
          &amp;lt;/label&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/message.png"
          alt="Logo"
          width={20}
          height={20}
          className="invert"
        /&amp;gt;

        &amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You could see that the added &lt;code&gt;div&lt;/code&gt; has a &lt;code&gt;className&lt;/code&gt; of &lt;code&gt;ball&lt;/code&gt;. let’s update the &lt;strong&gt;globals.css&lt;/strong&gt; with the ball class like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.ball {
  top: 2px;
  left: 2px;
  transition: transform 0.2s linear;
}

.checkbox:checked + .label .ball {
  transform: translateX(16px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This positions the ball and gives it some transition effect. The second code targets the element after the label. It also makes the ball move left and right when clicked.&lt;/p&gt;

&lt;p&gt;We can’t see anything yet because we are not importing the fontawesome icons yet. Let’s open the RootLayout. That is &lt;strong&gt;app/layout.tsx&lt;/strong&gt; and let's add the code below right below &lt;code&gt;{children}&lt;/code&gt; but above the body closing tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Script
  src="https://kit.fontawesome.com/a6d38f6541.js"
  crossOrigin="anonymous"
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will have to &lt;code&gt;import Script from “next/script”&lt;/code&gt;. You should now see the ball. When you click, the ball switches from the sun to the moon, but nothing is happening. That is because we are not using the &lt;code&gt;next-themes&lt;/code&gt; we installed yet. Let’s call the hook below at the top of the component like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";
import React from "react";

const Navbar = () =&amp;gt; {
  const { theme, setTheme } = useTheme();

  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
          &amp;lt;input
            type="checkbox"
            className="checkbox"
            id="checkbox"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to &lt;code&gt;import { useTheme } from “next-themes”&lt;/code&gt;. Next, let’s add an &lt;code&gt;onChange&lt;/code&gt; property to the &lt;code&gt;checkbox&lt;/code&gt; input we created like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";
import React from "react";

const Navbar = () =&amp;gt; {
  const { theme, setTheme } = useTheme();

  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-grey-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
          &amp;lt;input
            type="checkbox"
            className="checkbox"
            id="checkbox"
            onChange={() =&amp;gt;
              setTheme(theme === "light" ? "dark" : "light")
            }
          /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The onChnage property uses a ternary operator to set the theme based on the previous theme.&lt;/p&gt;

&lt;p&gt;Nothing will happen now because we have not included the ThemeProvider in our RootLayout. Update the RootLayout (app/layout.tsx) like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function RootLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;html lang="en"&amp;gt;
      &amp;lt;body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      &amp;gt;
        &amp;lt;ThemeProvider
          attribute="class"
          defaultTheme="system"
          enableSystem
          disableTransitionOnChange
        &amp;gt;
          {children}

          &amp;lt;Script
            src="https://kit.fontawesome.com/a6d38f6541.js"
            crossOrigin="anonymous"
          /&amp;gt;
        &amp;lt;/ThemeProvider&amp;gt;
      &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we are wrapping the &lt;code&gt;{children}&lt;/code&gt; and the &lt;code&gt;Script&lt;/code&gt; tag with &lt;code&gt;ThemeProvider&lt;/code&gt;. Be sure to &lt;code&gt;import { ThemeProvider } from “next-themes”&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You will obviously face hydration error at this point and it is expected. That simply means what is rendered on the server differs from what is rendered on the client. To fix the hydration issue, we have to suppress it in the RootLayout. Update the RootLayout (&lt;strong&gt;app/layout.tsx&lt;/strong&gt;) like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function RootLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;html suppressHydrationWarning lang="en"&amp;gt;
      &amp;lt;body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      &amp;gt;
        &amp;lt;ThemeProvider
          attribute="class"
          defaultTheme="system"
          enableSystem
          disableTransitionOnChange
        &amp;gt;
          {children}

          &amp;lt;Script
            src="https://kit.fontawesome.com/a6d38f6541.js"
            crossOrigin="anonymous"
          /&amp;gt;
        &amp;lt;/ThemeProvider&amp;gt;
      &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we update the &lt;code&gt;html&lt;/code&gt; tag to include the &lt;code&gt;suppressHydrationWarning&lt;/code&gt; attribute.&lt;/p&gt;

&lt;p&gt;Now that we have successfully doe all the configurations for the theme, let’s add some styles to the pages based on the &lt;code&gt;theme&lt;/code&gt;. First, let’s open the MainLayout. That is &lt;strong&gt;app/(root)/layout.tsx&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function MainLayout({
  children,
}: Readonly&amp;lt;{
  children: React.ReactNode;
}&amp;gt;) {
  return (
    &amp;lt;div className="h-screen flex bg-gray-950 text-white"&amp;gt;
      &amp;lt;div className="w-[14%] md:w-[8%] lg:w-[16%] xl:w-[14%] bg-gray-800 p-4 border-r border-gray-400"&amp;gt;
        &amp;lt;Link
          href="/dashboard"
          className="flex items-center justify-center lg:justify-start gap-2"
        &amp;gt;
          &amp;lt;Image
            src="/logo.png"
            alt="Logo"
            width={32}
            height={32}
            className="invert"
          /&amp;gt;
          &amp;lt;span className="hidden lg:block font-bold"&amp;gt;
            Point of Care Pharmacy
          &amp;lt;/span&amp;gt;
        &amp;lt;/Link&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You could see that we are adding some default background colors. In addition to those background colors, let’s add some background colors with the dark: condition like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return (
    &amp;lt;div className="h-screen flex bg-gray-100 dark:bg-gray-950 text-white"&amp;gt;
      &amp;lt;div className="w-[14%] md:w-[8%] lg:w-[16%] xl:w-[14%] bg-gray-200 dark:bg-gray-800 p-4 border-r border-gray-900 dark:border-gray-400"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the top &lt;code&gt;div&lt;/code&gt;, we are giving a default background color of &lt;code&gt;bg-gray-100&lt;/code&gt;, but when it is in the dark mode, the background color should be &lt;code&gt;dark:bg-gray-950&lt;/code&gt;. In the second &lt;code&gt;div&lt;/code&gt;, we are giving a background color of &lt;code&gt;bg-gray-200&lt;/code&gt;, but when in dark mode, it should be &lt;code&gt;dark:bg-gray-800&lt;/code&gt;. We are also giving border color of &lt;code&gt;border-gray-900&lt;/code&gt;, but when in the dark mode, the border color should be &lt;code&gt;dark:border-gray-400&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Lets update the color for the &lt;code&gt;span&lt;/code&gt; as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;span className="hidden lg:block font-bold text-black dark:text-white"&amp;gt;
  Point of Care Pharmacy
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we are saying the the text color should be black, but it should be white when in dark mode.&lt;/p&gt;

&lt;p&gt;Let’s open the &lt;strong&gt;SideMenu.tsx&lt;/strong&gt; and update the color like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { menuItems } from "@/constants/menu";
import { cn } from "@/lib/utils";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import React from "react";
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from "@/components/ui/tooltip";

const SideMenu = () =&amp;gt; {
  const pathname = usePathname();

  return (
    &amp;lt;div className="mt-4 text-sm overflow-y-scroll h-[90vh] no-scrollbar"&amp;gt;
      {menuItems.map((item, i) =&amp;gt; (
        &amp;lt;div key={i} className="flex flex-col gap-2"&amp;gt;
          &amp;lt;span className="hidden lg:block text-black dark:text-gray-400 font-light my-4"&amp;gt;
            {item.title}
          &amp;lt;/span&amp;gt;

          {item.items.map((subItem, j) =&amp;gt; {
            const isActive =
              (pathname.includes(subItem.href.toLowerCase()) &amp;amp;&amp;amp;
                subItem.href.length &amp;gt; 1) ||
              pathname === subItem.href.toLowerCase();

            return (
              &amp;lt;Link
                href={subItem.href}
                key={j}
                className={cn(
                  isActive ? "bg-purple-500" : "",
                  "flex items-center justify-center lg:justify-start gap-4 text-gray-500 py-2 md:px-2 rounded-md hover:bg-purple-500 w-full"
                )}
              &amp;gt;
                &amp;lt;TooltipProvider&amp;gt;
                  &amp;lt;Tooltip&amp;gt;
                    &amp;lt;TooltipTrigger&amp;gt;
                      &amp;lt;Image
                        src={subItem.icon}
                        alt={subItem.label}
                        width={20}
                        height={20}
                        className="invert(1) dark:invert cursor-pointer my-4"
                      /&amp;gt;
                    &amp;lt;/TooltipTrigger&amp;gt;
                    &amp;lt;TooltipContent&amp;gt;
                      &amp;lt;p&amp;gt;{subItem.label}&amp;lt;/p&amp;gt;
                    &amp;lt;/TooltipContent&amp;gt;
                  &amp;lt;/Tooltip&amp;gt;
                &amp;lt;/TooltipProvider&amp;gt;

                &amp;lt;span className="hidden lg:block text-black dark:text-gray-400 font-light my-4"&amp;gt;
                  {subItem.label}
                &amp;lt;/span&amp;gt;
              &amp;lt;/Link&amp;gt;
            );
          })}
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

export default SideMenu;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I updated the colors for the two spans for both light and dark mode. I also updated the &lt;code&gt;className&lt;/code&gt; for the image to &lt;code&gt;invert&lt;/code&gt; the colors based on light and dark mode. In the light mode, &lt;code&gt;invert(1)&lt;/code&gt;, in dark mode, &lt;code&gt;dark:invert&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let’s update the colors in the Navbar like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";
import React from "react";

const Navbar = () =&amp;gt; {
  const { theme, setTheme } = useTheme();

  return (
    &amp;lt;div className="flex items-center justify-between p-4 bg-gray-200 dark:bg-gray-800 fixed w-[86%] md:w-[92%] lg:w-[84%] xl:w-[86%] border-b border-gray-400 z-10"&amp;gt;
      &amp;lt;div className="hidden md:flex items-center gap-2 text-xs rounded-full ring-[1.5px] ring-gray-700 dark:ring-gray-500 ring-light-500 px-2"&amp;gt;
        &amp;lt;Image src="/search.png" alt="Logo" width={14} height={14} /&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="Search..."
          className="w-[200px] p-2 bg-transparent outline-none text-black dark:text-white"
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div className="flex items-center justify-end gap-6 w-full"&amp;gt;
        &amp;lt;div className="flex items-center"&amp;gt;
          &amp;lt;input
            type="checkbox"
            className="checkbox"
            id="checkbox"
            onChange={() =&amp;gt;
              setTheme(theme === "light" ? "dark" : "light")
            }
          /&amp;gt;

          &amp;lt;label
            htmlFor="checkbox"
            className="flex justify-between w-8 h-4 bg-black rounded-2xl p-1 relative label"
          &amp;gt;
            &amp;lt;i className="fas fa-sun" /&amp;gt;
            &amp;lt;i className="fas fa-moon" /&amp;gt;

            &amp;lt;div className="w-3 h-3 absolute bg-yellow-600 rounded-full ball" /&amp;gt;
          &amp;lt;/label&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/message.png"
          alt="Logo"
          width={20}
          height={20}
          className="invert(1) dark:invert"
        /&amp;gt;

        &amp;lt;div className="relative flex items-center justify-center cursor-pointer"&amp;gt;
          &amp;lt;Image
            src="/notifications.png"
            alt="notification"
            width={20}
            height={20}
            className="invert(1) dark:invert"
          /&amp;gt;

          &amp;lt;div className="absolute -top-3 -right-3 bg-purple-500 text-white text-xs w-5 h-5 rounded-full flex items-center justify-center"&amp;gt;
            &amp;lt;span className=""&amp;gt;0&amp;lt;/span&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div className="flex flex-col"&amp;gt;
          &amp;lt;span className="text-xs leading-3 font-medium text-black dark:text-white"&amp;gt;John Doe&amp;lt;/span&amp;gt;
          &amp;lt;span className="text-[10px] text-gray-500 text-right"&amp;gt;Admin&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;Image
          src="/avatar.png"
          alt="Logo"
          width={36}
          height={36}
          className="rounded-full"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Navbar;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that you understand how to apply colors based on selected themes, carefully go though and update all colors with dark options. Images also have classNames of &lt;code&gt;invert(1) dark:invert&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, in the MainLayout, update the &lt;code&gt;div&lt;/code&gt; containing &lt;code&gt;{children}&lt;/code&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;/div&amp;gt;
      &amp;lt;div className="w-[86%]"&amp;gt;
        &amp;lt;Navbar /&amp;gt;

        &amp;lt;div className="mt-16 p-4 text-black dark:text-white"&amp;gt;{children}&amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All texts will be black by default, but white when in dark mode.&lt;/p&gt;

&lt;p&gt;We are now on the last part of this guide. As I stated earlier, this guide is to take you through building the UI of the admin dashboard, so we will not be building the other pages. I only created the pages to help you understand Next.js file based routing.&lt;/p&gt;

&lt;p&gt;From the &lt;a href="https://www.youtube.com/watch?v=YPpzXWA1WR0&amp;amp;feature=youtu.be" rel="noopener noreferrer"&gt;sneak peak&lt;/a&gt;, the admin dashboard has three sections; product cards, sales graph, and income and expenditure graph. Therefore, we will have three divs flexed vertically.&lt;/p&gt;

&lt;p&gt;Let’s open &lt;strong&gt;app/(root)/dashboard/page.tsx&lt;/strong&gt; and create the three divs like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Dashboard = () =&amp;gt; {
  return (
    &amp;lt;div className='h-screen flex gap-4 flex-col'&amp;gt;
      &amp;lt;div&amp;gt;Product Cards&amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;Sales Graph&amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;income and expenditure graph&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parent container has a full height and the items within it will be vertical with a gap between them. Let’s start with the product cards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Product Cards
&lt;/h2&gt;

&lt;p&gt;The product cards will have six cards within it horizontally, but they will wrap when the screen size reduces. So, the product cards will have a parent container like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Dashboard = () =&amp;gt; {
  return (
    &amp;lt;div className='h-screen flex gap-4 flex-col'&amp;gt;
      &amp;lt;div className="flex gap-4 justify-between flex-wrap"&amp;gt;
        Product Cards
      &amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;Sales Graph&amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;income and expenditure graph&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As I stated earlier, there will be six cards but we will create only one card component and re-use it for all the six. So, inside your &lt;strong&gt;components&lt;/strong&gt; folder, create a new file and name it &lt;strong&gt;ProductCard.tsx&lt;/strong&gt;. Run &lt;em&gt;rafce&lt;/em&gt; inside to spin up the functional component. Next, import and render the product card six times inside the Dashboard component like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ProductCard from "@/components/ProductCard"

const Dashboard = () =&amp;gt; {
  return (
    &amp;lt;div className='h-screen flex gap-4 flex-col'&amp;gt;
      &amp;lt;div className="flex gap-4 justify-between flex-wrap"&amp;gt;
        &amp;lt;ProductCard /&amp;gt;
        &amp;lt;ProductCard /&amp;gt;
        &amp;lt;ProductCard /&amp;gt;
        &amp;lt;ProductCard /&amp;gt;
        &amp;lt;ProductCard /&amp;gt;
        &amp;lt;ProductCard /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;Sales Graph&amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;income and expenditure graph&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s open the product card and start implementing it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const ProductCard = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;ProductCard&amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cards will have rounded edges with some padding within them. So, let’s update the parent div like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const ProductCard = () =&amp;gt; {
  return (
    &amp;lt;div className='rounded-2xl odd:bg-purple-500 even:bg-yellow-400 p-4 flex-1 min-w-[130px]'&amp;gt;
        ProductCard
    &amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, I made the edges rounded. I also gave them background colors based on their count index. Those with even number counts have a separate background against those with odd number counts. I also gave it &lt;code&gt;flex-1&lt;/code&gt; which means all the cards will occupy equal spaces with a minimum width of 130px.&lt;/p&gt;

&lt;p&gt;Each card has three sections; a text at the top left and three dots on the right, the count of products, and then the type of products at the bottom. Let’s handle the top part. The top items are a span and an image flexed with space between like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image"

const ProductCard = () =&amp;gt; {
  return (
    &amp;lt;div className='rounded-2xl odd:bg-purple-500 even:bg-yellow-400 p-4 flex-1 min-w-[130px]'&amp;gt;
         &amp;lt;div className='flex justify-between items-center'&amp;gt;
            &amp;lt;span className='text-xs text-green-600 bg-white px-2 py-1 rounded-full'&amp;gt;05/2025&amp;lt;/span&amp;gt;
            &amp;lt;Image src='/more.png' alt='More' width={20} height={20} className='cursor-pointer' /&amp;gt;
         &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added a &lt;code&gt;span&lt;/code&gt; with green extra small texts, a white background with padding on x and y axes an also made it rounded. I also added an image which displays the three dots on the right end.&lt;/p&gt;

&lt;p&gt;Below that section is the count of products. Let’s add that using an &lt;code&gt;h1&lt;/code&gt; tag as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image"

const ProductCard = () =&amp;gt; {
  return (
    &amp;lt;div className='rounded-2xl odd:bg-purple-500 even:bg-yellow-400 p-4 flex-1 min-w-[130px]'&amp;gt;
         &amp;lt;div className='flex justify-between items-center'&amp;gt;
            &amp;lt;span className='text-xs text-green-600 bg-white px-2 py-1 rounded-full'&amp;gt;05/2025&amp;lt;/span&amp;gt;
            &amp;lt;Image src='/more.png' alt='More' width={20} height={20} className='cursor-pointer' /&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;h1 className='text-2xl font-semibold my-4 text-black'&amp;gt;24,500&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below the count is the type of product. Let’s add that using an &lt;code&gt;h2&lt;/code&gt; tag as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image"

const ProductCard = () =&amp;gt; {
  return (
    &amp;lt;div className='rounded-2xl odd:bg-purple-500 even:bg-yellow-400 p-4 flex-1 min-w-[130px]'&amp;gt;
         &amp;lt;div className='flex justify-between items-center'&amp;gt;
            &amp;lt;span className='text-xs text-green-600 bg-white px-2 py-1 rounded-full'&amp;gt;05/2025&amp;lt;/span&amp;gt;
            &amp;lt;Image src='/more.png' alt='More' width={20} height={20} className='cursor-pointer' /&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;h1 className='text-2xl font-semibold my-4 text-black'&amp;gt;24,500&amp;lt;/h1&amp;gt;

        &amp;lt;h2 className='capitalize text-sm font-medium text-gray-100'&amp;gt;tablets&amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One special thing to note here is the &lt;code&gt;capitalize&lt;/code&gt; &lt;code&gt;className&lt;/code&gt; which capitalizes the first letter of the text.&lt;/p&gt;

&lt;p&gt;Now, you will notice that all the cards are rendering the same content. Ideally, each card is supposed to display a different content. To get separate content for each card, we pass the contents as props to where we are calling the cards. We then receive those props through the card component and render them.&lt;/p&gt;

&lt;p&gt;Let’s open the dashboard and pass different props to the cards like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ProductCard from "@/components/ProductCard"

const Dashboard = () =&amp;gt; {
  return (
    &amp;lt;div className='h-screen flex gap-4 flex-col'&amp;gt;
      &amp;lt;div className="flex gap-4 justify-between flex-wrap"&amp;gt;
        &amp;lt;ProductCard type='tablets' count={15210} /&amp;gt;
        &amp;lt;ProductCard type='syrups' count={9510} /&amp;gt;
        &amp;lt;ProductCard type='capsules' count={17542} /&amp;gt;
        &amp;lt;ProductCard type='vials' count={13524} /&amp;gt;
        &amp;lt;ProductCard type='others' count={7210} /&amp;gt;
        &amp;lt;ProductCard type='expired' count={125} /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;Sales Graph&amp;lt;/div&amp;gt;

      &amp;lt;div&amp;gt;income and expenditure graph&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we are passing type and count which contains different values. We can now go into the ProductCard component and accept those props like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image"

const ProductCard = ({ type, count }: { type: string; count: number }) =&amp;gt; {
  return (
    &amp;lt;div className='rounded-2xl odd:bg-purple-500 even:bg-yellow-400 p-4 flex-1 min-w-[130px]'&amp;gt;
         &amp;lt;div className='flex justify-between items-center'&amp;gt;
            &amp;lt;span className='text-xs text-green-600 bg-white px-2 py-1 rounded-full'&amp;gt;05/2025&amp;lt;/span&amp;gt;
            &amp;lt;Image src='/more.png' alt='More' width={20} height={20} className='cursor-pointer' /&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;h1 className='text-2xl font-semibold my-4 text-black'&amp;gt;24,500&amp;lt;/h1&amp;gt;

        &amp;lt;h2 className='capitalize text-sm font-medium text-gray-100'&amp;gt;tablets&amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are accepting &lt;code&gt;{type, count}&lt;/code&gt; where &lt;code&gt;type&lt;/code&gt; is a &lt;code&gt;string&lt;/code&gt; and &lt;code&gt;count&lt;/code&gt; is a &lt;code&gt;number&lt;/code&gt;. Remember we are using TypeScript so we have to specify the types for the props we are receiving.&lt;/p&gt;

&lt;p&gt;We can now render those props into the component like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image"

const ProductCard = ({ type, count }: { type: string; count: number }) =&amp;gt; {
  return (
    &amp;lt;div className='rounded-2xl odd:bg-purple-500 even:bg-yellow-400 p-4 flex-1 min-w-[130px]'&amp;gt;
         &amp;lt;div className='flex justify-between items-center'&amp;gt;
            &amp;lt;span className='text-xs text-green-600 bg-white px-2 py-1 rounded-full'&amp;gt;05/2025&amp;lt;/span&amp;gt;
            &amp;lt;Image src='/more.png' alt='More' width={20} height={20} className='cursor-pointer' /&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;h1 className='text-2xl font-semibold my-4 text-black'&amp;gt;{count}&amp;lt;/h1&amp;gt;

        &amp;lt;h2 className='capitalize text-sm font-medium text-gray-100'&amp;gt;{type}&amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each card now renders different information. Notice however, that the count figures don’t look appealing without comma separators since they are numbers. We could add the comma separators using the &lt;code&gt;toLocaleString()&lt;/code&gt; function like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image"

const ProductCard = ({ type, count }: { type: string; count: number }) =&amp;gt; {
  return (
    &amp;lt;div className='rounded-2xl odd:bg-purple-500 even:bg-yellow-400 p-4 flex-1 min-w-[130px]'&amp;gt;
         &amp;lt;div className='flex justify-between items-center'&amp;gt;
            &amp;lt;span className='text-xs text-green-600 bg-white px-2 py-1 rounded-full'&amp;gt;05/2025&amp;lt;/span&amp;gt;
            &amp;lt;Image src='/more.png' alt='More' width={20} height={20} className='cursor-pointer' /&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;h1 className='text-2xl font-semibold my-4 text-black'&amp;gt;{count.toLocaleString()}&amp;lt;/h1&amp;gt;

        &amp;lt;h2 className='capitalize text-sm font-medium text-gray-100'&amp;gt;{type}&amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default ProductCard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, I want a card to move upwards when I hover over it and only come down when the cursor leaves it.&lt;/p&gt;

&lt;p&gt;Let’s update the parent container with this classNames: &lt;code&gt;hover:-translate-y-2 transition-transform duration-300&lt;/code&gt;. This simply moves the card upwards with a duration of 300 milliseconds.&lt;/p&gt;

&lt;p&gt;We are now done with the product cards. Let’s handle the sales graph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sales Graph
&lt;/h2&gt;

&lt;p&gt;To implement the sales graph, we will use &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt;. To get started, visit the &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt; website, scroll down and click &lt;strong&gt;GET STARTED&lt;/strong&gt;. On the left pane, click &lt;strong&gt;Installation&lt;/strong&gt; to get the installation guide. We first have to install &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt;. Open your terminal and run the command below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install recharts&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After the installation, go back to the &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt; websites and click &lt;strong&gt;Examples&lt;/strong&gt;. You will find a whole lot of chart types on the left pane. That is where we will be selecting the type of graphs we would be using.&lt;/p&gt;

&lt;p&gt;For the Sales Graph, we would be using &lt;a href="https://recharts.org/en-US/examples/SimpleBarChart" rel="noopener noreferrer"&gt;SimpleBarChart&lt;/a&gt;. Let’s create a separate component for the graph and import it into the Dashboard component.&lt;/p&gt;

&lt;p&gt;Create a new file in your &lt;strong&gt;components&lt;/strong&gt; folder and name it &lt;strong&gt;SalesGraph.tsx&lt;/strong&gt;. Run &lt;em&gt;rafce&lt;/em&gt; and spin up the functional component. Import it into the Dashboard like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ProductCard from "@/components/ProductCard"
import SalesGraph from "@/components/SalesGraph"

const Dashboard = () =&amp;gt; {
  return (
    &amp;lt;div className='h-screen flex gap-4 flex-col'&amp;gt;
      &amp;lt;div className="flex gap-4 justify-between flex-wrap"&amp;gt;
        &amp;lt;ProductCard type='tablets' count={15210} /&amp;gt;
        &amp;lt;ProductCard type='syrups' count={9510} /&amp;gt;
        &amp;lt;ProductCard type='capsules' count={17542} /&amp;gt;
        &amp;lt;ProductCard type='vials' count={13524} /&amp;gt;
        &amp;lt;ProductCard type='others' count={7210} /&amp;gt;
        &amp;lt;ProductCard type='expired' count={125} /&amp;gt;
      &amp;lt;/div&amp;gt;

        &amp;lt;SalesGraph /&amp;gt;

      &amp;lt;div&amp;gt;income and expenditure graph&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s open the &lt;strong&gt;SalesGraph.tsx&lt;/strong&gt; and start implementing it.&lt;/p&gt;

&lt;p&gt;At the top of the graph is a title and ellipsis(3 dots) at both ends, so they would be &lt;code&gt;flex&lt;/code&gt; items with a space between them like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from "next/image";

const SalesGraph = () =&amp;gt; {
  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src="/more.png"
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The title is the &lt;code&gt;h1&lt;/code&gt; and the ellipsis is the image. I placed them inside a &lt;code&gt;div&lt;/code&gt; because I wanted to set them to &lt;code&gt;flex&lt;/code&gt;. I have given the parent container (the first div) a full width. On light mode, the background will be white, but it will be &lt;code&gt;bg-gray-800&lt;/code&gt; on dark mode. I gave it a shadow, made the edges rounded, gave some padding, and made the contents flex column with a gap 0f 4px between them.&lt;/p&gt;

&lt;p&gt;Now, if you switch between the light and dark mode, you will notice that the ellipsis at the right end corner is clearly visible on dark mode, but its almost hidden in light mode. To fix that, we could dynamically change the image source (src) based on the selected them. We could achieve that using the &lt;code&gt;useTheme()&lt;/code&gt; hook from &lt;code&gt;next-themes&lt;/code&gt;. We call it like so:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const { theme } = useTheme()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then we can use the &lt;code&gt;theme&lt;/code&gt; in the image &lt;code&gt;src&lt;/code&gt; to dynamically change the source like below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src={theme === "dark" ? "/more.png" : "/moreDark.png"}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We are using a ternary operator to check if the theme is dark, we set the image src to more.png, else the src would be moreDark.png. With this understanding, let’s update the code with those two lines of code like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";

const SalesGraph = () =&amp;gt; {
    const {theme} = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that since we are using a hook, we have to turn the component into a client component, so make sure to add the &lt;code&gt;“use client”&lt;/code&gt; directive at the top.&lt;/p&gt;

&lt;p&gt;Now we can add the graph. Let’s go back to the &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt; website and make sure the &lt;a href="https://recharts.org/en-US/examples/SimpleBarChart" rel="noopener noreferrer"&gt;SimpleBarChart&lt;/a&gt; is selected under examples. The code for the example graph on the right side is like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { PureComponent } from 'react';
import { BarChart, Bar, Rectangle, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';

const data = [
  {
    name: 'Page A',
    uv: 4000,
    pv: 2400,
    amt: 2400,
  },
  {
    name: 'Page B',
    uv: 3000,
    pv: 1398,
    amt: 2210,
  },
  {
    name: 'Page C',
    uv: 2000,
    pv: 9800,
    amt: 2290,
  },
  {
    name: 'Page D',
    uv: 2780,
    pv: 3908,
    amt: 2000,
  },
  {
    name: 'Page E',
    uv: 1890,
    pv: 4800,
    amt: 2181,
  },
  {
    name: 'Page F',
    uv: 2390,
    pv: 3800,
    amt: 2500,
  },
  {
    name: 'Page G',
    uv: 3490,
    pv: 4300,
    amt: 2100,
  },
];

export default class Example extends PureComponent {
  static demoUrl = 'https://codesandbox.io/p/sandbox/simple-bar-chart-72d7y5';

  render() {
    return (
      &amp;lt;ResponsiveContainer width="100%" height="100%"&amp;gt;
        &amp;lt;BarChart
          width={500}
          height={300}
          data={data}
          margin={{
            top: 5,
            right: 30,
            left: 20,
            bottom: 5,
          }}
        &amp;gt;
          &amp;lt;CartesianGrid strokeDasharray="3 3" /&amp;gt;
          &amp;lt;XAxis dataKey="name" /&amp;gt;
          &amp;lt;YAxis /&amp;gt;
          &amp;lt;Tooltip /&amp;gt;
          &amp;lt;Legend /&amp;gt;
          &amp;lt;Bar dataKey="pv" fill="#8884d8" activeBar={&amp;lt;Rectangle fill="pink" stroke="blue" /&amp;gt;} /&amp;gt;
          &amp;lt;Bar dataKey="uv" fill="#82ca9d" activeBar={&amp;lt;Rectangle fill="gold" stroke="purple" /&amp;gt;} /&amp;gt;
        &amp;lt;/BarChart&amp;gt;
      &amp;lt;/ResponsiveContainer&amp;gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will not need everything in the code example. First we will need the data array. So, lets copy the data array and update our code like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";

const data = [
  {
    name: 'Page A',
    uv: 4000,
    pv: 2400,
    amt: 2400,
  },
  {
    name: 'Page B',
    uv: 3000,
    pv: 1398,
    amt: 2210,
  },
  {
    name: 'Page C',
    uv: 2000,
    pv: 9800,
    amt: 2290,
  },
  {
    name: 'Page D',
    uv: 2780,
    pv: 3908,
    amt: 2000,
  },
  {
    name: 'Page E',
    uv: 1890,
    pv: 4800,
    amt: 2181,
  },
  {
    name: 'Page F',
    uv: 2390,
    pv: 3800,
    amt: 2500,
  },
  {
    name: 'Page G',
    uv: 3490,
    pv: 4300,
    amt: 2100,
  },
];

const SalesGraph = () =&amp;gt; {
  const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is a weekly sales graph we are displaying. So, instead of the name in the array being “Page A”, “Page B”, “Page C” etc, let’s update and limit it to the sales and days of the week like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";

const data = [
    {
      name: 'Sun',
      sale: 4000,
    },
    {
      name: 'Mon',
      sale: 3000,
    },
    {
      name: 'Tue',
      sale: 2000,
    },
    {
      name: 'Wed',
      sale: 2780,
    },
    {
      name: 'Thu',
      sale: 1890,
    },
    {
      name: 'Fri',
      sale: 2390,
    },
    {
      name: 'Sat',
      sale: 3490,
    },
  ];

const SalesGraph = () =&amp;gt; {
  const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next thing we will need from the &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt; code example is the &lt;code&gt;ResponsiveContainer&lt;/code&gt; block. So, let's copy that and update our code like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { Tooltip } from "@radix-ui/react-tooltip";
import { useTheme } from "next-themes";
import Image from "next/image";
import { Bar, BarChart, CartesianGrid, Legend, Rectangle, ResponsiveContainer, XAxis, YAxis } from "recharts";

const data = [
    {
      name: 'Sun',
      sale: 4000,
    },
    {
      name: 'Mon',
      sale: 3000,
    },
    {
      name: 'Tue',
      sale: 2000,
    },
    {
      name: 'Wed',
      sale: 2780,
    },
    {
      name: 'Thu',
      sale: 1890,
    },
    {
      name: 'Fri',
      sale: 2390,
    },
    {
      name: 'Sat',
      sale: 3490,
    },
  ];

const SalesGraph = () =&amp;gt; {
  const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;ResponsiveContainer width="100%" height="100%"&amp;gt;
        &amp;lt;BarChart
          width={500}
          height={300}
          data={data}
          margin={{
            top: 5,
            right: 30,
            left: 20,
            bottom: 5,
          }}
        &amp;gt;
          &amp;lt;CartesianGrid strokeDasharray="3 3" /&amp;gt;
          &amp;lt;XAxis dataKey="name" /&amp;gt;
          &amp;lt;YAxis /&amp;gt;
          &amp;lt;Tooltip /&amp;gt;
          &amp;lt;Legend /&amp;gt;
          &amp;lt;Bar dataKey="pv" fill="#8884d8" activeBar={&amp;lt;Rectangle fill="pink" stroke="blue" /&amp;gt;} /&amp;gt;
          &amp;lt;Bar dataKey="uv" fill="#82ca9d" activeBar={&amp;lt;Rectangle fill="gold" stroke="purple" /&amp;gt;} /&amp;gt;
        &amp;lt;/BarChart&amp;gt;
      &amp;lt;/ResponsiveContainer&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to add all the imports at the top. You will be faced with a hydration error and it would be referring to the img. I don't know why that is so, but let's add &lt;code&gt;suppressHydrationWarning&lt;/code&gt; to the &lt;code&gt;Image&lt;/code&gt; tag like below to get rid of the error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { Tooltip } from "@radix-ui/react-tooltip";
import { useTheme } from "next-themes";
import Image from "next/image";
import { Bar, BarChart, CartesianGrid, Legend, Rectangle, ResponsiveContainer, XAxis, YAxis } from "recharts";

const data = [
    {
      name: 'Sun',
      sale: 4000,
    },
    {
      name: 'Mon',
      sale: 3000,
    },
    {
      name: 'Tue',
      sale: 2000,
    },
    {
      name: 'Wed',
      sale: 2780,
    },
    {
      name: 'Thu',
      sale: 1890,
    },
    {
      name: 'Fri',
      sale: 2390,
    },
    {
      name: 'Sat',
      sale: 3490,
    },
  ];

const SalesGraph = () =&amp;gt; {
  const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;ResponsiveContainer width="100%" height="100%"&amp;gt;
        &amp;lt;BarChart
          width={500}
          height={300}
          data={data}
          margin={{
            top: 5,
            right: 30,
            left: 20,
            bottom: 5,
          }}
        &amp;gt;
          &amp;lt;CartesianGrid strokeDasharray="3 3" /&amp;gt;
          &amp;lt;XAxis dataKey="name" /&amp;gt;
          &amp;lt;YAxis /&amp;gt;
          &amp;lt;Tooltip /&amp;gt;
          &amp;lt;Legend /&amp;gt;
          &amp;lt;Bar dataKey="pv" fill="#8884d8" activeBar={&amp;lt;Rectangle fill="pink" stroke="blue" /&amp;gt;} /&amp;gt;
          &amp;lt;Bar dataKey="uv" fill="#82ca9d" activeBar={&amp;lt;Rectangle fill="gold" stroke="purple" /&amp;gt;} /&amp;gt;
        &amp;lt;/BarChart&amp;gt;
      &amp;lt;/ResponsiveContainer&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We currently cannot see anything because we have not given the parent container any height. So, let's give the main &lt;code&gt;div&lt;/code&gt; a height of &lt;code&gt;h-[350px]&lt;/code&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { Tooltip } from "@radix-ui/react-tooltip";
import { useTheme } from "next-themes";
import Image from "next/image";
import { Bar, BarChart, CartesianGrid, Legend, Rectangle, ResponsiveContainer, XAxis, YAxis } from "recharts";

const data = [
    {
      name: 'Sun',
      sale: 4000,
    },
    {
      name: 'Mon',
      sale: 3000,
    },
    {
      name: 'Tue',
      sale: 2000,
    },
    {
      name: 'Wed',
      sale: 2780,
    },
    {
      name: 'Thu',
      sale: 1890,
    },
    {
      name: 'Fri',
      sale: 2390,
    },
    {
      name: 'Sat',
      sale: 3490,
    },
  ];

const SalesGraph = () =&amp;gt; {
  const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4 h-[350px]"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;ResponsiveContainer width="100%" height="100%"&amp;gt;
        &amp;lt;BarChart
          width={500}
          height={300}
          data={data}
          margin={{
            top: 5,
            right: 30,
            left: 20,
            bottom: 5,
          }}
        &amp;gt;
          &amp;lt;CartesianGrid strokeDasharray="3 3" /&amp;gt;
          &amp;lt;XAxis dataKey="name" /&amp;gt;
          &amp;lt;YAxis /&amp;gt;
          {/* &amp;lt;Tooltip /&amp;gt; */}
          &amp;lt;Legend /&amp;gt;
          &amp;lt;Bar dataKey="pv" fill="#8884d8" activeBar={&amp;lt;Rectangle fill="pink" stroke="blue" /&amp;gt;} /&amp;gt;
          &amp;lt;Bar dataKey="uv" fill="#82ca9d" activeBar={&amp;lt;Rectangle fill="gold" stroke="purple" /&amp;gt;} /&amp;gt;
        &amp;lt;/BarChart&amp;gt;
      &amp;lt;/ResponsiveContainer&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The example code we copied contains two bars for each data record, but we need only a single &lt;code&gt;bar&lt;/code&gt; for each record, so let's remove one &lt;code&gt;bar&lt;/code&gt; tag:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Bar dataKey="uv" fill="#82ca9d" activeBar={&amp;lt;Rectangle fill="gold" stroke="purple" /&amp;gt;} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We don’t need the margin inside the &lt;code&gt;BarChart&lt;/code&gt; tag, so, let’s remove that and replaced it with &lt;code&gt;barSize={20}&lt;/code&gt;. That will increase the thickness of the bar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;BarChart
   width={500}
   height={300}
   data={data}
   barSize={20}
&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, note that in the data array, we removed the &lt;code&gt;uv&lt;/code&gt; and &lt;code&gt;pv&lt;/code&gt; that were in the examples and included a &lt;code&gt;sale&lt;/code&gt; attribute. Let’s change the d&lt;code&gt;ataKey&lt;/code&gt; in the remaining &lt;code&gt;Bar&lt;/code&gt; tag to &lt;code&gt;“sale”&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Bar dataKey="sale" fill="#8884d8" activeBar={&amp;lt;Rectangle fill="pink" stroke="blue" /&amp;gt;} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;CartesianGrid&lt;/code&gt;, let’s remove the vertical lines (&lt;code&gt;vertical={false}&lt;/code&gt;) and add a color for the horizontal grid (&lt;code&gt;stroke=”#ddd”&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#ddd" /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;XAxis&lt;/code&gt;, let’s remove the axis line (&lt;code&gt;axisLine={false}&lt;/code&gt;), give a color to the tick (&lt;code&gt;tick={{ fill: “gray”}}&lt;/code&gt;) and disable the tickLine (&lt;code&gt;tickLine={false}&lt;/code&gt;). The &lt;code&gt;tick&lt;/code&gt; is the small vertical line above each week day name that connects to the x-axis.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;XAxis dataKey="name" axisLine={false} tick={{ fill: "gray"}} tickLine={false} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;YAxis&lt;/code&gt;, let’s remove the axis line (&lt;code&gt;axisLine={false}&lt;/code&gt;), give a color to the tick (&lt;code&gt;tick={{ fill: “gray”}}&lt;/code&gt;) and disable the tickLine (&lt;code&gt;tickLine={false}&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;YAxis axisLine={false} tick={{ fill: "gray"}} tickLine={false} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Tooltip&lt;/code&gt;, let’s apply some styles; &lt;code&gt;borderRadius&lt;/code&gt;, &lt;code&gt;borderColor&lt;/code&gt;, &lt;code&gt;backgroundColor&lt;/code&gt;, and color using the &lt;code&gt;contentStyle&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Tooltip contentStyle={{ borderRadius: "10px", borderColor: "lightgray", backgroundColor: "white", color: "black" }} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Legend&lt;/code&gt;, let’s align it to the left (&lt;code&gt;align=”left”&lt;/code&gt;), move it to the top (&lt;code&gt;verticalAlign=”top”&lt;/code&gt;), and give it some Wrapper styles for padding (&lt;code&gt;wrapperStyle={{ paddingTop: “20px”, paddingBottom: “40px”}}&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Legend align="left" verticalAlign="top" wrapperStyle={{ paddingTop: "20px", paddingBottom: "40px"}} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Bar&lt;/code&gt; tag, let’s change the fill color to &lt;code&gt;“#8B5CF6”&lt;/code&gt;, change the legend type to a circle (&lt;code&gt;legendType=”circle”&lt;/code&gt;), make the top edges of the bars rounded (&lt;code&gt;radius={[10, 10, 0, 0]}&lt;/code&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Bar
   dataKey="sale"
   fill="#C3EBFA"
   activeBar={&amp;lt;Rectangle fill="pink" stroke="blue" /&amp;gt;}
   legendType="circle"
   radius={[10, 10, 0, 0]}
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After applying all the modifications above, the final &lt;strong&gt;SalesGraph.tsx&lt;/strong&gt; should look like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";
import {
  Bar,
  BarChart,
  CartesianGrid,
  Legend,
  Rectangle,
  ResponsiveContainer,
  XAxis,
  YAxis,
  Tooltip
} from "recharts";

const data = [
  {
    name: "Sun",
    sale: 4000,
  },
  {
    name: "Mon",
    sale: 3000,
  },
  {
    name: "Tue",
    sale: 2000,
  },
  {
    name: "Wed",
    sale: 2780,
  },
  {
    name: "Thu",
    sale: 1890,
  },
  {
    name: "Fri",
    sale: 2390,
  },
  {
    name: "Sat",
    sale: 3490,
  },
];

const SalesGraph = () =&amp;gt; {
  const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4 h-[350px]"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Sales
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;ResponsiveContainer width="100%" height="100%"&amp;gt;
        &amp;lt;BarChart width={500} height={300} data={data} barSize={20}&amp;gt;
          &amp;lt;CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#ddd" /&amp;gt;
          &amp;lt;XAxis
            dataKey="name"
            axisLine={false}
            tick={{ fill: "gray" }}
            tickLine={false}
          /&amp;gt;
          &amp;lt;YAxis /&amp;gt;
          &amp;lt;Tooltip contentStyle={{ borderRadius: "10px", borderColor: "lightgray", backgroundColor: "gray", color: "white" }} /&amp;gt;
          &amp;lt;Legend align="left" verticalAlign="top" wrapperStyle={{ paddingTop: "20px", paddingBottom: "40px"}} /&amp;gt;
          &amp;lt;Bar
            dataKey="sale"
            fill="#8B5CF6"
            activeBar={&amp;lt;Rectangle fill="pink" stroke="blue" /&amp;gt;}
            legendType="circle"
            radius={[10, 10, 0, 0]}
          /&amp;gt;
        &amp;lt;/BarChart&amp;gt;
      &amp;lt;/ResponsiveContainer&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default SalesGraph;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are done with the Sale Graph. Now let’s handle the Income and Expenditure Graph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Income &amp;amp; Expenditure Graph
&lt;/h2&gt;

&lt;p&gt;To implement the Income and Expenditure Graph, let’s create another file inside the &lt;strong&gt;components&lt;/strong&gt; folder and name it &lt;strong&gt;IncomeExpediture.tsx&lt;/strong&gt;. Run &lt;em&gt;rafce&lt;/em&gt; and spin up the functional component, then import it into the &lt;strong&gt;dashboard/page.tsx&lt;/strong&gt; like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import IncomeExpediture from "@/components/IncomeExpediture"
import ProductCard from "@/components/ProductCard"
import SalesGraph from "@/components/SalesGraph"

const Dashboard = () =&amp;gt; {
  return (
    &amp;lt;div className='h-screen flex gap-4 flex-col'&amp;gt;
      &amp;lt;div className="flex gap-4 justify-between flex-wrap"&amp;gt;
        &amp;lt;ProductCard type='tablets' count={15210} /&amp;gt;
        &amp;lt;ProductCard type='syrups' count={9510} /&amp;gt;
        &amp;lt;ProductCard type='capsules' count={17542} /&amp;gt;
        &amp;lt;ProductCard type='vials' count={13524} /&amp;gt;
        &amp;lt;ProductCard type='others' count={7210} /&amp;gt;
        &amp;lt;ProductCard type='expired' count={125} /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;SalesGraph /&amp;gt;

      &amp;lt;IncomeExpediture /&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s open the &lt;strong&gt;IncomeExpediture.tsx&lt;/strong&gt; file and start implementing it.&lt;/p&gt;

&lt;p&gt;At the top of the graph is a title and ellipsis(3 dots) at both ends, so they would be flex items with a space between them like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";

const IncomeExpediture = () =&amp;gt; {
    const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4 h-[350px]"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Income and Expenditure
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default IncomeExpediture;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are doing the same thing we did with the Sales Graph. I gave a full width to the parent div, gave background colors based on selected theme, gave some shadow, made the edges rounded, gave some padding, made it a flex container with a height of 350px. I then added the heading and the ellipsis image.&lt;/p&gt;

&lt;p&gt;Like the previous graph, we will make use of &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt;. From the examples in the &lt;a href="https://recharts.org/en-US" rel="noopener noreferrer"&gt;recharts&lt;/a&gt; website, we will use &lt;a href="https://recharts.org/en-US/examples/SimpleLineChart" rel="noopener noreferrer"&gt;SimpleLineChart&lt;/a&gt;. The example code for the &lt;a href="https://recharts.org/en-US/examples/SimpleLineChart" rel="noopener noreferrer"&gt;SimpleLineChart&lt;/a&gt; is like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { PureComponent } from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';

const data = [
  {
    name: 'Page A',
    uv: 4000,
    pv: 2400,
    amt: 2400,
  },
  {
    name: 'Page B',
    uv: 3000,
    pv: 1398,
    amt: 2210,
  },
  {
    name: 'Page C',
    uv: 2000,
    pv: 9800,
    amt: 2290,
  },
  {
    name: 'Page D',
    uv: 2780,
    pv: 3908,
    amt: 2000,
  },
  {
    name: 'Page E',
    uv: 1890,
    pv: 4800,
    amt: 2181,
  },
  {
    name: 'Page F',
    uv: 2390,
    pv: 3800,
    amt: 2500,
  },
  {
    name: 'Page G',
    uv: 3490,
    pv: 4300,
    amt: 2100,
  },
];

export default class Example extends PureComponent {
  static demoUrl = 'https://codesandbox.io/p/sandbox/line-chart-width-xaxis-padding-8v7952';

  render() {
    return (
      &amp;lt;ResponsiveContainer width="100%" height="100%"&amp;gt;
        &amp;lt;LineChart
          width={500}
          height={300}
          data={data}
          margin={{
            top: 5,
            right: 30,
            left: 20,
            bottom: 5,
          }}
        &amp;gt;
          &amp;lt;CartesianGrid strokeDasharray="3 3" /&amp;gt;
          &amp;lt;XAxis dataKey="name" /&amp;gt;
          &amp;lt;YAxis /&amp;gt;
          &amp;lt;Tooltip /&amp;gt;
          &amp;lt;Legend /&amp;gt;
          &amp;lt;Line type="monotone" dataKey="pv" stroke="#8884d8" activeDot={{ r: 8 }} /&amp;gt;
          &amp;lt;Line type="monotone" dataKey="uv" stroke="#82ca9d" /&amp;gt;
        &amp;lt;/LineChart&amp;gt;
      &amp;lt;/ResponsiveContainer&amp;gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, let’s copy the data array and update our component like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";

const data = [
    {
      name: 'Page A',
      uv: 4000,
      pv: 2400,
      amt: 2400,
    },
    {
      name: 'Page B',
      uv: 3000,
      pv: 1398,
      amt: 2210,
    },
    {
      name: 'Page C',
      uv: 2000,
      pv: 9800,
      amt: 2290,
    },
    {
      name: 'Page D',
      uv: 2780,
      pv: 3908,
      amt: 2000,
    },
    {
      name: 'Page E',
      uv: 1890,
      pv: 4800,
      amt: 2181,
    },
    {
      name: 'Page F',
      uv: 2390,
      pv: 3800,
      amt: 2500,
    },
    {
      name: 'Page G',
      uv: 3490,
      pv: 4300,
      amt: 2100,
    },
  ];

const IncomeExpediture = () =&amp;gt; {
    const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4 h-[350px]"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Income and Expenditure
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default IncomeExpediture;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need income and expenditure data for the half year, so let’s modify the data array to suit our use case like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";

const data = [
    {
      name: 'Jan',
      income: 4000,
      expenditure: 2400,
    },
    {
      name: 'Feb',
      income: 3000,
      expenditure: 1398,
    },
    {
      name: 'Mar',
      income: 2000,
      expenditure: 9800,
    },
    {
      name: 'April',
      income: 2780,
      expenditure: 3908,
    },
    {
      name: 'May',
      income: 1890,
      expenditure: 4800,
    },
    {
      name: 'Jun',
      income: 2390,
      expenditure: 3800,
    },
  ];

const IncomeExpediture = () =&amp;gt; {
    const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4 h-[350px]"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Income and Expenditure
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default IncomeExpediture;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let’s copy the responsive container code and update our component like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import { useTheme } from "next-themes";
import Image from "next/image";
import {
  CartesianGrid,
  Legend,
  Line,
  LineChart,
  ResponsiveContainer,
  Tooltip,
  XAxis,
  YAxis,
} from "recharts";

const data = [
  {
    name: "Jan",
    income: 4000,
    expenditure: 2400,
  },
  {
    name: "Feb",
    income: 3000,
    expenditure: 1398,
  },
  {
    name: "Mar",
    income: 2000,
    expenditure: 9800,
  },
  {
    name: "April",
    income: 2780,
    expenditure: 3908,
  },
  {
    name: "May",
    income: 1890,
    expenditure: 4800,
  },
  {
    name: "Jun",
    income: 2390,
    expenditure: 3800,
  },
];

const IncomeExpediture = () =&amp;gt; {
  const { theme } = useTheme();

  return (
    &amp;lt;div className="w-full bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 flex flex-col gap-4 h-[350px]"&amp;gt;
      &amp;lt;div className="flex items-center justify-between"&amp;gt;
        &amp;lt;h1 className="text-lg font-semibold dark:text-white text-gray-500"&amp;gt;
          Income and Expenditure
        &amp;lt;/h1&amp;gt;
        &amp;lt;Image
          src={theme === "dark" ? "/more.png" : "/moreDark.png"}
          alt="More"
          width={20}
          height={20}
          className="cursor-pointer"
          suppressHydrationWarning
        /&amp;gt;
      &amp;lt;/div&amp;gt;

      &amp;lt;ResponsiveContainer width="100%" height="100%"&amp;gt;
        &amp;lt;LineChart
          width={500}
          height={300}
          data={data}
          margin={{
            top: 5,
            right: 30,
            left: 20,
            bottom: 5,
          }}
        &amp;gt;
          &amp;lt;CartesianGrid strokeDasharray="3 3" /&amp;gt;
          &amp;lt;XAxis dataKey="name" /&amp;gt;
          &amp;lt;YAxis /&amp;gt;
          &amp;lt;Tooltip /&amp;gt;
          &amp;lt;Legend /&amp;gt;
          &amp;lt;Line
            type="monotone"
            dataKey="pv"
            stroke="#8884d8"
            activeDot={{ r: 8 }}
          /&amp;gt;
          &amp;lt;Line type="monotone" dataKey="uv" stroke="#82ca9d" /&amp;gt;
        &amp;lt;/LineChart&amp;gt;
      &amp;lt;/ResponsiveContainer&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default IncomeExpediture;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be sure to add all the imports from recharts.&lt;/p&gt;

&lt;p&gt;The graph is not properly showing because we changed the data attributes in the data array but same is not reflecting in the &lt;code&gt;ResponsiveContainer&lt;/code&gt; block. Let’s make some modifications.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;CartesianGrid&lt;/code&gt;, let’s hide the vertical grid (&lt;code&gt;vertical={false}&lt;/code&gt;) and change the color for the horizontal grid (&lt;code&gt;stroke=”#ddd”&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#ddd" /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;XAxis&lt;/code&gt;, let’s hide the axis line (&lt;code&gt;axisLine={false}&lt;/code&gt;), make the tick gray (&lt;code&gt;tick={{ fill: “gray”}}&lt;/code&gt;), hide the tick line (&lt;code&gt;tickLine={false}&lt;/code&gt;), and give a margin of 10 to the tick (&lt;code&gt;tickMargin={10}&lt;/code&gt;). The tick is the tiny vertical line above each month name connecting to the x-axis.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;XAxis dataKey="name" axisLine={false} tick={{ fill: "gray"}} tickLine={false} tickMargin={10} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;YAxis&lt;/code&gt;, let’s hide the axis line (&lt;code&gt;axisLine={false}&lt;/code&gt;), make the tick gray (&lt;code&gt;tick={{ fill: “gray”}}&lt;/code&gt;), hide the tick line (&lt;code&gt;tickLine={false})&lt;/code&gt;, and give a margin of 20 to the tick (&lt;code&gt;tickMargin={20}&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;YAxis axisLine={false} tick={{ fill: "gray"}} tickLine={false} tickMargin={20} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Tooltip&lt;/code&gt;, let’s apply some styles; &lt;code&gt;borderRadius&lt;/code&gt;, &lt;code&gt;borderColor&lt;/code&gt;, &lt;code&gt;backgroundColor&lt;/code&gt;, and color using the &lt;code&gt;contentStyle&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Tooltip contentStyle={{ borderRadius: "10px", borderColor: "lightgray", backgroundColor: "white", color: "black" }} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Legend&lt;/code&gt;, let’s align it to the center (&lt;code&gt;align=”center”&lt;/code&gt;), set it to the top (&lt;code&gt;verticalAlign=”top”&lt;/code&gt;), and some padding top and bottom using the wrapperStyle (&lt;code&gt;wrapperStyle={{ paddingTop: “10px”, paddingBottom: “30px”}}&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Legend align="center" verticalAlign="top" wrapperStyle={{ paddingTop: "10px", paddingBottom: "30px"}} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the first Line, let’s set the &lt;code&gt;dataKey&lt;/code&gt; to income and the &lt;code&gt;stroke&lt;/code&gt; to &lt;code&gt;“#8B5CF6”&lt;/code&gt;. Add a strokeWidth of 5 (&lt;code&gt;strokeWidth={5}&lt;/code&gt;). This only makes the graph line thicker.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Line
   type="monotone"
   dataKey="income"
   stroke="#8B5CF6"
   activeDot={{ r: 8 }}
   strokeWidth={5}
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the other Line, set the &lt;code&gt;dataKey&lt;/code&gt; to expenditure and the &lt;code&gt;stroke&lt;/code&gt; to &lt;code&gt;“#FACC15”&lt;/code&gt;. Add a strokeWidth of 5 (&lt;code&gt;strokeWidth={5}&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Line type="monotone" dataKey="expenditure" stroke="#FACC15" strokeWidth={5} /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s it for this tutorial and thank you very much for following along.&lt;/p&gt;

&lt;p&gt;Challenge yourself and try displaying three cards inside the purchase orders component. The cards should display the count of products and their status; Pending, Fulfilled and Cancelled.&lt;/p&gt;

&lt;p&gt;I hope you have learned a lot from this guide. If you have any corrections, or suggestions, leave that in the comment section.&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>shadcn</category>
      <category>recharts</category>
    </item>
  </channel>
</rss>
