Skip to content

Commit

Permalink
chore: remove react-router-dom as a dependency (#103)
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 Apr 1, 2020
1 parent fe8ab74 commit eb243cc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 25 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-breadcrumbs-hoc",
"version": "3.2.7",
"version": "3.2.8",
"description": "small, flexible, higher order component for rendering breadcrumbs with react-router 4.x",
"repository": "icd2k3/react-router-breadcrumbs-hoc",
"main": "dist/cjs/index.js",
Expand Down Expand Up @@ -28,8 +28,7 @@
"license": "MIT",
"peerDependencies": {
"react": ">=16.8",
"react-router": ">=4",
"react-router-dom": ">=4"
"react-router": ">=4"
},
"dependencies": {},
"devDependencies": {
Expand Down Expand Up @@ -66,7 +65,6 @@
"react": "16.13.0",
"react-dom": "16.13.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"rollup": "^2.1.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-uglify": "^6.0.2",
Expand Down
5 changes: 2 additions & 3 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import { mount } from 'enzyme';
import { MemoryRouter as Router } from 'react-router';
import { NavLink } from 'react-router-dom';
import withBreadcrumbs, { getBreadcrumbs } from './index.tsx';

// imports to test compiled builds
Expand All @@ -32,7 +31,7 @@ const components = {
</h1>
),
BreadcrumbMatchTest: ({ match }) => <span>{match.params.number}</span>,
BreadcrumbNavLinkTest: ({ match }) => <NavLink to={match.url}>Link</NavLink>,
BreadcrumbNavLinkTest: ({ match }) => <a to={match.url}>Link</a>,
BreadcrumbLocationTest: ({ location: { state: { isLocationTest } } }) => (
<span>
{isLocationTest ? 'pass' : 'fail'}
Expand Down Expand Up @@ -151,7 +150,7 @@ describe('react-router-breadcrumbs-hoc', () => {
];
const { breadcrumbs, wrapper } = render({ pathname: '/1/2/3/4', routes });
expect(breadcrumbs).toBe('Home / One / TWO / 3 / Link');
expect(wrapper.find(NavLink).props().to).toBe('/1/2/3/4');
expect(wrapper.find('a').props().to).toBe('/1/2/3/4');
});
});

Expand Down
3 changes: 1 addition & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
*/

import React, { createElement } from 'react';
import { matchPath, withRouter } from 'react-router';
import { useLocation } from 'react-router-dom';
import { useLocation, matchPath, withRouter } from 'react-router';

// eslint-disable-next-line import/extensions, import/no-unresolved, no-unused-vars
import * as types from '../types/react-router-breadcrumbs-hoc/index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from "react";
import { RouteComponentProps } from "react-router";
import { NavLink } from "react-router-dom";
import withBreadcrumbs, {
BreadcrumbsRoute,
BreadcrumbsProps,
Expand Down Expand Up @@ -30,7 +29,7 @@ const Breadcrumbs = ({ breadcrumbs }: InjectedProps) => (
<div>
{breadcrumbs.map(({ breadcrumb, match }: BreadcrumbsProps, index: number) => (
<span key={match.url}>
<NavLink to={match.url}>{breadcrumb}</NavLink>
<a href={match.url}>{breadcrumb}</a>
{index < breadcrumbs.length - 1 && <i> / </i>}
</span>
))}
Expand Down
15 changes: 1 addition & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5203,20 +5203,7 @@ react-is@^16.12.0, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-i
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.0.tgz#0f37c3613c34fe6b37cd7f763a0d6293ab15c527"
integrity sha512-GFMtL0vHkiBv9HluwNZTggSn/sCyEt9n02aM0dSAjGGyqyNlAyftYm4phPxdvCigG15JreC5biwxCgTAJZ7yAA==

react-router-dom@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.1.2.tgz#06701b834352f44d37fbb6311f870f84c76b9c18"
integrity sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew==
dependencies:
"@babel/runtime" "^7.1.2"
history "^4.9.0"
loose-envify "^1.3.1"
prop-types "^15.6.2"
react-router "5.1.2"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

[email protected], react-router@^5.1.2:
react-router@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.1.2.tgz#6ea51d789cb36a6be1ba5f7c0d48dd9e817d3418"
integrity sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A==
Expand Down

0 comments on commit eb243cc

Please sign in to comment.