@dr.pogodin/react-utils 1.40.10 → 1.40.12
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/bin/setup.js +38 -10
- package/build/development/client/index.js +2 -1
- package/build/development/client/index.js.map +1 -1
- package/build/development/server/renderer.js +2 -1
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/utils/errors.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +0 -4
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Link.js.map +1 -1
- package/build/development/shared/components/MetaTags.js +18 -52
- package/build/development/shared/components/MetaTags.js.map +1 -1
- package/build/development/shared/components/NavLink.js.map +1 -1
- package/build/development/shared/utils/webpack.js +12 -9
- package/build/development/shared/utils/webpack.js.map +1 -1
- package/build/development/style.css +0 -78
- package/build/development/web.bundle.js +4 -4
- package/build/production/client/index.js +1 -1
- package/build/production/client/index.js.map +1 -1
- package/build/production/server/renderer.js +1 -1
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/utils/errors.js.map +1 -1
- package/build/production/shared/components/GenericLink/index.js +1 -1
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Link.js.map +1 -1
- package/build/production/shared/components/MetaTags.js +4 -52
- package/build/production/shared/components/MetaTags.js.map +1 -1
- package/build/production/shared/components/NavLink.js.map +1 -1
- package/build/production/shared/utils/webpack.js +1 -1
- package/build/production/shared/utils/webpack.js.map +1 -1
- package/build/production/style.css.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/server/utils/errors.d.ts +1 -1
- package/build/types-code/shared/components/GenericLink/index.d.ts +7 -7
- package/build/types-code/shared/components/Link.d.ts +2 -1
- package/build/types-code/shared/components/MetaTags.d.ts +10 -54
- package/build/types-code/shared/components/NavLink.d.ts +2 -1
- package/build/types-code/shared/utils/webpack.d.ts +1 -1
- package/config/stylelint/default.js +1 -0
- package/package.json +9 -9
- package/src/client/index.tsx +6 -1
- package/src/server/renderer.tsx +4 -1
- package/src/server/utils/errors.ts +1 -1
- package/src/shared/components/GenericLink/index.tsx +15 -11
- package/src/shared/components/Link.tsx +2 -2
- package/src/shared/components/MetaTags.tsx +33 -54
- package/src/shared/components/Modal/base-theme.scss +1 -1
- package/src/shared/components/NavLink.tsx +2 -2
- package/src/shared/components/PageLayout/base-theme.scss +1 -1
- package/src/shared/components/TextArea/style.scss +0 -1
- package/src/shared/components/selectors/NativeDropdown/theme.scss +0 -2
- package/src/shared/utils/webpack.ts +14 -9
- package/src/styles/global.scss +1 -1
- package/src/styles/mixins.scss +3 -3
|
@@ -80,7 +80,7 @@ export declare function newError(message: string, statusCode?: CODES): ErrorWith
|
|
|
80
80
|
/**
|
|
81
81
|
* Throws an error with given message and HTTP status code.
|
|
82
82
|
*/
|
|
83
|
-
export declare function fail(message: string, statusCode?: CODES):
|
|
83
|
+
export declare function fail(message: string, statusCode?: CODES): Error;
|
|
84
84
|
/**
|
|
85
85
|
* ```js
|
|
86
86
|
* import { server } from '@dr.pogodin/react-utils';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Link, LinkProps, NavLink, NavLinkProps } from 'react-router-dom';
|
|
3
3
|
import './style.scss';
|
|
4
|
+
type LinkT = typeof Link;
|
|
5
|
+
type NavLinkT = typeof NavLink;
|
|
4
6
|
type ToT = Parameters<typeof Link>[0]['to'];
|
|
5
|
-
interface LinkI {
|
|
6
|
-
}
|
|
7
7
|
export type PropsT = {
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
className?: string;
|
|
@@ -14,8 +14,8 @@ export type PropsT = {
|
|
|
14
14
|
onMouseDown?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
15
15
|
openNewTab?: boolean;
|
|
16
16
|
replace?: boolean;
|
|
17
|
-
routerLinkType:
|
|
18
|
-
to
|
|
17
|
+
routerLinkType: LinkT | NavLinkT;
|
|
18
|
+
to: ToT;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* The `<Link>` component, and almost identical `<NavLink>` component, are
|
|
@@ -57,5 +57,5 @@ export type PropsT = {
|
|
|
57
57
|
* determining if the location matches the current URL. See the `<Route strict>`
|
|
58
58
|
* documentation for more information.
|
|
59
59
|
*/
|
|
60
|
-
declare const GenericLink:
|
|
60
|
+
declare const GenericLink: ({ children, className, disabled, enforceA, keepScrollPosition, onClick, onMouseDown, openNewTab, replace, routerLinkType, to, ...rest }: (LinkProps | NavLinkProps) & PropsT) => ReactNode;
|
|
61
61
|
export default GenericLink;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* - User opts to open the reference in a new tab;
|
|
6
6
|
* - User explicitely opts to use <a>.
|
|
7
7
|
*/
|
|
8
|
+
import { type LinkProps } from 'react-router-dom';
|
|
8
9
|
import { type PropsT as GenericLinkPropsT } from './GenericLink';
|
|
9
|
-
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'
|
|
10
|
+
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'> & LinkProps;
|
|
10
11
|
declare const Link: React.FunctionComponent<PropsT>;
|
|
11
12
|
export default Link;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type Context as ContextT, type FunctionComponent, type ReactNode } from 'react';
|
|
2
2
|
type PropsT = {
|
|
3
3
|
children?: ReactNode;
|
|
4
4
|
description: string;
|
|
5
|
+
extraMetaTags?: Array<{
|
|
6
|
+
content: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}>;
|
|
5
9
|
image?: string;
|
|
6
10
|
siteName?: string;
|
|
7
11
|
socialDescription?: string;
|
|
@@ -10,59 +14,11 @@ type PropsT = {
|
|
|
10
14
|
url?: string;
|
|
11
15
|
};
|
|
12
16
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* When `<MetaTags>` are nested within the app's component tree, meta tags
|
|
18
|
-
* content injected by components encountered down the tree overrides tags
|
|
19
|
-
* injected by previously encountered `<MetaTags>` components.
|
|
20
|
-
*
|
|
21
|
-
* **Children:** `<MetaTags>` children, if any, are rendered at the component's
|
|
22
|
-
* location. The context passes down all meta tag properties of parent
|
|
23
|
-
* `<MetaTag>` instances. These properties can fetched within children
|
|
24
|
-
* hierarchy in the following way, thus facilitating tags modification by
|
|
25
|
-
* children:
|
|
26
|
-
* ```jsx
|
|
27
|
-
* import { useContext } from 'react';
|
|
28
|
-
* import { MetaTags } from '@dr.pogodin/react-utils';
|
|
29
|
-
* export default function SampleComponent() {
|
|
30
|
-
* const { title, description, ...rest } = useContext(MetaTags.Context);
|
|
31
|
-
* // Do something with these props here, e.g. prefix the page title with
|
|
32
|
-
* // the component name:
|
|
33
|
-
* return (
|
|
34
|
-
* <MetaTags title={`Sample component - ${title}`} />
|
|
35
|
-
* );
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
* @param [props]
|
|
39
|
-
* @param [props.description] Page description to use in
|
|
40
|
-
* the `description` meta tag, and as a default description of Open Graph Tags.
|
|
41
|
-
* @param [props.image] The absolute URL of thumbnail image to use
|
|
42
|
-
* in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags
|
|
43
|
-
* are not injected.
|
|
44
|
-
*
|
|
45
|
-
* **BEWARE:** It must be a complete, absolute URL, including the correct
|
|
46
|
-
* website domain and HTTP schema.
|
|
47
|
-
*
|
|
48
|
-
* @param [props.siteName]: The site name to use in `twitter:site`,
|
|
49
|
-
* and `og:sitename` tags. By default these tags are not injected.
|
|
50
|
-
*
|
|
51
|
-
* @param [props.socialDescription] The site description to use in
|
|
52
|
-
* `twitter:description` and `og:description` meta tags. By default the value of
|
|
53
|
-
* `description` prop is used.
|
|
54
|
-
* @param [props.socialTitle] The page title to use in
|
|
55
|
-
* `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of
|
|
56
|
-
* `title` prop is used. Also the `og:image:alt` tag is only injected if `image`
|
|
57
|
-
* prop is present.
|
|
58
|
-
*
|
|
59
|
-
* @param props.title: The page name to use in the `<title>` tag.
|
|
60
|
-
* It is also used as the default value of `socialTitle` prop.
|
|
61
|
-
*
|
|
62
|
-
* @param [props.url] The page URL to use in `og:url` tag.
|
|
63
|
-
* By default the tag is not injected.
|
|
17
|
+
* Auxiliary wrapper around "react-helmet", which helps to inject meta tags
|
|
18
|
+
* (page title, a brief content description, and social media thumbnails) into
|
|
19
|
+
* generated pages.
|
|
64
20
|
*/
|
|
65
|
-
declare const MetaTags:
|
|
66
|
-
Context:
|
|
21
|
+
declare const MetaTags: FunctionComponent<PropsT> & {
|
|
22
|
+
Context: ContextT<PropsT>;
|
|
67
23
|
};
|
|
68
24
|
export default MetaTags;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { type NavLinkProps } from 'react-router-dom';
|
|
1
2
|
import { type PropsT as GenericLinkPropsT } from './GenericLink';
|
|
2
|
-
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'
|
|
3
|
+
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'> & NavLinkProps;
|
|
3
4
|
declare const NavLink: React.FunctionComponent<PropsT>;
|
|
4
5
|
export default NavLink;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param [basePath]
|
|
6
6
|
* @return Required module.
|
|
7
7
|
*/
|
|
8
|
-
export declare function requireWeak(modulePath: string, basePath?: string):
|
|
8
|
+
export declare function requireWeak<Module extends NodeJS.Module>(modulePath: string, basePath?: string): Module | null;
|
|
9
9
|
/**
|
|
10
10
|
* Resolves specified module path with help of Babel's module resolver.
|
|
11
11
|
* Yes, the function itself just returns its argument to the caller, but Babel
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.40.
|
|
2
|
+
"version": "1.40.12",
|
|
3
3
|
"bin": {
|
|
4
4
|
"react-utils-build": "bin/build.js",
|
|
5
5
|
"react-utils-setup": "bin/setup.js"
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"react": "^18.3.1",
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
37
|
"react-helmet": "^6.1.0",
|
|
38
|
-
"react-router-dom": "^6.
|
|
38
|
+
"react-router-dom": "^6.28.0",
|
|
39
39
|
"request-ip": "^3.3.0",
|
|
40
40
|
"rimraf": "^6.0.0",
|
|
41
41
|
"serialize-javascript": "^6.0.2",
|
|
42
42
|
"serve-favicon": "^2.5.0",
|
|
43
43
|
"source-map-support": "^0.5.21",
|
|
44
44
|
"uuid": "^11.0.2",
|
|
45
|
-
"winston": "^3.
|
|
45
|
+
"winston": "^3.17.0"
|
|
46
46
|
},
|
|
47
47
|
"description": "Collection of generic ReactJS components and utils",
|
|
48
48
|
"devDependencies": {
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
96
96
|
"eslint-import-resolver-babel-module": "^5.3.2",
|
|
97
97
|
"eslint-plugin-import": "^2.31.0",
|
|
98
|
-
"eslint-plugin-jest": "^28.
|
|
98
|
+
"eslint-plugin-jest": "^28.9.0",
|
|
99
99
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
100
100
|
"eslint-plugin-react": "^7.37.2",
|
|
101
|
-
"eslint-plugin-react-hooks": "^4.
|
|
101
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
102
102
|
"identity-obj-proxy": "^3.0.0",
|
|
103
103
|
"jest": "^29.7.0",
|
|
104
104
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -106,14 +106,14 @@
|
|
|
106
106
|
"mini-css-extract-plugin": "^2.9.2",
|
|
107
107
|
"mockdate": "^3.0.5",
|
|
108
108
|
"nodelist-foreach-polyfill": "^1.2.0",
|
|
109
|
-
"postcss": "^8.4.
|
|
109
|
+
"postcss": "^8.4.49",
|
|
110
110
|
"postcss-loader": "^8.1.1",
|
|
111
111
|
"postcss-scss": "^4.0.9",
|
|
112
112
|
"pretty": "^2.0.0",
|
|
113
113
|
"react-refresh": "^0.14.2",
|
|
114
114
|
"regenerator-runtime": "^0.14.1",
|
|
115
115
|
"resolve-url-loader": "^5.0.0",
|
|
116
|
-
"sass": "^1.80.
|
|
116
|
+
"sass": "^1.80.7",
|
|
117
117
|
"sass-loader": "^16.0.3",
|
|
118
118
|
"sitemap": "^8.0.0",
|
|
119
119
|
"source-map-loader": "^5.0.0",
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
122
122
|
"supertest": "^7.0.0",
|
|
123
123
|
"tsc-alias": "^1.8.10",
|
|
124
|
-
"tstyche": "^
|
|
124
|
+
"tstyche": "^3.0.0",
|
|
125
125
|
"typed-scss-modules": "^8.0.1",
|
|
126
126
|
"typescript": "^5.6.3",
|
|
127
|
-
"typescript-eslint": "^8.
|
|
127
|
+
"typescript-eslint": "^8.14.0",
|
|
128
128
|
"webpack": "^5.96.1",
|
|
129
129
|
"webpack-dev-middleware": "^7.4.2",
|
|
130
130
|
"webpack-hot-middleware": "^2.26.1",
|
package/src/client/index.tsx
CHANGED
|
@@ -28,7 +28,12 @@ export default function Launch(
|
|
|
28
28
|
if (!container) throw Error('Failed to find container for React app');
|
|
29
29
|
const scene = (
|
|
30
30
|
<GlobalStateProvider initialState={getInj().ISTATE || options.initialState}>
|
|
31
|
-
<BrowserRouter
|
|
31
|
+
<BrowserRouter
|
|
32
|
+
future={{
|
|
33
|
+
v7_relativeSplatPath: true,
|
|
34
|
+
v7_startTransition: true,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
32
37
|
<Application />
|
|
33
38
|
</BrowserRouter>
|
|
34
39
|
</GlobalStateProvider>
|
package/src/server/renderer.tsx
CHANGED
|
@@ -443,7 +443,10 @@ export default function factory(
|
|
|
443
443
|
ssrContext={ssrContext}
|
|
444
444
|
>
|
|
445
445
|
<StaticRouter
|
|
446
|
-
future={{
|
|
446
|
+
future={{
|
|
447
|
+
v7_relativeSplatPath: true,
|
|
448
|
+
v7_startTransition: true,
|
|
449
|
+
}}
|
|
447
450
|
location={req.url}
|
|
448
451
|
>
|
|
449
452
|
<App2 />
|
|
@@ -101,7 +101,7 @@ export function newError(message: string, statusCode = CODES.INTERNAL_SERVER_ERR
|
|
|
101
101
|
export function fail(
|
|
102
102
|
message: string,
|
|
103
103
|
statusCode: CODES = CODES.INTERNAL_SERVER_ERROR,
|
|
104
|
-
):
|
|
104
|
+
): Error {
|
|
105
105
|
throw newError(message, statusCode);
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type {
|
|
4
|
+
Link,
|
|
5
|
+
LinkProps,
|
|
6
|
+
NavLink,
|
|
7
|
+
NavLinkProps,
|
|
8
|
+
} from 'react-router-dom';
|
|
6
9
|
|
|
7
10
|
import './style.scss';
|
|
8
11
|
|
|
9
|
-
type
|
|
12
|
+
type LinkT = typeof Link;
|
|
13
|
+
type NavLinkT = typeof NavLink;
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
type ToT = Parameters<typeof Link>[0]['to'];
|
|
12
16
|
|
|
13
17
|
export type PropsT = {
|
|
14
18
|
children?: ReactNode;
|
|
@@ -20,8 +24,8 @@ export type PropsT = {
|
|
|
20
24
|
onMouseDown?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
21
25
|
openNewTab?: boolean;
|
|
22
26
|
replace?: boolean;
|
|
23
|
-
routerLinkType:
|
|
24
|
-
to
|
|
27
|
+
routerLinkType: LinkT | NavLinkT;
|
|
28
|
+
to: ToT;
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
/**
|
|
@@ -64,7 +68,7 @@ export type PropsT = {
|
|
|
64
68
|
* determining if the location matches the current URL. See the `<Route strict>`
|
|
65
69
|
* documentation for more information.
|
|
66
70
|
*/
|
|
67
|
-
const GenericLink
|
|
71
|
+
const GenericLink = ({
|
|
68
72
|
children,
|
|
69
73
|
className,
|
|
70
74
|
disabled,
|
|
@@ -77,7 +81,7 @@ const GenericLink: React.FunctionComponent<PropsT> = ({
|
|
|
77
81
|
routerLinkType,
|
|
78
82
|
to,
|
|
79
83
|
...rest
|
|
80
|
-
}) => {
|
|
84
|
+
}: (LinkProps | NavLinkProps) & PropsT): ReactNode => {
|
|
81
85
|
/* Renders Link as <a> element if:
|
|
82
86
|
* - It is opted explicitely by `enforceA` prop;
|
|
83
87
|
* - It should be opened in a new tab;
|
|
@@ -103,7 +107,7 @@ const GenericLink: React.FunctionComponent<PropsT> = ({
|
|
|
103
107
|
);
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
const L = routerLinkType
|
|
110
|
+
const L = routerLinkType;
|
|
107
111
|
|
|
108
112
|
return (
|
|
109
113
|
<L
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* - User explicitely opts to use <a>.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Link as RrLink } from 'react-router-dom';
|
|
9
|
+
import { type LinkProps, Link as RrLink } from 'react-router-dom';
|
|
10
10
|
|
|
11
11
|
import GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';
|
|
12
12
|
|
|
13
|
-
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'
|
|
13
|
+
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'> & LinkProps;
|
|
14
14
|
|
|
15
15
|
const Link: React.FunctionComponent<PropsT> = (props) => (
|
|
16
16
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Context as ContextT,
|
|
3
|
+
type FunctionComponent,
|
|
4
|
+
type ReactNode,
|
|
5
|
+
createContext,
|
|
6
|
+
useMemo,
|
|
7
|
+
} from 'react';
|
|
8
|
+
|
|
2
9
|
import { Helmet } from 'react-helmet';
|
|
3
10
|
|
|
4
11
|
type PropsT = {
|
|
5
12
|
children?: ReactNode;
|
|
6
13
|
description: string;
|
|
14
|
+
extraMetaTags?: Array<{
|
|
15
|
+
content: string;
|
|
16
|
+
name: string;
|
|
17
|
+
}>;
|
|
7
18
|
image?: string;
|
|
8
19
|
siteName?: string;
|
|
9
20
|
socialDescription?: string;
|
|
@@ -18,63 +29,16 @@ const Context = createContext<PropsT>({
|
|
|
18
29
|
});
|
|
19
30
|
|
|
20
31
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* When `<MetaTags>` are nested within the app's component tree, meta tags
|
|
26
|
-
* content injected by components encountered down the tree overrides tags
|
|
27
|
-
* injected by previously encountered `<MetaTags>` components.
|
|
28
|
-
*
|
|
29
|
-
* **Children:** `<MetaTags>` children, if any, are rendered at the component's
|
|
30
|
-
* location. The context passes down all meta tag properties of parent
|
|
31
|
-
* `<MetaTag>` instances. These properties can fetched within children
|
|
32
|
-
* hierarchy in the following way, thus facilitating tags modification by
|
|
33
|
-
* children:
|
|
34
|
-
* ```jsx
|
|
35
|
-
* import { useContext } from 'react';
|
|
36
|
-
* import { MetaTags } from '@dr.pogodin/react-utils';
|
|
37
|
-
* export default function SampleComponent() {
|
|
38
|
-
* const { title, description, ...rest } = useContext(MetaTags.Context);
|
|
39
|
-
* // Do something with these props here, e.g. prefix the page title with
|
|
40
|
-
* // the component name:
|
|
41
|
-
* return (
|
|
42
|
-
* <MetaTags title={`Sample component - ${title}`} />
|
|
43
|
-
* );
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
* @param [props]
|
|
47
|
-
* @param [props.description] Page description to use in
|
|
48
|
-
* the `description` meta tag, and as a default description of Open Graph Tags.
|
|
49
|
-
* @param [props.image] The absolute URL of thumbnail image to use
|
|
50
|
-
* in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags
|
|
51
|
-
* are not injected.
|
|
52
|
-
*
|
|
53
|
-
* **BEWARE:** It must be a complete, absolute URL, including the correct
|
|
54
|
-
* website domain and HTTP schema.
|
|
55
|
-
*
|
|
56
|
-
* @param [props.siteName]: The site name to use in `twitter:site`,
|
|
57
|
-
* and `og:sitename` tags. By default these tags are not injected.
|
|
58
|
-
*
|
|
59
|
-
* @param [props.socialDescription] The site description to use in
|
|
60
|
-
* `twitter:description` and `og:description` meta tags. By default the value of
|
|
61
|
-
* `description` prop is used.
|
|
62
|
-
* @param [props.socialTitle] The page title to use in
|
|
63
|
-
* `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of
|
|
64
|
-
* `title` prop is used. Also the `og:image:alt` tag is only injected if `image`
|
|
65
|
-
* prop is present.
|
|
66
|
-
*
|
|
67
|
-
* @param props.title: The page name to use in the `<title>` tag.
|
|
68
|
-
* It is also used as the default value of `socialTitle` prop.
|
|
69
|
-
*
|
|
70
|
-
* @param [props.url] The page URL to use in `og:url` tag.
|
|
71
|
-
* By default the tag is not injected.
|
|
32
|
+
* Auxiliary wrapper around "react-helmet", which helps to inject meta tags
|
|
33
|
+
* (page title, a brief content description, and social media thumbnails) into
|
|
34
|
+
* generated pages.
|
|
72
35
|
*/
|
|
73
|
-
const MetaTags:
|
|
74
|
-
Context:
|
|
36
|
+
const MetaTags: FunctionComponent<PropsT> & {
|
|
37
|
+
Context: ContextT<PropsT>;
|
|
75
38
|
} = ({
|
|
76
39
|
children,
|
|
77
40
|
description,
|
|
41
|
+
extraMetaTags,
|
|
78
42
|
image,
|
|
79
43
|
siteName,
|
|
80
44
|
socialDescription,
|
|
@@ -103,6 +67,20 @@ const MetaTags: React.FunctionComponent<PropsT> & {
|
|
|
103
67
|
url,
|
|
104
68
|
]);
|
|
105
69
|
|
|
70
|
+
const extra: ReactNode[] = [];
|
|
71
|
+
if (extraMetaTags?.length) {
|
|
72
|
+
for (let i = 0; i < extraMetaTags.length; ++i) {
|
|
73
|
+
const { content, name } = extraMetaTags[i]!;
|
|
74
|
+
extra.push(
|
|
75
|
+
<meta
|
|
76
|
+
content={content}
|
|
77
|
+
name={name}
|
|
78
|
+
key={`extra-meta-tag-${i}`}
|
|
79
|
+
/>,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
106
84
|
return (
|
|
107
85
|
<>
|
|
108
86
|
<Helmet>
|
|
@@ -132,6 +110,7 @@ const MetaTags: React.FunctionComponent<PropsT> & {
|
|
|
132
110
|
siteName ? (<meta name="og:sitename" content={siteName} />) : null
|
|
133
111
|
}
|
|
134
112
|
{ url ? (<meta name="og:url" content={url} />) : null }
|
|
113
|
+
{extra}
|
|
135
114
|
</Helmet>
|
|
136
115
|
{
|
|
137
116
|
children ? (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NavLink as RrNavLink } from 'react-router-dom';
|
|
1
|
+
import { type NavLinkProps, NavLink as RrNavLink } from 'react-router-dom';
|
|
2
2
|
|
|
3
3
|
import GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';
|
|
4
4
|
|
|
5
|
-
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'
|
|
5
|
+
type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'> & NavLinkProps;
|
|
6
6
|
|
|
7
7
|
const NavLink: React.FunctionComponent<PropsT> = (props) => (
|
|
8
8
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
@@ -7,29 +7,34 @@ import { IS_CLIENT_SIDE } from './isomorphy';
|
|
|
7
7
|
* @param [basePath]
|
|
8
8
|
* @return Required module.
|
|
9
9
|
*/
|
|
10
|
-
export function requireWeak(
|
|
10
|
+
export function requireWeak<Module extends NodeJS.Module>(
|
|
11
11
|
modulePath: string,
|
|
12
12
|
basePath?: string,
|
|
13
|
-
):
|
|
13
|
+
): Module | null {
|
|
14
14
|
if (IS_CLIENT_SIDE) return null;
|
|
15
15
|
|
|
16
16
|
try {
|
|
17
17
|
/* eslint-disable no-eval */
|
|
18
18
|
const { resolve } = eval('require')('path');
|
|
19
19
|
const path = basePath ? resolve(basePath, modulePath) : modulePath;
|
|
20
|
-
const
|
|
20
|
+
const module = eval('require')(path) as Module;
|
|
21
21
|
/* eslint-enable no-eval */
|
|
22
22
|
|
|
23
|
-
if (!
|
|
23
|
+
if (!('default' in module)) return module;
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const { default: def, ...named } = module;
|
|
26
|
+
|
|
27
|
+
const res = def as Module;
|
|
28
|
+
|
|
29
|
+
Object.entries(named).forEach(([name, value]) => {
|
|
30
|
+
const assigned = res[name as keyof Module];
|
|
31
|
+
if (assigned !== undefined) {
|
|
32
|
+
if (assigned !== value) {
|
|
28
33
|
throw Error('Conflict between default and named exports');
|
|
29
34
|
}
|
|
30
|
-
} else
|
|
35
|
+
} else res[name as keyof Module] = value;
|
|
31
36
|
});
|
|
32
|
-
return
|
|
37
|
+
return res;
|
|
33
38
|
} catch {
|
|
34
39
|
return null;
|
|
35
40
|
}
|
package/src/styles/global.scss
CHANGED
package/src/styles/mixins.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Collection of standard mixins, being used all around. */
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
2
|
+
@forward "_mixins/fonts";
|
|
3
|
+
@forward "_mixins/media";
|
|
4
|
+
@forward "_mixins/typography";
|
|
5
5
|
|
|
6
6
|
$zIndexOfDefaultModalOverlay: 998;
|