@ndla/safelink 1.1.7 → 2.0.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/README.md +0 -20
- package/lib/MissingRouterContext.d.ts +1 -0
- package/lib/SafeLink.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -21,23 +21,3 @@ import Safelink from '@ndla/safelink';
|
|
|
21
21
|
|
|
22
22
|
<Safelink to="/internal-url">Click me!</Safelink>;
|
|
23
23
|
```
|
|
24
|
-
|
|
25
|
-
### Basic example with context
|
|
26
|
-
|
|
27
|
-
In your app, add this to your top component:
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
import { MissingRouterContext } from '@ndla/safelink';
|
|
31
|
-
|
|
32
|
-
<MissingRouterContext.Provider value={true}>
|
|
33
|
-
<SomeComponent />
|
|
34
|
-
</MissingRouterContext.Provider>;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
and use SafeLink like this:
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
import Safelink from '@ndla/safelink';
|
|
41
|
-
|
|
42
|
-
<SafeLink to="/no-router-context">Click me!</SafeLink>;
|
|
43
|
-
```
|
package/lib/SafeLink.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
9
9
|
import { LinkProps } from 'react-router-dom';
|
|
10
|
-
export declare const isOldNdlaLink: (to?: string |
|
|
10
|
+
export declare const isOldNdlaLink: (to?: string | Partial<import("history").Path> | undefined) => boolean | "" | undefined;
|
|
11
11
|
declare type Props = {
|
|
12
12
|
showNewWindowIcon?: boolean;
|
|
13
13
|
children?: ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/safelink",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "SafeLink component for NDLA",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"@emotion/core": "^10.0.35",
|
|
34
34
|
"@emotion/styled": "^10.0.27",
|
|
35
35
|
"react": "16.13.1 || ^17.0.0",
|
|
36
|
-
"react-router-dom": "^
|
|
36
|
+
"react-router-dom": "^6.3.0"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "aaadfb10e26a439688e1059890c1425756504093"
|
|
42
42
|
}
|