Struggling to implement a date range picker in my NextJs Project

Can someone assist me with a design challenge I'm facing? I'm struggling to incorporate a date range picker based on the client's specifications. I am currently working on a website where I need to match the design to the mockup provided. I attempted to use Airbnb react dates for this purpose, but I found the customization process challenging, especially for the dates input field. Despite having the basic layout in place, whenever I try to integrate a date range picker, it disrupts the overall design. Any help in implementing the date range picker according to the mockup design would be greatly appreciated. Below, you'll find the link to my code on GitHub which includes both the codes and a demo of the design.

GitHub Link - https://github.com/ramanujamgond/header-widget.git

Demo Link -

Mockup Design

Mockup of the design - The date range picker

Note - The design is just a basic structure without any functionality or API calls implemented yet.

Header Component

import Image from 'next/image';

// import logo
import Logo from '../../assets/images/logo.png';

// import masthead image
import mastHead from '../../assets/images/masthead.png';

// import property overview icon details
import PropertryDetails from '../../assets/images/53-plus-hotels.svg';
import Location100Plus from '../../assets/images/100-locations.svg';
import BestPriceGurantee from '../../assets/images/best-guarantee.svg';
import Travelers74Mn from '../../assets/images/74mn-travelers.svg';
import TopHeader from './TopHeader';

// import widget
import HeaderWidget from '../widget/HeaderWidget';

