@justfixnyc/component-library 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.es.js +9 -0
- package/dist/src/index.js +9 -0
- package/dist/typings/link/Link.d.ts +2 -1
- package/package.json +1 -1
package/dist/src/index.es.js
CHANGED
|
@@ -314,6 +314,15 @@ const Link = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
314
314
|
...props
|
|
315
315
|
} = _ref;
|
|
316
316
|
const linkClassNames = classNames('jfcl-link', className);
|
|
317
|
+
|
|
318
|
+
// When using this component within a react-router-dom <Link />, a navigate function is passed through the props us here.
|
|
319
|
+
// Since this navigate function is not a normal anchor element attribute we want to remove it before applying the rest of
|
|
320
|
+
// the props to avoid browser errors.
|
|
321
|
+
// Github issue talking about what's happening:
|
|
322
|
+
// https://github.com/remix-run/react-router/issues/6962
|
|
323
|
+
// Reference to react-router-dom Link component code to see what it's doing:
|
|
324
|
+
// https://github.com/remix-run/react-router/blob/0c058adc5b56c6d9b409af5e4d8330c645fac00c/packages/react-router-dom/modules/Link.js
|
|
325
|
+
delete props.navigate;
|
|
317
326
|
return /*#__PURE__*/React.createElement("a", _extends({}, props, {
|
|
318
327
|
ref: ref,
|
|
319
328
|
className: linkClassNames
|
package/dist/src/index.js
CHANGED
|
@@ -324,6 +324,15 @@ const Link = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
324
324
|
...props
|
|
325
325
|
} = _ref;
|
|
326
326
|
const linkClassNames = classNames__default["default"]('jfcl-link', className);
|
|
327
|
+
|
|
328
|
+
// When using this component within a react-router-dom <Link />, a navigate function is passed through the props us here.
|
|
329
|
+
// Since this navigate function is not a normal anchor element attribute we want to remove it before applying the rest of
|
|
330
|
+
// the props to avoid browser errors.
|
|
331
|
+
// Github issue talking about what's happening:
|
|
332
|
+
// https://github.com/remix-run/react-router/issues/6962
|
|
333
|
+
// Reference to react-router-dom Link component code to see what it's doing:
|
|
334
|
+
// https://github.com/remix-run/react-router/blob/0c058adc5b56c6d9b409af5e4d8330c645fac00c/packages/react-router-dom/modules/Link.js
|
|
335
|
+
delete props.navigate;
|
|
327
336
|
return /*#__PURE__*/React__default["default"].createElement("a", _extends__default["default"]({}, props, {
|
|
328
337
|
ref: ref,
|
|
329
338
|
className: linkClassNames
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './styles.scss';
|
|
3
3
|
export type LinkIcon = 'internal' | 'external';
|
|
4
|
-
export interface LinkProps extends React.
|
|
4
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
5
5
|
icon?: LinkIcon;
|
|
6
6
|
className?: string;
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
+
navigate?: () => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|