1.0.0 • Published 4 years ago

@opuscapita/oc-cm-navigation-header v1.0.0

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

oc-cm-navigation-header

Description

Provides a navigation header with back arrow, paging (@opuscapita/react-list-items), and a dropdown menu (@opuscapita/react-dropdown).

Installation

npm install @opuscapita/oc-cm-navigation-header

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

Prop nameTypeDefaultDescription
titlestringnullTitle shown in the left side of the header
onBackClickfunctionnullBack button click callback. Button is hidden, if function is not provided.
dropdowndropdownTypeDefines options for the dropdown menu (see dropdownType for more information).
pagingpagingTypeDefines options for the paging (see pagingType for more information).
classNamestringCustom class name
idstringrequiredThe ID
rightContentnodenullan option to add custom right aligned content before dropdown menu
sideSectionBasisstring, number200pxSide column's (left, right) flex-basis value. The center column will take all the remaining space
Types
  • dropdownType:

For up-to-date information, please see: https://github.com/OpusCapita/react-dropdown/blob/master/README.md

Prop nameTypeDefaultDescription
menuItemsarray of menu itemsrequiredList of the dropdown menu items
caretbooleanfalseIf true, caret is show
disabledbooleanfalseIs dropdown disabled or not
dropupbooleanfalseIs dropup or dropdown
pullLeftbooleanfalseIf false, dropdown is aligned on right, otherwise on left
titlenumber, string or elementTitle of the dropdown
  • dropdownType - menu items:
Prop nameTypeDefaultDescription
disabledbooleanIs dropdown menu item disabled
disableClosingbooleanIs dropdown menu item's closing disabled
hrefstringHyperlink of the dropdown menu item
iconelementIcon of the dropdown menu item
idnumber or stringUnique HTML id attribute
onClickfunctionCallback function of click
titlenumber, string or elementTitle of the dropdown menu item
typestringEnumeration either 'item' or 'divider'
  • pagingType:

For up-to-date information, please see: https://github.com/OpusCapita/react-list-items/blob/master/src/list-items/README.md

Prop nameTypeDefaultDescription
disabledboolfalseA sign of a disabled status of navigation icons
goToItemfunctionrequiredCallback that is called when navigation to another item should happen
itemElementelementnullCustom component to render between navigation icons. By default it renders a string m/n.
itemIdnum, strrequiredInitially selected item id
itemIdslistrequiredList of item ids

Code example

import React from 'react';
import NavigationHeader from '@opuscapita/oc-cm-navigation-header';

export default class ReactView extends React.Component {
  render() {
    return (
      <NavigationHeader
        propName="propValue"
      />
    );
  }
}