const Header = () => {
    return (
        <>
            <section className="position-relative">
                <div className="header-glass-wrapper">
                    <TopHeader />
                    <nav className="navbar navbar-expand-md navbar-dark fixed-top bg-transparent margin-top">
                        <div className="container">
                            <a className="navbar-brand" href="#">
                                <Image src={Logo} alt="Picture of the author" height="65" />
                            </a>
                            <button className="navbar-toggler ms-auto" type="button" data-bs-toggle="collapse" data-bs-target="#collapseNavbar">
                                <span className="navbar-toggler-icon"></span>
                            </button>
                            <div className="navbar-collapse collapse" id="collapseNavbar">
                                <ul className="navbar-nav ms-auto">
                                    <li className="nav-item">
                                        <a className="nav-link nav-text-color mx-4" href="">Menu 1</a>
                                    </li>

                                    <li className="nav-item">
                                        <a className="nav-link nav-text-color mx-4" href="">Menu 2</a>
                                    </li>

                                    <li className="nav-item">
                                        <a className="nav-link nav-text-color mx-4" href="">Menu 3</a>
                                    </li>

                                    <li className="nav-item">
                                        <a className="nav-link nav-text-color mx-4" href="">Menu 4</a>
                                    </li>

                                    <li className="nav-item">
                                        <a className="nav-link nav-text-color mx-4" href="">Menu 5</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </nav>
                </div>

                <header>
                    <Image src={mastHead} className="masthead" alt="Hero Image" />
                    <div className="widget-select-wrapper">
...
export default Header;

Header Widget

import React from 'react';

// import react tabs
import { Tab, Tabs, TabList, TabPanel, resetIdCounter } from 'react-tabs';
import 'react-tabs/style/react-tabs.css';

const HeaderWidget = () => {
    resetIdCounter();
    return (
        <>
            <div className="multiple-widget-item-wrapper">
                <Tabs>
                    <TabList>
                        <Tab>Hotels</Tab>
                        <Tab>Holiday Packages</Tab>
                        <Tab>Boat Houses</Tab>
                        <Tab>Sightseeing</Tab>
                    </TabList>

                    <TabPanel>
                        <div className="widget-date-range-picker">
                            <div className="location-search-wrapper"><input className="form-control location-search" type="text" placeholder="Enter Location" /></div>
                            <div className="date-picker-wrapper-checkIn"><input className="form-control date-picker-check-in" type="text" placeholder="22 Sept 2021" /></div>
                            <div className="date-picker-wrapper-checkOut"><input className="form-control date-picker-check-out" type="text" placeholder="23 Sept 2021" /></div>
                            <div><button type="button" className="btn standard-search-btn">Search</button></div>
                        </div>
                    </TabPanel>

                    ...
                    
                </Tabs>
            </div>
        </>
    )
}

export default HeaderWidget;
                       

Answer №1

One helpful suggestion is to integrate the material-ui date picker component into your application. Here's a link to learn more about it: Material-UI Date Picker

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Show the Canvas element at the back of the DIV

This particular question requires a clear explanation. My goal is to have the canvas act as a background element on the page, while the main content of the page starts in its usual position. I attempted using separate DIVs with their own Z-index values, bu ...

How should GET and Data be returned in NextJS 13.4 API? Should we use NextResponse, Response, or NextAPIResponse?

After researching, it seems there are various opinions on the correct way to return a response to an API in NextJS. It appears that some of the confusion may stem from the transition between versions 13.4 and previous ones. However, I will outline my exper ...

What are the steps to implementing AJAX pagination without utilizing a database?

Is it possible to implement AJAX pagination without relying on MySQL? Can I create a PHP file containing the text and markup needed for display, and by clicking on page numbers, serve that content to the user? Can this be achieved using only jQuery and PHP ...

Error retrieving individual user information from the list via REST API

routes user.js view layout.ejs user.ejs users.ejs app.js REST API - "" I am facing an issue with two GET requests. In users.ejs, I am rendering three dynamic buttons with specific href values. In user.ejs, I am rendering a single user. ...

If the ID matches a value in the list, assign a class to the div

Hello, I am looking for assistance on how to add a class to a div if its id matches a value from a predetermined list: list = ["a1", "a2", "a3"] <div id="a1"></div> <div id="b1"></div> <div id="c1"></div> <div id=" ...

The Node.js express-generator application encounters a problem and is unable to start because of a TypeError: app.set function is not recognized

During the setup of my application using nodejs and express-generator, I encountered an issue when running the following commands in my terminal: npm install multer --save npm audit fix Afterwards, when I attempted to run node ./bin/www I received an err ...

AngularJS allows for the execution of several asynchronous requests to a single API function, each with unique parameters

How can I asynchronously call 3 independent API methods so that as soon as any one of them has completed, I can work with the response without waiting for the others to finish? I am looking for a solution similar to System.Threading.Tasks in C#. var pro ...

Remove an item from an array of objects based on its value

Within the array of nested objects provided below: [ { "items": [ { "name": "See data", "href": "/data", }, { ...

Creating a decorative ribbon in three.js for your gift presentation

How can I create a ribbon for a gift box using three.js, similar to the example shown here: Is it possible to create the ribbon with just one piece or do I need multiple pieces to achieve the desired look? Thank you :) ...

How can you send an array from Django to JavaScript without using u''?

When viewing the data: 'some_array': ['text1','text2', 'text3'] Upon trying to pass it to a JS script in the template: <script type="text/javascript"> some_func({{ some_array }}); </script> Howeve ...

What is the best way to display data from an object with changing properties in React.js?

Dealing with dynamic properties in an object can be tricky, especially when trying to output the data. I encountered this issue while working with an array of objects fetched from an API call. The array contains an object named languages, and its key value ...

Create a div element that expands to occupy the remaining space of the screen's height

I am trying to adjust the min-height of content2 to be equal to the screen height minus the height of other divs. In the current HTML/CSS setup provided below, the resulting outcome exceeds the screen height. How can I achieve my desired effect? The foote ...

A guide to integrating ServerSideRendering and state management techniques like UseState and UseEffects within Next JS applications

Hey there! I'm looking to learn how to implement State Management (UseState, UseEffects) in Next JS with server-side rendering without relying on 'use client' at the top. Will integrating State Management (UseState, UseEffects) in the clien ...

Angular allows for the editing of a table by double-clicking and using an array of objects

I am dealing with an array of objects structured like this: $scope.rows = [{ num1: 56, num2: 78, num3: 89 }, { num1: 56, num2: 78, num3: 89 }, { num1: 56, num2: 78, num3: 89 }, { num1: 56, num2: 78, num3: 8 ...

How can I set the input tag to reset back to 1 when a certain event occurs?

I am currently developing an HTML Snakes And Ladders game. On the settings screen, there is an input field where users can select the size of the board. Depending on their choice, they will be able to choose a maximum number of snakes and ladders. For exa ...

The current issue with the Next.js 13 beta application is that the nested layout directory does not scroll to the top when the route is

Check out the live demo here. Ensure to scroll down and click on a link in the header. In my project, I have two files named layout.tsx: one in the src directory and another in the (public) directory with a sticky <Header /> component. The expected ...

Unfortunately, the Ajax functionality is not performing as expected

What am I missing? 2.php: <button id = "Text_Example">Display</button> <script src="jquery-3.1.1.min.js"></script> <script src="js_code.js"></script> js_code.js: $("#testtext").bind("click", displayNewData); functio ...

React not displaying wrapped div

I am facing an issue with my render() function where the outer div is not rendering, but the inner ReactComponent is displaying. Here is a snippet of my code: return( <div style={{background: "black"}}> <[ReactComponent]> ...

Monitoring and analyzing conversations within a chat platform

In our Node.JS chat system, we have implemented three channels for message delivery: one using the mqtt protocol, another using the third-party service pusher channels, and a third using a message fetch service based on the gcm protocol. Messages sent from ...

Make sure the div is always positioned above everything, including any built-in pop-up windows

When working with two forms, one for user input and the other as a pop-up window to display results, users sometimes close the pop-up window prematurely if they think there is a network issue causing a delay in data execution. To prevent this, I am consi ...