Skip to content

Commit

Permalink
chore: update readme, yarn, and some dev dependencies (#93)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Schrader <[email protected]>
  • Loading branch information
icd2k3 and jschrader-nr authored Mar 9, 2020
1 parent c74fe95 commit ec060f7
Show file tree
Hide file tree
Showing 4 changed files with 238 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: node_js
node_js:
- "12.14.1"
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.21.1
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.4
- export PATH="$HOME/.yarn/bin:$PATH"
script:
- yarn run travis
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@
<a href="https://coveralls.io/github/icd2k3/react-router-breadcrumbs-hoc?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/icd2k3/react-router-breadcrumbs-hoc/badge.svg?branch=master" /></a>
</p>

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Description](#description)
- [Install](#install)
- [Usage](#usage)
- [Examples](#examples)
- [Simple](#simple)
- [Advanced](#advanced)
- [Already using a route config array with react-router?](#already-using-a-route-config-array-with-react-router)
- [Disabling default generated breadcrumbs](#disabling-default-generated-breadcrumbs)
- [Dynamic breadcrumbs](#dynamic-breadcrumbs)
- [Order matters!](#order-matters)
- [API](#api)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Description

Deconstruct a route and return matching breadcrumb components you can render however you like. Render a simple string, a component that fetches a model in order to display the desired content, or just render something totally unrelated to the route.
Expand All @@ -35,6 +51,7 @@ withBreadcrumbs()(MyComponent);

## Examples

### Simple
Start seeing generated breadcrumbs right away with this simple example ([codesandbox](https://codesandbox.io/s/bare-bones-example-kcdrt))
```js
import withBreadcrumbs from 'react-router-breadcrumbs-hoc';
Expand All @@ -48,6 +65,7 @@ const Breadcrumbs = ({ breadcrumbs }) => (
export default withBreadcrumbs()(Breadcrumbs);
```

### Advanced
The example above will work for some routes, but you may want other routes to be dynamic (such as a user name breadcrumb). Let's modify it to handle custom-set breadcrumbs. ([codesandbox](https://codesandbox.io/s/basic-dynamic-example-m03tz))

```js
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@commitlint/cli": "^8.3.5",
Expand All @@ -62,8 +62,8 @@
"jest": "^25.1.0",
"js-yaml": "^3.13.1",
"prop-types": "^15.7.2",
"react": "16.12.0",
"react-dom": "16.12.0",
"react": "16.13.0",
"react-dom": "16.13.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"rollup": "^1.29.1",
Expand Down
Loading

0 comments on commit ec060f7

Please sign in to comment.