@uncinc/uncinc-react-kitchen-sink 2.1.12 → 2.2.1
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/components/Cookie/Checkbox/index.js +31 -0
- package/dist/components/Cookie/Checkbox/style.scss +36 -0
- package/dist/components/Cookie/index.js +211 -0
- package/dist/components/Cookie/stories.js +32 -0
- package/dist/components/Cookie/stories.scss +71 -0
- package/dist/components/Cookie/style.scss +55 -0
- package/dist/components/SearchKit/Query/index.js +12 -4
- package/dist/components/SearchKit/SearchField/index.js +2 -1
- package/dist/components/SearchKit/SearchLoadMore/index.js +40 -0
- package/dist/components/SearchKit/SearchResults/index.js +24 -5
- package/dist/components/SearchKit/index.js +35 -11
- package/dist/components/SearchKit/stories.js +68 -2
- package/dist/components/WysiwygField/index.js +14 -2
- package/dist/components/WysiwygField/stories.js +34 -0
- package/dist/hooks/useOnScreen.js +11 -0
- package/dist/hooks/usePrevious.js +14 -0
- package/dist/hooks/useScrollPosition.js +17 -0
- package/dist/hooks/useWindowDimensions.js +25 -0
- package/dist/index.js +7 -1
- package/package.json +3 -21
- package/dist/pages/api/graphql.js +0 -25
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
|
|
4
|
+
const CheckboxAndRadio = ({
|
|
5
|
+
name,
|
|
6
|
+
id,
|
|
7
|
+
value,
|
|
8
|
+
label,
|
|
9
|
+
checked,
|
|
10
|
+
onChange,
|
|
11
|
+
disabled,
|
|
12
|
+
type
|
|
13
|
+
}) => {
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: "Checkbox"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
17
|
+
type: type || "checkbox",
|
|
18
|
+
className: "Checkbox__input",
|
|
19
|
+
name: name,
|
|
20
|
+
id: id,
|
|
21
|
+
value: value,
|
|
22
|
+
checked: checked,
|
|
23
|
+
onChange: onChange,
|
|
24
|
+
disabled: disabled
|
|
25
|
+
}), /*#__PURE__*/React.createElement("label", {
|
|
26
|
+
htmlFor: id,
|
|
27
|
+
className: "icon-before icon-checkmark"
|
|
28
|
+
}, label));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default CheckboxAndRadio;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@import 'assets/variables';
|
|
2
|
+
@import 'assets/mixins';
|
|
3
|
+
|
|
4
|
+
// Radio's and checkboxes
|
|
5
|
+
input[type='checkbox'],
|
|
6
|
+
input[type='radio'] {
|
|
7
|
+
position: absolute;
|
|
8
|
+
opacity: 0;
|
|
9
|
+
|
|
10
|
+
// Unchecked
|
|
11
|
+
~ label:not(.no-styling) {
|
|
12
|
+
position: relative;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
margin-bottom: 0;
|
|
15
|
+
font-weight: bold;
|
|
16
|
+
color: black;
|
|
17
|
+
user-select: none;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
|
|
23
|
+
&:before {
|
|
24
|
+
margin-right: 1rem;
|
|
25
|
+
font-size: 1.8rem;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Checked
|
|
30
|
+
&:checked ~ label:not(.no-styling) {
|
|
31
|
+
&:before {
|
|
32
|
+
|
|
33
|
+
background-position-y: -1em;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import useCookie from 'react-use-cookie';
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import Button from '../Button';
|
|
7
|
+
import Container from '../Layout/Container';
|
|
8
|
+
import Checkbox from './Checkbox';
|
|
9
|
+
import './style.scss';
|
|
10
|
+
|
|
11
|
+
const CookieCompliancePopup = props => {
|
|
12
|
+
const {
|
|
13
|
+
className,
|
|
14
|
+
cookieLevels,
|
|
15
|
+
children,
|
|
16
|
+
manualText,
|
|
17
|
+
agreeText,
|
|
18
|
+
onDisagree,
|
|
19
|
+
cookieOptions,
|
|
20
|
+
cookieDomain
|
|
21
|
+
} = props; // This is an internal state to check whether we should show the options.
|
|
22
|
+
|
|
23
|
+
const [manualChoiceVisible, setManualChoiceVisible] = useState(false); // This is an extra hidden variable to internally check if we should show the notification.
|
|
24
|
+
// This also allows us to add an animation when the user accepts.
|
|
25
|
+
|
|
26
|
+
const [hiddenInternal, setHiddenInternal] = useState(false); // Cookie stating if the cookie has already been accepted. Uses the following states:
|
|
27
|
+
// 0: Declined (Not yet used).
|
|
28
|
+
// 1: Not yet agreed/disagreed (Not yet used).
|
|
29
|
+
// 2: Accepted.
|
|
30
|
+
|
|
31
|
+
const [didConsent, setDidConsent] = useCookie('cookie-agreed', null); // Cookie stating whether we should render the notification.
|
|
32
|
+
|
|
33
|
+
const [hidden, setHidden] = useState(didConsent !== null); // Default choices for select, this way we can locally manage the state of the form.
|
|
34
|
+
|
|
35
|
+
const [choicesSelected, setChoicesSelected] = useState({
|
|
36
|
+
necessary: true,
|
|
37
|
+
voorkeuren: true,
|
|
38
|
+
statistieken: true,
|
|
39
|
+
marketing: true
|
|
40
|
+
});
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (hidden) {
|
|
43
|
+
setHiddenInternal(true);
|
|
44
|
+
} // We don't want to add hidden to the dependency list, as this would -
|
|
45
|
+
// unrender the notification immediately on save.
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
|
|
48
|
+
}, []); // Check if didConsent has been changed.
|
|
49
|
+
// If so, set the hidden cookie for page reloads.
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (didConsent !== null) {
|
|
53
|
+
setHidden(true);
|
|
54
|
+
}
|
|
55
|
+
}, [didConsent, cookieOptions, setHidden]); // This function expands the notification to show the options.
|
|
56
|
+
|
|
57
|
+
const displayConsentChoices = e => {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
setManualChoiceVisible(true);
|
|
60
|
+
}; // This function sets cookie-agreed to 2 ( accepted state ),
|
|
61
|
+
// and also sets the accepted categories in CookieAgreedCategories.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
const onAgree = choices => {
|
|
65
|
+
const selectedChoices = Object.keys(choices).filter(key => {
|
|
66
|
+
return choices[key];
|
|
67
|
+
});
|
|
68
|
+
Object.keys(choices).forEach(key => {
|
|
69
|
+
if (choicesSelected[key]) {
|
|
70
|
+
window.dataLayer = window.dataLayer || [];
|
|
71
|
+
window.dataLayer.push({
|
|
72
|
+
event: `cookies-accepted-${key}`
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
setDidConsent('2', cookieOptions); // I used js-cookie for this insead of react-use-cookie because the encoding is not what we want
|
|
77
|
+
// for arrays in react-use-cookie. This shouldn't be an issue, as we don't want to keep track of
|
|
78
|
+
// CookieAgreedCategories, as we have that in state already.
|
|
79
|
+
|
|
80
|
+
Cookies.set('cookie-agreed-categories', JSON.stringify(selectedChoices), {
|
|
81
|
+
expires: 365,
|
|
82
|
+
domain: cookieDomain
|
|
83
|
+
}); // Set cookie for current domain, so it does not appear twice.
|
|
84
|
+
|
|
85
|
+
const timestamp = Math.round(new Date().getTime() / 1000);
|
|
86
|
+
const value = {
|
|
87
|
+
necessary: true,
|
|
88
|
+
preferences: true,
|
|
89
|
+
statistics: true,
|
|
90
|
+
marketing: true,
|
|
91
|
+
ver: 1,
|
|
92
|
+
utc: timestamp,
|
|
93
|
+
region: 'nl'
|
|
94
|
+
};
|
|
95
|
+
Cookies.set('cookie-consent', value, {
|
|
96
|
+
expires: 365,
|
|
97
|
+
domain: cookieDomain
|
|
98
|
+
});
|
|
99
|
+
}; // This function is fired when the accept button is pressed.
|
|
100
|
+
// Also has eventual support for a false case.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
const onConsent = value => {
|
|
104
|
+
return () => {
|
|
105
|
+
if (value === true) {
|
|
106
|
+
onAgree(choicesSelected);
|
|
107
|
+
} else {
|
|
108
|
+
onDisagree();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}; // This function sets the value of the checkmark in the form state.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const handleChoiceState = event => {
|
|
115
|
+
const {
|
|
116
|
+
value,
|
|
117
|
+
checked
|
|
118
|
+
} = event.target;
|
|
119
|
+
setChoicesSelected({ ...choicesSelected,
|
|
120
|
+
[value]: checked
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const classes = classNames('Cookie', className, {
|
|
125
|
+
'Cookie--hidden': didConsent !== null
|
|
126
|
+
}); // If hiddenInternal is true, we do not render the notification.
|
|
127
|
+
|
|
128
|
+
if (hiddenInternal === true) {
|
|
129
|
+
return null;
|
|
130
|
+
} // This function renders the different options of checkboxes,
|
|
131
|
+
// allowing us to add more checkboxes eventually.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
const renderChoices = () => {
|
|
135
|
+
return cookieLevels.map(choice => {
|
|
136
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: "Cookie__category col-xs-12 col-lg-6",
|
|
138
|
+
key: choice.value
|
|
139
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
140
|
+
className: "Checkbox"
|
|
141
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
142
|
+
name: "cookie-categories",
|
|
143
|
+
type: "checkbox",
|
|
144
|
+
id: `cookie-category-${choice.value}`,
|
|
145
|
+
onChange: handleChoiceState,
|
|
146
|
+
label: choice.label,
|
|
147
|
+
value: choice.value,
|
|
148
|
+
checked: choicesSelected[choice.value],
|
|
149
|
+
disabled: choice.disabled
|
|
150
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: "Cookie__category__description"
|
|
152
|
+
}, choice.description));
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: classes
|
|
158
|
+
}, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: `Cookie__content ${manualChoiceVisible ? 'Cookie__content--full-height' : ''}`
|
|
160
|
+
}, !manualChoiceVisible ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: "row"
|
|
162
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
className: "col-12 Cookie__content__message"
|
|
164
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
className: "col-12 Cookie__content__buttons"
|
|
166
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
167
|
+
id: "complete-agree",
|
|
168
|
+
className: "Button--cta",
|
|
169
|
+
primary: true,
|
|
170
|
+
onClick: onConsent(true)
|
|
171
|
+
}, agreeText), /*#__PURE__*/React.createElement("a", {
|
|
172
|
+
className: "Cookie__content__buttons__manual-agree icon-after icon-chevron-right icon-variant-2",
|
|
173
|
+
onClick: e => {
|
|
174
|
+
displayConsentChoices(e);
|
|
175
|
+
}
|
|
176
|
+
}, manualText)))) : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
177
|
+
className: "Cookie__content__message"
|
|
178
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
className: "Cookie__checkboxes-container row"
|
|
180
|
+
}, renderChoices())), /*#__PURE__*/React.createElement("div", {
|
|
181
|
+
className: "Cookie__content__buttons"
|
|
182
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
183
|
+
className: "Button--cta",
|
|
184
|
+
onClick: onConsent(true)
|
|
185
|
+
}, agreeText))))));
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default CookieCompliancePopup;
|
|
189
|
+
CookieCompliancePopup.defaultProps = {
|
|
190
|
+
agreeText: 'Accepteren',
|
|
191
|
+
manualText: 'Zelf instellen',
|
|
192
|
+
onDisagree: () => {},
|
|
193
|
+
cookieLevels: [],
|
|
194
|
+
cookieDomain: null,
|
|
195
|
+
cookieOptions: {
|
|
196
|
+
days: 365,
|
|
197
|
+
path: '/'
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
CookieCompliancePopup.propTypes = {
|
|
201
|
+
agreeText: PropTypes.string,
|
|
202
|
+
manualText: PropTypes.string,
|
|
203
|
+
onDisagree: PropTypes.func,
|
|
204
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
205
|
+
cookieLevels: PropTypes.arrayOf(PropTypes.shape({
|
|
206
|
+
value: PropTypes.string,
|
|
207
|
+
label: PropTypes.string,
|
|
208
|
+
description: PropTypes.string,
|
|
209
|
+
disabled: PropTypes.bool
|
|
210
|
+
}))
|
|
211
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Cookie from './';
|
|
3
|
+
import './stories.scss';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Organisms/Cookie'
|
|
6
|
+
};
|
|
7
|
+
export const Default = () => /*#__PURE__*/React.createElement(Cookie, {
|
|
8
|
+
agreeText: 'Accepteren',
|
|
9
|
+
manualText: 'Zelf instellen',
|
|
10
|
+
onDisagree: () => {},
|
|
11
|
+
cookieLevels: [{
|
|
12
|
+
value: "necessary",
|
|
13
|
+
label: "Noodzakelijk",
|
|
14
|
+
description: "Noodzakelijke cookies helpen een website bruikbaarder te maken, door basisfuncties als paginanavigatie en toegang tot beveiligde gedeelten van de website mogelijk te maken. Zonder deze cookies kan de website niet naar behoren werken.",
|
|
15
|
+
disabled: true
|
|
16
|
+
}, {
|
|
17
|
+
value: "voorkeuren",
|
|
18
|
+
label: "Voorkeuren",
|
|
19
|
+
description: "Voorkeurscookies zorgen ervoor dat een website informatie kan onthouden die van invloed is op het gedrag en de vormgeving van de website, zoals de taal van uw voorkeur of de regio waar u woont.",
|
|
20
|
+
disabled: false
|
|
21
|
+
}, {
|
|
22
|
+
value: "statistieken",
|
|
23
|
+
label: "Statistieken",
|
|
24
|
+
description: "Statistische cookies helpen eigenaren van websites begrijpen hoe bezoekers hun website gebruiken, door anoniem gegevens te verzamelen en te rapporteren.",
|
|
25
|
+
disabled: false
|
|
26
|
+
}, {
|
|
27
|
+
value: "marketing",
|
|
28
|
+
label: "Marketing",
|
|
29
|
+
description: "Marketingcookies worden gebruikt om bezoekers te volgen wanneer ze verschillende websites bezoeken. Hun doel is advertenties weergeven die zijn toegesneden op en relevant zijn voor de individuele gebruiker. Deze advertenties worden zo waardevoller voor uitgevers en externe adverteerders.",
|
|
30
|
+
disabled: false
|
|
31
|
+
}]
|
|
32
|
+
}, /*#__PURE__*/React.createElement("h1", null, "Wij gebruiken cookies"), /*#__PURE__*/React.createElement("p", null, "Aliquam accumsan sem lacus, ut laoreet urna aliquam quis. Ut ut imperdiet tortor, sed vestibulum felis. Etiam a eleifend leo, eu interdum nulla. Etiam id elit ex. Etiam condimentum facilisis venenatis. Curabitur accumsan ut dui vel laoreet. Donec dapibus convallis diam, at sodales nulla laoreet ac. Nunc maximus, orci ac tristique dapibus, dolor felis semper lorem, eu dapibus turpis enim quis urna."));
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@import 'assets/variables';
|
|
2
|
+
@import 'assets/mixins';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@keyframes fade-out-and-transform {
|
|
6
|
+
0% {
|
|
7
|
+
transform: translateX(-50%) translateY(0px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
25% {
|
|
11
|
+
opacity: 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
75% {
|
|
15
|
+
opacity: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
100% {
|
|
19
|
+
transform: translateX(-50%) translateY(110%);
|
|
20
|
+
opacity: 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.Cookie {
|
|
25
|
+
bottom: 1rem;
|
|
26
|
+
|
|
27
|
+
@media #{$tablet} {
|
|
28
|
+
bottom: 3rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--hidden {
|
|
32
|
+
animation-name: fade-out-and-transform;
|
|
33
|
+
animation-duration: .6s;
|
|
34
|
+
animation-timing-function: cubic-bezier(0.32, 0, 0.67, 0);
|
|
35
|
+
animation-fill-mode: forwards;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__content {
|
|
39
|
+
background: #F4F4F4;
|
|
40
|
+
padding: 2rem;
|
|
41
|
+
border-radius: 10px;
|
|
42
|
+
margin-bottom: 10px;
|
|
43
|
+
width: 100%;
|
|
44
|
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
|
|
45
|
+
|
|
46
|
+
@media #{$tablet-down} {
|
|
47
|
+
width: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media #{$tablet} {
|
|
51
|
+
padding: 4rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__full-height {
|
|
55
|
+
overflow-y: scroll;
|
|
56
|
+
|
|
57
|
+
@media #{$mobile-down} {
|
|
58
|
+
position: fixed;
|
|
59
|
+
top: 2rem;
|
|
60
|
+
bottom: 2rem;
|
|
61
|
+
right: 2rem;
|
|
62
|
+
left: 2rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media #{$normal} {
|
|
66
|
+
height: auto;
|
|
67
|
+
overflow-y: unset;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@import 'assets/variables';
|
|
2
|
+
@import 'assets/mixins';
|
|
3
|
+
|
|
4
|
+
.Cookie {
|
|
5
|
+
width: 100%;
|
|
6
|
+
position: fixed;
|
|
7
|
+
left: 50%;
|
|
8
|
+
max-height: 100%;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
transform: translateX(-50%);
|
|
11
|
+
z-index: 10000;
|
|
12
|
+
|
|
13
|
+
&--hidden {
|
|
14
|
+
&__content__full-height {
|
|
15
|
+
position: inherit;
|
|
16
|
+
top: inherit;
|
|
17
|
+
bottom: inherit;
|
|
18
|
+
right: inherit;
|
|
19
|
+
left: inherit;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__content {
|
|
24
|
+
max-height: 100vh;
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
|
|
27
|
+
&__full-height {
|
|
28
|
+
overflow-y: scroll;
|
|
29
|
+
|
|
30
|
+
@media #{$normal} {
|
|
31
|
+
height: auto;
|
|
32
|
+
overflow-y: unset;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__buttons {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
|
|
41
|
+
@media #{$tablet} {
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.Button {
|
|
46
|
+
margin-right: 1rem;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__category {
|
|
52
|
+
display: inline-block;
|
|
53
|
+
margin-bottom: 2rem;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useMemo, useState, useEffect } from 'react';
|
|
2
2
|
import { gql, useQuery } from '@apollo/client';
|
|
3
3
|
import { useSearchkitVariables } from '@searchkit/client';
|
|
4
4
|
import SearchPage from '../SearchPage';
|
|
@@ -21,13 +21,21 @@ function Query({
|
|
|
21
21
|
loading
|
|
22
22
|
} = useQuery(graphQuery, {
|
|
23
23
|
variables
|
|
24
|
-
});
|
|
24
|
+
}); // In between searches, Searchkit will empty it's results, resulting
|
|
25
|
+
// in a re-render with an empty screen. Use a local state to prevent this.
|
|
26
|
+
|
|
27
|
+
const [dataLoaded, setDataLoaded] = useState(null);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (data) {
|
|
30
|
+
setDataLoaded(data);
|
|
31
|
+
}
|
|
32
|
+
}, [data]);
|
|
25
33
|
|
|
26
34
|
if (!useRouting) {
|
|
27
|
-
return /*#__PURE__*/React.createElement("div", null, children(
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", null, children(dataLoaded, loading));
|
|
28
36
|
}
|
|
29
37
|
|
|
30
|
-
return /*#__PURE__*/React.createElement(SearchPage, null, children(
|
|
38
|
+
return /*#__PURE__*/React.createElement(SearchPage, null, children(dataLoaded, loading));
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
export default Query;
|
|
@@ -26,7 +26,8 @@ const SearchField = ({
|
|
|
26
26
|
initialValues: {
|
|
27
27
|
query: query
|
|
28
28
|
},
|
|
29
|
-
displayRequiredIndicator: "required"
|
|
29
|
+
displayRequiredIndicator: "required",
|
|
30
|
+
enableReinitialize: true
|
|
30
31
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
31
32
|
fieldName: "query",
|
|
32
33
|
title: "Search",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSearchkit } from '@searchkit/client';
|
|
3
|
+
import Button from '../../Button';
|
|
4
|
+
|
|
5
|
+
const SearchLoadMore = ({
|
|
6
|
+
data,
|
|
7
|
+
label,
|
|
8
|
+
className
|
|
9
|
+
}) => {
|
|
10
|
+
const api = useSearchkit();
|
|
11
|
+
|
|
12
|
+
if (!data) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const setNextPage = () => {
|
|
17
|
+
if (data) {
|
|
18
|
+
api.setPage({
|
|
19
|
+
size: data.results.hits.page.size,
|
|
20
|
+
from: parseInt(data.results.hits.page.size) * (parseInt(data.results.hits.page.pageNumber) + 1)
|
|
21
|
+
});
|
|
22
|
+
api.search();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const currentPage = data.results.hits.page.pageNumber;
|
|
27
|
+
const lastPage = data.results.hits.page.totalPages;
|
|
28
|
+
|
|
29
|
+
if (currentPage + 1 >= lastPage) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: className
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
36
|
+
onClick: setNextPage
|
|
37
|
+
}, label));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default SearchLoadMore;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import usePrevious from '../../../hooks/usePrevious';
|
|
2
3
|
|
|
3
4
|
const SearchResultItemDefault = ({
|
|
4
5
|
item
|
|
@@ -11,17 +12,35 @@ const SearchResultHeaderDefault = ({
|
|
|
11
12
|
const SearchResults = ({
|
|
12
13
|
data,
|
|
13
14
|
renderItem,
|
|
14
|
-
renderHeader
|
|
15
|
+
renderHeader,
|
|
16
|
+
appendResults = false
|
|
15
17
|
}) => {
|
|
16
18
|
const SearchResultItem = renderItem || SearchResultItemDefault;
|
|
17
19
|
const SearchResultHeader = renderHeader || SearchResultHeaderDefault;
|
|
20
|
+
const [items, setItems] = useState([]);
|
|
21
|
+
const [currentPage, setCurrentPage] = useState(-1);
|
|
22
|
+
const previousPage = usePrevious(currentPage);
|
|
23
|
+
const previousItems = usePrevious(items);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!appendResults) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (data && previousPage !== undefined && data.results.hits.page.pageNumber !== previousPage) {
|
|
30
|
+
setItems([...previousItems, ...data.results.hits.items]);
|
|
31
|
+
setCurrentPage(data.results.hits.page.pageNumber);
|
|
32
|
+
}
|
|
33
|
+
}, [data, previousPage, previousItems, appendResults]);
|
|
34
|
+
const searchResultItems = appendResults ? data && items.map(item => /*#__PURE__*/React.createElement(SearchResultItem, {
|
|
35
|
+
item: item
|
|
36
|
+
})) : data && data.results.hits.items.map(item => /*#__PURE__*/React.createElement(SearchResultItem, {
|
|
37
|
+
item: item
|
|
38
|
+
}));
|
|
18
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
19
40
|
className: "SearchResults"
|
|
20
41
|
}, data && /*#__PURE__*/React.createElement(SearchResultHeader, {
|
|
21
42
|
data: data
|
|
22
|
-
}),
|
|
23
|
-
item: item
|
|
24
|
-
})));
|
|
43
|
+
}), searchResultItems);
|
|
25
44
|
};
|
|
26
45
|
|
|
27
46
|
export default SearchResults;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState, useMemo } from 'react';
|
|
2
2
|
import Query from './Query';
|
|
3
3
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
4
4
|
import { SearchkitProvider, SearchkitClient } from '@searchkit/client';
|
|
@@ -24,19 +24,39 @@ const defaultChildren = (data, loading) => /*#__PURE__*/React.createElement(Reac
|
|
|
24
24
|
const SearchKit = ({
|
|
25
25
|
query,
|
|
26
26
|
uri,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
pageSize = 10,
|
|
28
|
+
useRouting = true,
|
|
29
|
+
defaultFilters = [],
|
|
30
|
+
defaultQuery = '',
|
|
31
|
+
children
|
|
30
32
|
}) => {
|
|
31
|
-
const client =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const client = useMemo(() => {
|
|
34
|
+
return new ApolloClient({
|
|
35
|
+
uri: uri,
|
|
36
|
+
cache: new InMemoryCache()
|
|
37
|
+
});
|
|
38
|
+
}, [uri]);
|
|
39
|
+
const skClient = useMemo(() => {
|
|
40
|
+
const skClient = new SearchkitClient();
|
|
41
|
+
|
|
42
|
+
if (!useRouting) {
|
|
43
|
+
skClient.updateBaseSearchState({
|
|
44
|
+
filters: defaultFilters,
|
|
45
|
+
query: defaultQuery,
|
|
46
|
+
page: {
|
|
47
|
+
size: pageSize,
|
|
48
|
+
from: 0
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return skClient;
|
|
54
|
+
}, [useRouting, defaultFilters, defaultQuery, pageSize]);
|
|
36
55
|
return /*#__PURE__*/React.createElement(ApolloProvider, {
|
|
37
56
|
client: client
|
|
38
57
|
}, /*#__PURE__*/React.createElement(SearchkitProvider, {
|
|
39
|
-
client: skClient
|
|
58
|
+
client: skClient,
|
|
59
|
+
key: `${defaultQuery}-${defaultFilters.toString()}`
|
|
40
60
|
}, /*#__PURE__*/React.createElement(Query, {
|
|
41
61
|
query: query,
|
|
42
62
|
useRouting: useRouting
|
|
@@ -45,6 +65,10 @@ const SearchKit = ({
|
|
|
45
65
|
|
|
46
66
|
SearchKit.propTypes = {
|
|
47
67
|
queryString: PropTypes.string,
|
|
48
|
-
uri: PropTypes.string
|
|
68
|
+
uri: PropTypes.string,
|
|
69
|
+
pageSize: PropTypes.number,
|
|
70
|
+
useRouting: PropTypes.bool,
|
|
71
|
+
defaultFilters: PropTypes.object,
|
|
72
|
+
defaultQuery: PropTypes.string
|
|
49
73
|
};
|
|
50
74
|
export default SearchKit;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { useSearchkit } from '@searchkit/client';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import SearchKit from '.';
|
|
@@ -9,6 +9,7 @@ import SearchFacets from './SearchFacets';
|
|
|
9
9
|
import SearchSelectedFilters from './SearchSelectedFilters';
|
|
10
10
|
import SearchReset from './SearchReset';
|
|
11
11
|
import SearchSorting from './SearchSorting';
|
|
12
|
+
import SearchLoadMore from './SearchLoadMore';
|
|
12
13
|
export default {
|
|
13
14
|
title: 'Molecules/SearchKit'
|
|
14
15
|
};
|
|
@@ -46,7 +47,7 @@ const query = `
|
|
|
46
47
|
}
|
|
47
48
|
query
|
|
48
49
|
}
|
|
49
|
-
hits(page: $page
|
|
50
|
+
hits(page: $page) {
|
|
50
51
|
sortedBy
|
|
51
52
|
page {
|
|
52
53
|
total
|
|
@@ -178,4 +179,69 @@ export const CustomFacets = () => {
|
|
|
178
179
|
}), /*#__PURE__*/React.createElement(SearchPagination, {
|
|
179
180
|
data: data
|
|
180
181
|
})));
|
|
182
|
+
};
|
|
183
|
+
export const Test = () => {
|
|
184
|
+
const [q, setQ] = useState(null);
|
|
185
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", {
|
|
186
|
+
onChange: e => setQ(e.target.value),
|
|
187
|
+
value: q
|
|
188
|
+
}), /*#__PURE__*/React.createElement(SearchKit, {
|
|
189
|
+
uri: "http://localhost:4000/api/graphql",
|
|
190
|
+
query: query,
|
|
191
|
+
useRouting: false,
|
|
192
|
+
filters: [{
|
|
193
|
+
identifier: 'type',
|
|
194
|
+
value: 'article'
|
|
195
|
+
}],
|
|
196
|
+
searchQuery: q
|
|
197
|
+
}, (data, loading) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchResults, {
|
|
198
|
+
data: data,
|
|
199
|
+
renderItem: SearchItem,
|
|
200
|
+
renderHeader: SearchHeader
|
|
201
|
+
}), /*#__PURE__*/React.createElement(SearchPagination, {
|
|
202
|
+
data: data
|
|
203
|
+
}))), /*#__PURE__*/React.createElement(SearchKit, {
|
|
204
|
+
uri: "http://localhost:4000/api/graphql",
|
|
205
|
+
query: query,
|
|
206
|
+
useRouting: false,
|
|
207
|
+
filters: [{
|
|
208
|
+
identifier: 'type',
|
|
209
|
+
value: 'landing_page'
|
|
210
|
+
}],
|
|
211
|
+
searchQuery: q
|
|
212
|
+
}, (data, loading) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchResults, {
|
|
213
|
+
data: data,
|
|
214
|
+
renderItem: SearchItem,
|
|
215
|
+
renderHeader: SearchHeader
|
|
216
|
+
}), /*#__PURE__*/React.createElement(SearchPagination, {
|
|
217
|
+
data: data
|
|
218
|
+
}))));
|
|
219
|
+
};
|
|
220
|
+
export const LoadMore = () => {
|
|
221
|
+
const api = useSearchkit();
|
|
222
|
+
return /*#__PURE__*/React.createElement(SearchKit, {
|
|
223
|
+
uri: "http://localhost:4000/api/graphql",
|
|
224
|
+
query: query // useRouting={false}
|
|
225
|
+
,
|
|
226
|
+
pageSize: 5
|
|
227
|
+
}, (data, loading) => {
|
|
228
|
+
const toggleFilter = () => {
|
|
229
|
+
api.toggleFilter({
|
|
230
|
+
identifier: "type",
|
|
231
|
+
value: "22"
|
|
232
|
+
});
|
|
233
|
+
api.search();
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
237
|
+
onClick: toggleFilter
|
|
238
|
+
}, "Toggle"), /*#__PURE__*/React.createElement(SearchResults, {
|
|
239
|
+
data: data,
|
|
240
|
+
renderItem: SearchItem,
|
|
241
|
+
renderHeader: SearchHeader,
|
|
242
|
+
append: true
|
|
243
|
+
}), /*#__PURE__*/React.createElement(SearchLoadMore, {
|
|
244
|
+
data: data
|
|
245
|
+
}));
|
|
246
|
+
});
|
|
181
247
|
};
|
|
@@ -7,10 +7,17 @@ import Button from '../Button';
|
|
|
7
7
|
|
|
8
8
|
const WysiwygField = ({
|
|
9
9
|
html,
|
|
10
|
+
customElementHandler,
|
|
10
11
|
...props
|
|
11
12
|
}) => {
|
|
12
13
|
const parsedHtml = ReactHtmlParser(html, {
|
|
13
14
|
transform: node => {
|
|
15
|
+
const customHandler = customElementHandler(node);
|
|
16
|
+
|
|
17
|
+
if (customHandler) {
|
|
18
|
+
return customHandler;
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
switch (node.name) {
|
|
15
22
|
case 'a':
|
|
16
23
|
{
|
|
@@ -42,7 +49,12 @@ const WysiwygField = ({
|
|
|
42
49
|
}, props), parsedHtml);
|
|
43
50
|
};
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
html: PropTypes.string.isRequired
|
|
52
|
+
WysiwygField.propTypes = {
|
|
53
|
+
html: PropTypes.string.isRequired,
|
|
54
|
+
customElementHandler: PropTypes.func
|
|
55
|
+
};
|
|
56
|
+
WysiwygField.defaultProps = {
|
|
57
|
+
html: '',
|
|
58
|
+
customElementHandler: () => {}
|
|
47
59
|
};
|
|
48
60
|
export default WysiwygField;
|
|
@@ -6,4 +6,38 @@ export default {
|
|
|
6
6
|
const html = "<p>This is <em>some</em> example <a href='https://www.uncinc.nl'>HTML</a>.</p>";
|
|
7
7
|
export const Primary = () => /*#__PURE__*/React.createElement(WysiwygField, {
|
|
8
8
|
html: html
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const Abbr = ({
|
|
12
|
+
title,
|
|
13
|
+
children
|
|
14
|
+
}) => {
|
|
15
|
+
return /*#__PURE__*/React.createElement("abbr", {
|
|
16
|
+
title: title
|
|
17
|
+
}, children);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const htmlCustomHandler = `
|
|
21
|
+
<p>Lorem ipsum dolor sit amet, <abbr title="Ut ut tellus et augue feugiat sollicitudin sit amet viverra nisi.">consectetur adipiscing</abbr> elit. Aliquam in sodales tellus. Ut ut tellus et augue feugiat sollicitudin sit amet viverra nisi. Nulla malesuada erat non massa pellentesque, ut ultricies tellus sodales. Fusce ac feugiat ligula. In vel metus diam. Maecenas diam ex, tincidunt tempor nibh sed, suscipit semper lectus. Sed eu enim vel erat tempus mollis. Integer eget gravida orci. Nunc volutpat velit id dui semper tincidunt. Nulla maximus nisl nec volutpat faucibus. Integer vitae ullamcorper ex. Vestibulum facilisis convallis arcu, ac interdum libero malesuada eget.</p>
|
|
22
|
+
<p>Donec feugiat, nunc vitae euismod posuere, urna nisl elementum nibh, quis ultricies libero leo sed neque. Praesent vel vestibulum sem, eget congue purus. Nunc non volutpat urna, vitae ullamcorper justo. Suspendisse in tortor ex. Phasellus euismod eget neque vitae consequat. Vestibulum sem mi, dictum id consectetur at, hendrerit in massa. Mauris quis sem condimentum, condimentum enim sed, varius sem. Curabitur convallis tempus nulla, eget consectetur quam sagittis at. Nulla a feugiat tortor. Mauris fermentum lectus ac mauris cursus ornare.</p>
|
|
23
|
+
<p>Nam venenatis est eget lorem laoreet, id tempor urna hendrerit. Quisque suscipit in magna nec condimentum. Duis id tempor nisi. Sed rutrum urna elit, vitae placerat enim volutpat nec. Vivamus volutpat, magna sit amet commodo ultricies, enim turpis pretium libero, quis molestie nibh augue a ex. Nulla vestibulum vestibulum tellus, vel molestie libero vehicula nec. Sed maximus tortor vel ipsum cursus egestas. Proin suscipit tortor id luctus bibendum.</p>
|
|
24
|
+
`;
|
|
25
|
+
export const CustomHandlers = () => /*#__PURE__*/React.createElement(WysiwygField, {
|
|
26
|
+
html: htmlCustomHandler,
|
|
27
|
+
customElementHandler: element => {
|
|
28
|
+
switch (element.name) {
|
|
29
|
+
case 'abbr':
|
|
30
|
+
{
|
|
31
|
+
console.log(element);
|
|
32
|
+
return /*#__PURE__*/React.createElement(Abbr, {
|
|
33
|
+
title: element.attribs.title
|
|
34
|
+
}, element.children[0].data);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
default:
|
|
38
|
+
{
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
9
43
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
export default function useOnScreen(ref) {
|
|
3
|
+
const [isIntersecting, setIntersecting] = useState(false);
|
|
4
|
+
const observer = new IntersectionObserver(([entry]) => setIntersecting(entry.isIntersecting));
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
observer.observe(ref.current); // Remove the observer as soon as the component is unmounted
|
|
7
|
+
|
|
8
|
+
return () => observer.disconnect();
|
|
9
|
+
}, [observer, ref]);
|
|
10
|
+
return isIntersecting;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
export default function usePrevious(value) {
|
|
3
|
+
// The ref object is a generic container whose current property is mutable ...
|
|
4
|
+
// ... and can hold any value, similar to an instance property on a class
|
|
5
|
+
const ref = useRef(); // Store current value in ref
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}, [value]); // Only re-run if value changes
|
|
10
|
+
// Return previous value (happens before update in useEffect above)
|
|
11
|
+
|
|
12
|
+
return ref.current;
|
|
13
|
+
}
|
|
14
|
+
;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const useScrollPosition = () => {
|
|
4
|
+
const [scrollPosition, setScrollPosition] = useState(0);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const updatePosition = () => {
|
|
7
|
+
setScrollPosition(window.pageYOffset);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
window.addEventListener('scroll', updatePosition);
|
|
11
|
+
updatePosition();
|
|
12
|
+
return () => window.removeEventListener('scroll', updatePosition);
|
|
13
|
+
}, []);
|
|
14
|
+
return scrollPosition;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default useScrollPosition;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function getWindowDimensions() {
|
|
4
|
+
const {
|
|
5
|
+
innerWidth: width,
|
|
6
|
+
innerHeight: height
|
|
7
|
+
} = window;
|
|
8
|
+
return {
|
|
9
|
+
width,
|
|
10
|
+
height
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function useWindowDimensions() {
|
|
15
|
+
const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
function handleResize() {
|
|
18
|
+
setWindowDimensions(getWindowDimensions());
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
window.addEventListener('resize', handleResize);
|
|
22
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
23
|
+
}, []);
|
|
24
|
+
return windowDimensions;
|
|
25
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -42,4 +42,10 @@ export { default as SearchSelectedFilters } from './components/SearchKit/SearchS
|
|
|
42
42
|
export { default as SearchSorting } from './components/SearchKit/SearchSorting';
|
|
43
43
|
export { default as SearchReset } from './components/SearchKit/SearchReset';
|
|
44
44
|
export { default as SearchResults } from './components/SearchKit/SearchResults';
|
|
45
|
-
export { default as SearchPagination } from './components/SearchKit/SearchPagination';
|
|
45
|
+
export { default as SearchPagination } from './components/SearchKit/SearchPagination';
|
|
46
|
+
export { default as SearchLoadMore } from './components/SearchKit/SearchLoadMore';
|
|
47
|
+
export { default as Cookie } from './components/Cookie';
|
|
48
|
+
export { default as useOnScreen } from './hooks/useOnScreen';
|
|
49
|
+
export { default as usePrevious } from './hooks/usePrevious';
|
|
50
|
+
export { default as useScrollPosition } from './hooks/useScrollPosition';
|
|
51
|
+
export { default as useWindowDimensions } from './hooks/useWindowDimensions';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uncinc/uncinc-react-kitchen-sink",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Default React components that are easily extended.",
|
|
5
5
|
"author": "uncinc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,34 +35,18 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@apollo/client": "^3.4.16",
|
|
38
|
-
"@babel/cli": "^7.0.0-beta.44",
|
|
39
|
-
"@babel/helper-define-map": "^7.14.5",
|
|
40
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
41
|
-
"@babel/runtime": "^7.9.6",
|
|
42
38
|
"@elastic/datemath": "^5.0.3",
|
|
43
39
|
"@elastic/eui": "^40.0.0",
|
|
44
40
|
"@loadable/component": "^5.15.0",
|
|
45
41
|
"@searchkit/client": "^3.0.0-canary.45",
|
|
46
42
|
"@searchkit/elastic-ui": "^3.0.0-canary.45",
|
|
47
|
-
"@storybook/addon-actions": "^6.2.8",
|
|
48
|
-
"@storybook/addon-info": "^5.3.21",
|
|
49
|
-
"@storybook/addon-links": "^6.2.8",
|
|
50
|
-
"@storybook/addons": "^6.2.8",
|
|
51
|
-
"@storybook/react": "^6.2.8",
|
|
52
|
-
"@storybook/theming": "^6.2.8",
|
|
53
|
-
"@testing-library/jest-dom": "^4.2.4",
|
|
54
|
-
"@testing-library/react": "^9.3.2",
|
|
55
|
-
"@testing-library/user-event": "^7.1.2",
|
|
56
43
|
"apollo-server-micro": "^3.4.0",
|
|
57
44
|
"bootstrap": "^4.3.1",
|
|
58
|
-
"chai": "^4.2.0",
|
|
59
|
-
"cross-env": "^7.0.2",
|
|
60
|
-
"enzyme": "^3.11.0",
|
|
61
|
-
"enzyme-adapter-react-16": "^1.15.2",
|
|
62
45
|
"fork-ts-checker-webpack-plugin-alt": "0.4.14",
|
|
63
46
|
"formik": "^2.2.6",
|
|
64
47
|
"graphql": "^15.7.0",
|
|
65
48
|
"immutable": "^4.0.0-rc.15",
|
|
49
|
+
"js-cookie": "^3.0.1",
|
|
66
50
|
"lottie-web": "^5.7.7",
|
|
67
51
|
"mini-css-extract-plugin": "^1.4.1",
|
|
68
52
|
"moment": "^2.29.1",
|
|
@@ -84,11 +68,10 @@
|
|
|
84
68
|
"react-redux": "^7.2.4",
|
|
85
69
|
"react-router": "5.2.0",
|
|
86
70
|
"react-router-dom": "5.2.0",
|
|
87
|
-
"react-scripts": "3.4.1",
|
|
88
71
|
"react-select": "^3.1.0",
|
|
89
72
|
"react-share": "^4.3.1",
|
|
90
73
|
"react-slick": "^0.27.14",
|
|
91
|
-
"react-
|
|
74
|
+
"react-use-cookie": "^1.3.0",
|
|
92
75
|
"redux": "^4.0.5",
|
|
93
76
|
"sass-loader": "^8.0.2",
|
|
94
77
|
"slick-carousel": "^1.8.1"
|
|
@@ -115,7 +98,6 @@
|
|
|
115
98
|
"react-test-renderer": "^16.13.1",
|
|
116
99
|
"sinon": "^9.0.2",
|
|
117
100
|
"sinon-chai": "^3.5.0",
|
|
118
|
-
"slick-carousel": "^1.8.1",
|
|
119
101
|
"storybook-addon-export-stories": "^1.0.0"
|
|
120
102
|
},
|
|
121
103
|
"eslintConfig": {
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ApolloServer, gql } from 'apollo-server-micro';
|
|
2
|
-
export const config = {
|
|
3
|
-
api: {
|
|
4
|
-
bodyParser: false
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
const typeDefs = [gql`
|
|
8
|
-
type Query {
|
|
9
|
-
root: String
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type Mutation {
|
|
13
|
-
root: String
|
|
14
|
-
}
|
|
15
|
-
`];
|
|
16
|
-
const server = new ApolloServer({
|
|
17
|
-
typeDefs,
|
|
18
|
-
resolvers: {},
|
|
19
|
-
introspection: true,
|
|
20
|
-
playground: true,
|
|
21
|
-
context: {}
|
|
22
|
-
});
|
|
23
|
-
export default server.createHandler({
|
|
24
|
-
path: '/api/graphql'
|
|
25
|
-
});
|