1.0.4 • Published 4 years ago

nrel-branding v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

NREL-branding

NREL branding components

Installation

npm i nrel-branding

Components

Header

The header component is a wrapper component that can be passed React components as children. Most commonly, this will be passed the Menu component included in this package along with it's corresponding children.

  <Header appTitle="NREL Application Title">
    <Menu>
      <MenuLink to="/route">Link Title</MenuLink>
      <MenuLink to="/another-route">Another Link Title</MenuLink>
    </Menu>
  </Header>

Props

NameTypeDefaultDescription
appTitle*nodeThe title of the application
classNamestringAdd a class to be used for styling
logoSrcstringNREL blue logoThe source of the logo image file. This should probably live in the public dir of the app
childrennodeThe nav bar. In general, this will be the menu component from this library
noStickbooleanfalseBoolean determining if the menu bar should not be sticky to the top of the page
isSlimbooleanfalseBoolean for slimmer headers. Mostly used dynamically for data-viewer pages
hasMobileNavbooleanfalseBoolean used to turn on a mobile nav when in mobile resolutions

* Required prop

Footer

The footer component to be set at the bottom of the page.

  <Footer />

Props

NameTypeDefaultDescription
classNamestringAdd a class to be used for styling

Menu

The nav bar menu used to either navigate through the current application, link to external sites or for Auth.

  <Menu>
    <MenuLink to="/route">Link Title</MenuLink>
    <ExternalMenuLink to="https://nrel.gov">NREL Homepage</ExternalMenuLink>
    <MenuSpacer />
    <CustomAuthComponent />
  </Menu>

Props

NameTypeDefaultDescription
children*nodeMost likely this will be a series of MenuLinks or custom components
classNamestringAdd a class to be used for styling
isSubMenubooleanfalseBoolean saying if the parent is the sub menu or a main menu
noStickbooleanfalseBoolean determining if the menu bar should not be sticky to the top of the page
scrollContainerIdstringcss selector id of container where scroll events occur on the dom. Used to apply the sticky class to the nav bar

* Required prop

ExternalMenuLink

A navbar link to visit an external site

  <ExternalMenuLink to="https://nrel.gov">NREL</ExternalMenuLink>

Props

NameTypeDefaultDescription
to*URLLink destination
children*nodeJSX of HTML elements, or in most cases just label text
altstringthe link title (similar to an image alt tag)
classNamestringAdd a class to be used for styling

* Required prop

MenuLink

A navbar link to visit an site

  <MenuLink to="/data-viewer">Data Viewer</MenuLink>

Props

NameTypeDefaultDescription
to*URLLink destination
children*nodeJSX of HTML elements, or in most cases just label text
classNamestringAdd a class to be used for styling
isCurrentboolfalseWhether or not this is active, default (undefined) will infer from the current path

* Required prop

MenuSpacer

Adds space between menu items. Generally used between nav buttons on the left of the nav bar and the auth buttons on the right.

  <MenuSpacer />

SubMenu

A dropdown menu to show multiple links under one nav bar label.

  <SubMenu label="Key Findings">
    <MenuLink to="/key-findings/scenarios">Scenarios</MenuLink>
    <MenuLink to="/key-findings/topics">Topics</MenuLink>
  </SubMenu>

Props

NameTypeDefaultDescription
label*stringNav button label
children*nodeMost likely this will be a series of MenuLinks or custom components
classNamestringAdd a class to be used for styling

* Required prop

1.0.2

4 years ago

1.0.1

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago