gatsby-theme-q3 4.5.16 → 4.5.19

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.
Files changed (80) hide show
  1. package/.eslintrc.js +12 -12
  2. package/CHANGELOG.md +1181 -1164
  3. package/LICENSE +21 -21
  4. package/__fixtures__/en/titles.json +2 -2
  5. package/__fixtures__/fr/titles.json +2 -2
  6. package/gatsby-browser.js +38 -38
  7. package/gatsby-config.js +62 -62
  8. package/gatsby-node.js +77 -77
  9. package/gatsby-ssr.js +11 -20
  10. package/index.js +1 -1
  11. package/lib/components/AccountPublicGateway.js +2 -3
  12. package/lib/components/AdminLoader.js +2 -3
  13. package/lib/components/AdminPrivateGateway.js +3 -4
  14. package/lib/components/AdminPublicGateway.js +3 -4
  15. package/lib/components/AdminRouter.js +3 -4
  16. package/lib/components/BlogArchiveTemplate.js +2 -3
  17. package/lib/components/BlogTemplate.js +2 -3
  18. package/lib/components/FormBox.js +2 -3
  19. package/lib/components/FormBoxContent.js +2 -3
  20. package/lib/components/FormBoxNotice.js +2 -3
  21. package/lib/components/IsBrowserReady.js +2 -3
  22. package/lib/components/PageWrapper.js +2 -3
  23. package/lib/components/PublicTemplate.js +2 -3
  24. package/lib/components/Redirect.js +2 -3
  25. package/lib/components/RedirectToIndex.js +2 -3
  26. package/lib/components/RichText.js +2 -3
  27. package/lib/components/SearchEngine.js +4 -7
  28. package/lib/components/ShareButton.js +2 -3
  29. package/lib/components/Wrapper.js +2 -3
  30. package/lib/components/__tests__/useSiteMetaData.test.js +44 -44
  31. package/lib/components/__tests__/withAuthenticate.test.js +2 -2
  32. package/lib/components/__tests__/withSuccessOp.test.js +4 -4
  33. package/lib/components/index.js +2 -3
  34. package/lib/components/useSiteMetaData.js +1 -1
  35. package/lib/components/utils.js +2 -3
  36. package/lib/components/withAuthenticate.js +2 -2
  37. package/lib/components/withPublicTemplate.js +2 -3
  38. package/lib/components/withSuccessOp.js +3 -4
  39. package/lib/pages/404.js +2 -3
  40. package/lib/pages/login.js +2 -3
  41. package/lib/pages/password-change.js +2 -3
  42. package/lib/pages/password-reset.js +2 -3
  43. package/lib/pages/reverify.js +2 -3
  44. package/lib/pages/verify.js +2 -3
  45. package/package.json +5 -5
  46. package/src/components/AccountPublicGateway.jsx +18 -18
  47. package/src/components/AdminLoader.jsx +16 -16
  48. package/src/components/AdminPrivateGateway.jsx +37 -37
  49. package/src/components/AdminPublicGateway.jsx +34 -34
  50. package/src/components/AdminRouter.jsx +44 -44
  51. package/src/components/BlogArchiveTemplate.jsx +55 -55
  52. package/src/components/BlogTemplate.jsx +104 -104
  53. package/src/components/FormBox.jsx +22 -22
  54. package/src/components/FormBoxContent.jsx +26 -26
  55. package/src/components/FormBoxNotice.jsx +21 -21
  56. package/src/components/IsBrowserReady.jsx +13 -13
  57. package/src/components/PageWrapper.jsx +20 -20
  58. package/src/components/PublicTemplate.jsx +198 -198
  59. package/src/components/Redirect.jsx +13 -13
  60. package/src/components/RedirectToIndex.jsx +9 -9
  61. package/src/components/RichText.jsx +196 -196
  62. package/src/components/SearchEngine.jsx +124 -124
  63. package/src/components/ShareButton.jsx +80 -80
  64. package/src/components/Wrapper.jsx +14 -14
  65. package/src/components/__tests__/SearchEngine.test.jsx +58 -58
  66. package/src/components/__tests__/useSiteMetaData.test.js +44 -44
  67. package/src/components/__tests__/withAuthenticate.test.jsx +52 -52
  68. package/src/components/__tests__/withSuccessOp.test.jsx +57 -57
  69. package/src/components/index.js +16 -16
  70. package/src/components/useSiteMetaData.js +35 -35
  71. package/src/components/utils.js +23 -23
  72. package/src/components/withAuthenticate.jsx +20 -20
  73. package/src/components/withPublicTemplate.jsx +11 -11
  74. package/src/components/withSuccessOp.jsx +43 -43
  75. package/src/pages/404.jsx +31 -31
  76. package/src/pages/login.jsx +71 -71
  77. package/src/pages/password-change.jsx +72 -72
  78. package/src/pages/password-reset.jsx +47 -47
  79. package/src/pages/reverify.jsx +72 -72
  80. package/src/pages/verify.jsx +70 -70
