1.0.10 • Published 5 months ago

reusable-navbar v1.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

ReusableNavbar Component

A highly customizable and reusable navbar component for React applications. This component includes a modal for booking appointments and displays token information.

Installation

To install the ReusableNavbar component, run the following command:

npm install reusable-navbar

Usage

To use the ReusableNavbar component in your React application, follow these steps:

1. Add Tailwind CSS via CDN

Include the following script tag in the <head> of your index.html file to load Tailwind CSS:

<script src="https://unpkg.com/@tailwindcss/browser@4"></script>

Example:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>ReusableNavbar Example</title>
    <script src="https://unpkg.com/@tailwindcss/browser@4"></script>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

2. Import the Component

import React from "react";
import ReusableNavbar from "reusable-navbar";

3. Use the Component

const App = () => {
  return (
    <div>
      <ReusableNavbar totalTokens={20} currentTokens={5} buttonName="Book Now" />
    </div>
  );
};

export default App;

Props

The ReusableNavbar component accepts the following props:

Prop NameTypeDefault ValueDescription
totalTokensnumber0Total number of tokens available.
currentTokensnumber0Current token number being served.
buttonNamestring"Book"Text to display on the main button.
containerClassNamestring""Custom class name for the main container.
tokenTextClassNamestring""Custom class name for the token text elements.
buttonClassNamestring""Custom class name for the main button.
modalOverlayClassNamestring""Custom class name for the modal overlay.
modalContentClassNamestring""Custom class name for the modal content.
modalTitleClassNamestring""Custom class name for the modal title.
labelClassNamestring""Custom class name for the form labels.
inputClassNamestring""Custom class name for the input fields.
cancelButtonClassNamestring""Custom class name for the "Cancel" button.
confirmButtonClassNamestring""Custom class name for the "Book" button.
successMessageClassNamestring""Custom class name for the success message.
closeButtonClassNamestring""Custom class name for the "Close" button.

Customization

You can customize the appearance of the ReusableNavbar component by passing custom class names to the respective props. For example:

<ReusableNavbar
  totalTokens={20}
  currentTokens={5}
  buttonName="Reserve"
  containerClassName="custom-navbar"
  buttonClassName="custom-button"
  modalOverlayClassName="custom-overlay"
  modalContentClassName="custom-modal"
  labelClassName="custom-label"
  inputClassName="custom-input"
  cancelButtonClassName="custom-cancel-button"
  confirmButtonClassName="custom-confirm-button"
  successMessageClassName="custom-success-message"
  closeButtonClassName="custom-close-button"
/>

Example

Here’s an example of a fully customized ReusableNavbar:

import React from "react";
import ReusableNavbar from "reusable-navbar";

const App = () => {
  return (
    <div>
      <ReusableNavbar
        totalTokens={20}
        currentTokens={5}
        buttonName="Reserve"
        containerClassName="bg-blue-100 p-4"
        buttonClassName="bg-blue-500 text-white hover:bg-blue-700"
        modalOverlayClassName="bg-gray-200/60"
        modalContentClassName="bg-white p-6 rounded-lg"
        modalTitleClassName="text-blue-600 font-bold"
        labelClassName="text-gray-700"
        inputClassName="border border-gray-300 rounded p-2"
        cancelButtonClassName="bg-gray-300 hover:bg-gray-400"
        confirmButtonClassName="bg-green-500 hover:bg-green-700 text-white"
        successMessageClassName="text-green-600"
        closeButtonClassName="bg-blue-500 hover:bg-blue-700 text-white"
      />
    </div>
  );
};

export default App;

This documentation provides clear installation steps, usage examples, a well-structured props table, and customization options to ensure easy integration of the ReusableNavbar component in any React project.

1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

0.0.0

5 months ago