react-navbar
Advanced tools
Comparing version 1.1.1 to 2.0.0
{ | ||
"name": "react-navbar", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "React.js component rendering a translatable menu bar with Twitter Bootstrap Navbar HTML markup", | ||
"main": "build/index.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "babel src -d build", | ||
"clean": "rm build/*.js", | ||
"lint": "eslint src tests", | ||
"build": "tsc", | ||
"lint": "tslint -c tslint.json src/*.{ts,tsx} test/*.{ts,tsx}", | ||
"prepublish": "npm run build", | ||
"pretest": "npm run lint", | ||
"tdd": "mocha -w -R min -r babel-register -r tests/helpers/jsdom -t 4000 tests/*.spec.js", | ||
"test": "mocha -r babel-register -r tests/helpers/jsdom -t 4000 tests/*.spec.js" | ||
"tdd": "mocha -r ts-node/register -r tests/helpers/enzyme --watch-extensions ts,tsx -b -R min -w tests/*.spec.*", | ||
"test": "mocha -r ts-node/register -r tests/helpers/enzyme -b tests/*.spec.*" | ||
}, | ||
@@ -20,2 +20,3 @@ "repository": { | ||
"keywords": [ | ||
"TypeScript", | ||
"reactjs", | ||
@@ -48,21 +49,19 @@ "component", | ||
"dependencies": { | ||
"classnames": "^2.1.2", | ||
"react-intl": "^1.2.2" | ||
"react-intl": "^2.4.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-react": "^6.24.1", | ||
"eslint": "^4.19.1", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.10.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.7.0", | ||
"eslint-plugin-react": "^7.7.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"jsdom": "^11.7.0", | ||
"mocha": "^5.0.5", | ||
"raf": "^3.4.0", | ||
"react": "^0.13.3" | ||
"@types/enzyme": "^3.1.12", | ||
"@types/mocha": "^5.2.5", | ||
"@types/react": "^16.4.6", | ||
"@types/react-intl": "^2.3.8", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"jsdom": "^11.11.0", | ||
"mocha": "^5.2.0", | ||
"react": "^16.4.1", | ||
"react-dom": "^16.4.1", | ||
"ts-node": "^7.0.0", | ||
"tslint": "^5.11.0", | ||
"typescript": "^2.9.2" | ||
} | ||
} |
@@ -6,4 +6,4 @@ [![Build Status](https://travis-ci.org/ikr/react-navbar.svg?branch=master)](https://travis-ci.org/ikr/react-navbar) | ||
React.js component rendering a translatable menu bar with Twitter Bootstrap | ||
[Navbar](http://getbootstrap.com/components/#navbar) HTML markup. For example, for a menu structure | ||
like the that: | ||
[Navbar](https://getbootstrap.com/docs/3.3/components/#navbar) HTML markup. For example, for a menu | ||
structure like the that: | ||
@@ -28,48 +28,54 @@ ``` | ||
```js | ||
import React from 'react'; | ||
import Navbar from 'react-navbar'; | ||
```jsx | ||
import * as React from 'react' | ||
import * as ReactDOM from 'react-dom' | ||
import {IntlProvider} from 'react-intl' | ||
import * as Navbar from 'react-navbar' | ||
const menuItems = [{ | ||
kind: 'dropdown', | ||
title: 'menu.dd1', | ||
items: [ | ||
{title: 'menu.i11', href: '/resource-1-1', target: '_blank'}, | ||
{title: 'menu.i12', href: '/resource-1-2'} | ||
{kind: 'item', title: 'menu.i11', href: '/resource-1-1', target: '_blank'}, | ||
{kind: 'item', title: 'menu.i12', href: '/resource-1-2'} | ||
] | ||
}, | ||
{title: 'menu.i1', href: '/resource-1'}, | ||
{title: 'menu.i2', href: '/resource-2'}]; | ||
{kind: 'item', title: 'menu.i1', href: '/resource-1'}, | ||
{kind: 'item', title: 'menu.i2', href: '/resource-2'}] | ||
const secondaryMenuItems = [{ | ||
kind: 'dropdown', | ||
title: 'menu.dd2', | ||
items: [ | ||
{title: 'menu.i21', href: '/resource-2-1'}, | ||
{title: 'menu.i22', href: '/resource-2-2'} | ||
{kind: 'item', title: 'menu.i21', href: '/resource-2-1'}, | ||
{kind: 'item', title: 'menu.i22', href: '/resource-2-2'} | ||
] | ||
}, | ||
{title: 'menu.i3', href: '/resource-3'}]; | ||
{title: 'menu.i3', href: '/resource-3'}] | ||
const localeSpecificIcuMessagesForTheWholeAppCompiledOnTheServer = { | ||
menu: { | ||
dd1: 'Drop-down-1', i11: 'Item-1-1', i12: 'Item-1-2', | ||
i1: 'Item-1', i2: 'Item-2', i3: 'Item-3', | ||
dd2: 'Drop-down-2', i21: 'Item-2-1', i22: 'Item-2-2' | ||
}, | ||
'menu.dd1': 'Drop-down-1', | ||
'menu.i11': 'Item-1-1', | ||
'menu.i12': 'Item-1-2', | ||
'menu.i1': 'Item-1', | ||
'menu.i2': 'Item-2', | ||
'menu.i3': 'Item-3', | ||
'menu.dd2': 'Drop-down-2', | ||
'menu.i21': 'Item-2-1', | ||
'menu.i22': 'Item-2-2' | ||
searchForm: {...}, | ||
footer: {...}, | ||
... | ||
}; | ||
// ... | ||
} | ||
React.render( | ||
React.createElement(Navbar, { | ||
menuItems, | ||
secondaryMenuItems, | ||
messages: localeSpecificIcuMessagesForTheWholeAppCompiledOnTheServer | ||
}), | ||
ReactDOM.render( | ||
<IntlProvider | ||
locale='en' | ||
messages={localeSpecificIcuMessagesForTheWholeAppCompiledOnTheServer}> | ||
<Navbar {...{menuItems, secondaryMenuItems}}/> | ||
</IntlProvider>, | ||
global.document.body | ||
); | ||
document.getElementById('root') | ||
) | ||
``` | ||
@@ -81,17 +87,7 @@ | ||
Navbar is [react-intl](https://github.com/yahoo/react-intl)-based. To translate the component, make | ||
sure it receives the `messages` property. The i18n message paths are the values of `title`-s of | ||
`menuItems` and `secondaryMenuItems`. | ||
Navbar is [react-intl](https://github.com/yahoo/react-intl)-based. The i18n message keys are the | ||
values of `title`-s of `menuItems` and `secondaryMenuItems`. | ||
`react-intl` foundation allows using `react-navbar` uniformly in bigger applications, and passing | ||
all the namespaced translations, from the root, down the React components hierarchy, -- | ||
automatically, with the help of `IntlMixin`. | ||
Please note, that `react-intl` depends on the global `Intl` object. You can polyfill it with | ||
[intl](https://github.com/andyearnshaw/Intl.js) package: | ||
```js | ||
if (!global.Intl) { | ||
require('intl'); | ||
} | ||
``` | ||
all the translations, from the root, down the React components hierarchy, — automatically, with the | ||
help of the `IntlProvider`. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
13
19
12899
166
91
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addedintl-format-cache@2.2.9(transitive)
+ Addedintl-messageformat@2.2.0(transitive)
+ Addedintl-messageformat-parser@1.4.0(transitive)
+ Addedintl-relativeformat@2.2.0(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-intl@2.9.0(transitive)
+ Addedreact-is@16.13.1(transitive)
- Removedclassnames@^2.1.2
- Removedacorn@5.7.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedast-types@0.9.6(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase62@1.2.8(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedclassnames@2.5.1(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcommoner@0.10.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddefined@1.0.1(transitive)
- Removeddetective@4.7.1(transitive)
- Removedenvify@3.4.1(transitive)
- Removedesprima@3.1.3(transitive)
- Removedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
- Removedglob@5.0.15(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedintl-format-cache@2.0.5(transitive)
- Removedintl-messageformat@1.1.0(transitive)
- Removedintl-messageformat-parser@1.1.0(transitive)
- Removedintl-relativeformat@1.1.0(transitive)
- Removedjstransform@11.0.3(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedq@1.5.1(transitive)
- Removedreact@0.13.3(transitive)
- Removedreact-intl@1.2.2(transitive)
- Removedrecast@0.11.23(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsource-map@0.4.40.5.7(transitive)
- Removedthrough@2.3.8(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedreact-intl@^2.4.0