@@ -1,21 +1,21 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import FormBox from './FormBox';
4
- import FormBoxContent from './FormBoxContent';
5
-
6
- const FormBoxNotice = ({ children, ...rest }) => (
7
- <FormBox
8
- renderTop={<FormBoxContent {...rest} />}
9
- renderBottom={children}
10
- />
11
- );
12
-
13
- FormBoxNotice.defaultProps = {
14
- children: null,
15
- };
16
-
17
- FormBoxNotice.propTypes = {
18
- children: PropTypes.node,
19
- };
20
-
21
- export default FormBoxNotice;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import FormBox from './FormBox';
4
+ import FormBoxContent from './FormBoxContent';
5
+
6
+ const FormBoxNotice = ({ children, ...rest }) => (
7
+ <FormBox
8
+ renderTop={<FormBoxContent {...rest} />}
9
+ renderBottom={children}
10
+ />
11
+ );
12
+
13
+ FormBoxNotice.defaultProps = {
14
+ children: null,
15
+ };
16
+
17
+ FormBoxNotice.propTypes = {
18
+ children: PropTypes.node,
19
+ };
20
+
21
+ export default FormBoxNotice;
@@ -1,13 +1,13 @@
1
- import PropTypes from 'prop-types';
2
- import { browser } from 'q3-ui-helpers';
3
-
4
- const { isBrowserReady } = browser;
5
-
6
- const IsBrowserReady = ({ children }) =>
7
- isBrowserReady() ? children : null;
8
-
9
- IsBrowserReady.propTypes = {
10
- children: PropTypes.node.isRequired,
11
- };
12
-
13
- export default IsBrowserReady;
1
+ import PropTypes from 'prop-types';
2
+ import { browser } from 'q3-ui-helpers';
3
+
4
+ const { isBrowserReady } = browser;
5
+
6
+ const IsBrowserReady = ({ children }) =>
7
+ isBrowserReady() ? children : null;
8
+
9
+ IsBrowserReady.propTypes = {
10
+ children: PropTypes.node.isRequired,
11
+ };
12
+
13
+ export default IsBrowserReady;
@@ -1,20 +1,20 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import SearchEngine from './SearchEngine';
4
-
5
- const PageWrapper = ({ children }) => (
6
- <>
7
- <SearchEngine />
8
- {children}
9
- </>
10
- );
11
-
12
- PageWrapper.defaultProps = {
13
- children: null,
14
- };
15
-
16
- PageWrapper.propTypes = {
17
- children: PropTypes.node,
18
- };
19
-
20
- export default PageWrapper;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import SearchEngine from './SearchEngine';
4
+
5
+ const PageWrapper = ({ children }) => (
6
+ <>
7
+ <SearchEngine />
8
+ {children}
9
+ </>
10
+ );
11
+
12
+ PageWrapper.defaultProps = {
13
+ children: null,
14
+ };
15
+
16
+ PageWrapper.propTypes = {
17
+ children: PropTypes.node,
18
+ };
19
+
20
+ export default PageWrapper;
@@ -1,198 +1,198 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {
4
- Box,
5
- Paper,
6
- Link,
7
- Grid,
8
- Hidden,
9
- makeStyles,
10
- } from '@material-ui/core';
11
- import { Alert } from '@material-ui/lab';
12
- import { Link as ReachLink } from 'gatsby';
13
- import { useTranslation } from 'q3-ui-locale';
14
- import { isString } from 'lodash';
15
- import BackgroundStyle from 'q3-admin/lib/components/BackgroundStyle';
16
- import AdminPublicGateway from './AdminPublicGateway';
17
- import useSiteMetaData from './useSiteMetaData';
18
-
19
- const useStyle = makeStyles((theme) => ({
20
- logo: ({ invertLogo = false }) => {
21
- const output = {
22
- height: 75,
23
- maxHeight: 75,
24
- width: 290,
25
- display: 'block',
26
-
27
- [theme.breakpoints.down('md')]: {
28
- height: 65,
29
- maxHeight: 65,
30
- width: 250,
31
- },
32
-
33
- '& img': {
34
- objectFit: 'contain',
35
- height: '100%',
36
- width: '100%',
37
- },
38
- };
39
-
40
- if (theme.palette.type === 'dark' && invertLogo)
41
- output.filter = 'invert(1) grayscale(100%)';
42
-
43
- return output;
44
- },
45
- container: {
46
- maxWidth: '85vw',
47
- width: 850,
48
-
49
- [theme.breakpoints.down('md')]: {
50
- width: '100%',
51
- },
52
-
53
- [theme.breakpoints.down('sm')]: {
54
- width: 'auto',
55
- },
56
- },
57
- photo: ({ photo }) => ({
58
- backgroundColor: theme.palette.secondary.light,
59
- backgroundImage: isString(photo)
60
- ? `url("${String(photo).replace(/\s/gi, '%20')}")`
61
- : undefined,
62
- backgroundSize: 'cover',
63
- backgroundPosition: 'center',
64
- backgroundRepeat: 'no-repeat',
65
- width: '100%',
66
- height: '100%',
67
- backgroundBlendMode: 'multiply',
68
- minHeight: '55vh',
69
- }),
70
- }));
71
-
72
- const Copyright = () => {
73
- const { brand } = useSiteMetaData();
74
-
75
- return brand ? (
76
- <Box display="inline-block" mx={1}>
77
- ©{new Date().getFullYear()} {brand}
78
- </Box>
79
- ) : null;
80
- };
81
-
82
- // eslint-disable-next-line
83
- const TextLink = ({ href, text }) => {
84
- const { t } = useTranslation('labels');
85
-
86
- return href ? (
87
- <Box display="inline-block" mx={1}>
88
- <Link href={href} target="_blank">
89
- {t(text)}
90
- </Link>
91
- </Box>
92
- ) : null;
93
- };
94
-
95
- const PublicTemplate = ({ children, ...rest }) => {
96
- const {
97
- brand,
98
- cancellation,
99
- invertLogo,
100
- terms,
101
- privacy,
102
- logo,
103
- photo,
104
- publicNotice = null,
105
- } = useSiteMetaData({
106
- logo: '/logo.png',
107
- photo: '/background.jpg',
108
- });
109
-
110
- const cls = useStyle({
111
- photo,
112
- invertLogo,
113
- });
114
-
115
- return (
116
- <AdminPublicGateway {...rest}>
117
- <BackgroundStyle />
118
- <Box
119
- alignItems="center"
120
- component="article"
121
- display="flex"
122
- flexDirection="column"
123
- justifyContent="center"
124
- width="100%"
125
- >
126
- <Box
127
- component="header"
128
- mt="2vh"
129
- mb={1}
130
- textAlign="center"
131
- >
132
- <ReachLink to="/" className={cls.logo}>
133
- <img alt={brand} src={logo} />
134
- </ReachLink>
135
- </Box>
136
- {publicNotice && (
137
- <Box className={cls.container} mb={1}>
138
- <Alert severity="warning">
139
- <Box
140
- dangerouslySetInnerHTML={{
141
- __html: publicNotice,
142
- }}
143
- />
144
- </Alert>
145
- </Box>
146
- )}
147
- <Paper className={cls.container}>
148
- <Grid container spacing={1}>
149
- <Hidden smDown>
150
- <Grid item xs={6}>
151
- <Box className={cls.photo} />
152
- </Grid>
153
- </Hidden>
154
- <Grid item md={6} xs={12}>
155
- <Box
156
- alignItems="center"
157
- height="100%"
158
- display="flex"
159
- p={2}
160
- >
161
- {children}
162
- </Box>
163
- </Grid>
164
- </Grid>
165
- </Paper>
166
- <Box
167
- maxWidth="75vw"
168
- component="footer"
169
- mt={2}
170
- textAlign="center"
171
- >
172
- <small>
173
- <Copyright />
174
- <TextLink
175
- href={terms}
176
- text="termsAndConditions"
177
- />
178
- <TextLink href={privacy} text="privacyPolicy" />
179
- <TextLink
180
- href={cancellation}
181
- text="cancellationPolicy"
182
- />
183
- </small>
184
- </Box>
185
- </Box>
186
- </AdminPublicGateway>
187
- );
188
- };
189
-
190
- PublicTemplate.defaultProps = {
191
- children: null,
192
- };
193
-
194
- PublicTemplate.propTypes = {
195
- children: PropTypes.node,
196
- };
197
-
198
- export default PublicTemplate;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {
4
+ Box,
5
+ Paper,
6
+ Link,
7
+ Grid,
8
+ Hidden,
9
+ makeStyles,
10
+ } from '@material-ui/core';
11
+ import { Alert } from '@material-ui/lab';
12
+ import { Link as ReachLink } from 'gatsby';
13
+ import { useTranslation } from 'q3-ui-locale';
14
+ import { isString } from 'lodash';
15
+ import BackgroundStyle from 'q3-admin/lib/components/BackgroundStyle';
16
+ import AdminPublicGateway from './AdminPublicGateway';
17
+ import useSiteMetaData from './useSiteMetaData';
18
+
19
+ const useStyle = makeStyles((theme) => ({
20
+ logo: ({ invertLogo = false }) => {
21
+ const output = {
22
+ height: 75,
23
+ maxHeight: 75,
24
+ width: 290,
25
+ display: 'block',
26
+
27
+ [theme.breakpoints.down('md')]: {
28
+ height: 65,
29
+ maxHeight: 65,
30
+ width: 250,
31
+ },
32
+
33
+ '& img': {
34
+ objectFit: 'contain',
35
+ height: '100%',
36
+ width: '100%',
37
+ },
38
+ };
39
+
40
+ if (theme.palette.type === 'dark' && invertLogo)
41
+ output.filter = 'invert(1) grayscale(100%)';
42
+
43
+ return output;
44
+ },
45
+ container: {
46
+ maxWidth: '85vw',
47
+ width: 850,
48
+
49
+ [theme.breakpoints.down('md')]: {
50
+ width: '100%',
51
+ },
52
+
53
+ [theme.breakpoints.down('sm')]: {
54
+ width: 'auto',
55
+ },
56
+ },
57
+ photo: ({ photo }) => ({
58
+ backgroundColor: theme.palette.secondary.light,
59
+ backgroundImage: isString(photo)
60
+ ? `url("${String(photo).replace(/\s/gi, '%20')}")`
61
+ : undefined,
62
+ backgroundSize: 'cover',
63
+ backgroundPosition: 'center',
64
+ backgroundRepeat: 'no-repeat',
65
+ width: '100%',
66
+ height: '100%',
67
+ backgroundBlendMode: 'multiply',
68
+ minHeight: '55vh',
69
+ }),
70
+ }));
71
+
72
+ const Copyright = () => {
73
+ const { brand } = useSiteMetaData();
74
+
75
+ return brand ? (
76
+ <Box display="inline-block" mx={1}>
77
+ ©{new Date().getFullYear()} {brand}
78
+ </Box>
79
+ ) : null;
80
+ };
81
+
82
+ // eslint-disable-next-line
83
+ const TextLink = ({ href, text }) => {
84
+ const { t } = useTranslation('labels');
85
+
86
+ return href ? (
87
+ <Box display="inline-block" mx={1}>
88
+ <Link href={href} target="_blank">
89
+ {t(text)}
90
+ </Link>
91
+ </Box>
92
+ ) : null;
93
+ };
94
+
95
+ const PublicTemplate = ({ children, ...rest }) => {
96
+ const {
97
+ brand,
98
+ cancellation,
99
+ invertLogo,
100
+ terms,
101
+ privacy,
102
+ logo,
103
+ photo,
104
+ publicNotice = null,
105
+ } = useSiteMetaData({
106
+ logo: '/logo.png',
107
+ photo: '/background.jpg',
108
+ });
109
+
110
+ const cls = useStyle({
111
+ photo,
112
+ invertLogo,
113
+ });
114
+
115
+ return (
116
+ <AdminPublicGateway {...rest}>
117
+ <BackgroundStyle />
118
+ <Box
119
+ alignItems="center"
120
+ component="article"
121
+ display="flex"
122
+ flexDirection="column"
123
+ justifyContent="center"
124
+ width="100%"
125
+ >
126
+ <Box
127
+ component="header"
128
+ mt="2vh"
129
+ mb={1}
130
+ textAlign="center"
131
+ >
132
+ <ReachLink to="/" className={cls.logo}>
133
+ <img alt={brand} src={logo} />
134
+ </ReachLink>
135
+ </Box>
136
+ {publicNotice && (
137
+ <Box className={cls.container} mb={1}>
138
+ <Alert severity="warning">
139
+ <Box
140
+ dangerouslySetInnerHTML={{
141
+ __html: publicNotice,
142
+ }}
143
+ />
144
+ </Alert>
145
+ </Box>
146
+ )}
147
+ <Paper className={cls.container}>
148
+ <Grid container spacing={1}>
149
+ <Hidden smDown>
150
+ <Grid item xs={6}>
151
+ <Box className={cls.photo} />
152
+ </Grid>
153
+ </Hidden>
154
+ <Grid item md={6} xs={12}>
155
+ <Box
156
+ alignItems="center"
157
+ height="100%"
158
+ display="flex"
159
+ p={2}
160
+ >
161
+ {children}
162
+ </Box>
163
+ </Grid>
164
+ </Grid>
165
+ </Paper>
166
+ <Box
167
+ maxWidth="75vw"
168
+ component="footer"
169
+ mt={2}
170
+ textAlign="center"
171
+ >
172
+ <small>
173
+ <Copyright />
174
+ <TextLink
175
+ href={terms}
176
+ text="termsAndConditions"
177
+ />
178
+ <TextLink href={privacy} text="privacyPolicy" />
179
+ <TextLink
180
+ href={cancellation}
181
+ text="cancellationPolicy"
182
+ />
183
+ </small>
184
+ </Box>
185
+ </Box>
186
+ </AdminPublicGateway>
187
+ );
188
+ };
189
+
190
+ PublicTemplate.defaultProps = {
191
+ children: null,
192
+ };
193
+
194
+ PublicTemplate.propTypes = {
195
+ children: PropTypes.node,
196
+ };
197
+
198
+ export default PublicTemplate;
@@ -1,13 +1,13 @@
1
- import React from 'react';
2
- import { navigate } from 'gatsby';
3
-
4
- // eslint-disable-next-line
5
- const Redirect = ({ to }) => {
6
- React.useEffect(() => {
7
- navigate(to);
8
- }, []);
9
-
10
- return null;
11
- };
12
-
13
- export default Redirect;
1
+ import React from 'react';
2
+ import { navigate } from 'gatsby';
3
+
4
+ // eslint-disable-next-line
5
+ const Redirect = ({ to }) => {
6
+ React.useEffect(() => {
7
+ navigate(to);
8
+ }, []);
9
+
10
+ return null;
11
+ };
12
+
13
+ export default Redirect;
@@ -1,9 +1,9 @@
1
- import React from 'react';
2
- import Redirect from './Redirect';
3
- import useSiteMetaData from './useSiteMetaData';
4
-
5
- const IndexPage = () => (
6
- <Redirect to={useSiteMetaData().appDirectory} />
7
- );
8
-
9
- export default IndexPage;
1
+ import React from 'react';
2
+ import Redirect from './Redirect';
3
+ import useSiteMetaData from './useSiteMetaData';
4
+
5
+ const IndexPage = () => (
6
+ <Redirect to={useSiteMetaData().appDirectory} />
7
+ );
8
+
9
+ export default IndexPage;