0.2.7 • Published 5 years ago

@corey_hutcheson/reusable-react v0.2.7

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@corey_hutcheson/reusable-react

A small re-usable library containing useful react components.

Information

At this time, the library only contains a SPA navbar. But other components will be added as they are created.

Installation

Install reusable-react in your project using npm:

npm install --save @corey_hutcheson/reusable-react

Usage

Import the needed react-components into your project, like so:

import { Navbar } from "@corey-hutcheson/reusable-react";

Basic Navbar

import React from "react";
import ReactDOM from "react-dom";
import { Navbar } from "@corey-hutcheson/reusable-react";

const App = () => {
  const links = [
    {
      element: "about",
      text: "About"
    },
    {
      element: "projects",
      text: "Projects"
    },
    {
      element: "contact",
      text: "Contact"
    }
  ];

  return (
    <>
      <Navbar links={links} />

      <main>
        <div>
          <section id="about" className="section">
            About
          </section>
          <section id="projects" className="section">
            Projects
          </section>
          <section id="contact" className="section">
            Contact
          </section>
        </div>
      </main>
    </>
  );
};

ReactDOM.render(<App />, document.querySelector("#root"));

Navbar Props

PropDefaultDescription
linksrequiredArray of objects, each with element and text property
iconfalsePass react component representing icon
theme'light'Accepts 'light', 'dark', or a theme object {...themeProps}
extraCompfalsePass component if you'd like to show extra info in top left of navbar
scrollToOffset0Offset in pixels when scrolling to element
spyOffset-300Offset in pixels for when scroll spy is activated

More Examples

Dark variant with Icon:

<Navbar icon={<Icon />} theme="dark" scrollToOffset={-50}>
  <div element="about" text="About" />
  <div element="projects" text="Projects" />
  <div element="contact" text="Contact" />
</Navbar>

Contributing

Pull requests are welcome, and very much appreciated.

License

MIT

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago