@mrfylke/contact-form 0.1.5 → 0.1.8
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 +17 -0
- package/lib/components/button/button.module.css +151 -139
- package/lib/components/checkbox/checkbox.module.css +40 -37
- package/lib/components/error-message/error-message.module.css +2 -2
- package/lib/components/external-link-page.module.css +15 -15
- package/lib/components/form/fieldset/fieldset.module.css +15 -15
- package/lib/components/form/form-component-label/form-component-label.module.css +4 -4
- package/lib/components/form/form.module.css +324 -308
- package/lib/components/loading/loading.module.css +9 -9
- package/lib/components/section-card/section-card.module.css +10 -10
- package/lib/contact.module.css +37 -36
- package/lib/error-content/error-content.module.css +7 -7
- package/lib/layouts/container.module.css +10 -10
- package/lib/layouts/layout.module.css +46 -45
- package/lib/modules/config/types.d.ts +2 -32
- package/lib/modules/config/types.d.ts.map +1 -1
- package/lib/modules/transport-mode/filter/filter.module.css +51 -49
- package/lib/modules/transport-mode/icon/icon.module.css +14 -14
- package/lib/success-content/success-content.module.css +7 -7
- package/lib/translations/components/index.d.ts +0 -10
- package/lib/translations/components/index.d.ts.map +1 -1
- package/lib/translations/components/index.js +1 -21
- package/lib/translations/index.d.ts +0 -1
- package/lib/translations/index.d.ts.map +1 -1
- package/lib/translations/index.js +1 -2
- package/lib/translations/json-to-override.d.ts.map +1 -1
- package/lib/translations/json-to-override.js +0 -6
- package/lib/translations/merge-overrides.d.ts +0 -2
- package/lib/translations/merge-overrides.d.ts.map +1 -1
- package/lib/translations/merge-overrides.js +0 -4
- package/lib/translations/pages/index.d.ts +0 -1
- package/lib/translations/pages/index.d.ts.map +1 -1
- package/lib/translations/pages/index.js +1 -3
- package/lib/translations/types.d.ts +0 -2
- package/lib/translations/types.d.ts.map +1 -1
- package/package.json +2 -3
- package/lib/layouts/contact-form-footer.d.ts +0 -5
- package/lib/layouts/contact-form-footer.d.ts.map +0 -1
- package/lib/layouts/contact-form-footer.js +0 -75
- package/lib/layouts/contact-form-header.d.ts +0 -9
- package/lib/layouts/contact-form-header.d.ts.map +0 -1
- package/lib/layouts/contact-form-header.js +0 -50
- package/lib/layouts/footer.module.css +0 -109
- package/lib/layouts/header.module.css +0 -39
- package/lib/translations/components/clear-button.d.ts +0 -4
- package/lib/translations/components/clear-button.d.ts.map +0 -1
- package/lib/translations/components/clear-button.js +0 -7
- package/lib/translations/components/departure-date-selector.d.ts +0 -8
- package/lib/translations/components/departure-date-selector.d.ts.map +0 -1
- package/lib/translations/components/departure-date-selector.js +0 -11
- package/lib/translations/components/departure-time.d.ts +0 -8
- package/lib/translations/components/departure-time.d.ts.map +0 -1
- package/lib/translations/components/departure-time.js +0 -11
- package/lib/translations/components/empty-search.d.ts +0 -18
- package/lib/translations/components/empty-search.d.ts.map +0 -1
- package/lib/translations/components/empty-search.js +0 -21
- package/lib/translations/components/geolocation-button.d.ts +0 -10
- package/lib/translations/components/geolocation-button.d.ts.map +0 -1
- package/lib/translations/components/geolocation-button.js +0 -13
- package/lib/translations/components/map.d.ts +0 -19
- package/lib/translations/components/map.d.ts.map +0 -1
- package/lib/translations/components/map.js +0 -22
- package/lib/translations/components/search.d.ts +0 -9
- package/lib/translations/components/search.d.ts.map +0 -1
- package/lib/translations/components/search.js +0 -12
- package/lib/translations/components/swap-button.d.ts +0 -4
- package/lib/translations/components/swap-button.d.ts.map +0 -1
- package/lib/translations/components/swap-button.js +0 -7
- package/lib/translations/components/tab-link.d.ts +0 -5
- package/lib/translations/components/tab-link.d.ts.map +0 -1
- package/lib/translations/components/tab-link.js +0 -8
- package/lib/translations/components/venue-icon.d.ts +0 -9
- package/lib/translations/components/venue-icon.d.ts.map +0 -1
- package/lib/translations/components/venue-icon.js +0 -12
- package/lib/translations/dictionary.d.ts +0 -33
- package/lib/translations/dictionary.d.ts.map +0 -1
- package/lib/translations/dictionary.js +0 -59
- package/lib/translations/modules/index.d.ts +0 -4
- package/lib/translations/modules/index.d.ts.map +0 -1
- package/lib/translations/modules/index.js +0 -9
- package/lib/translations/modules/layout.d.ts +0 -73
- package/lib/translations/modules/layout.d.ts.map +0 -1
- package/lib/translations/modules/layout.js +0 -106
- package/lib/translations/modules/search-time.d.ts +0 -8
- package/lib/translations/modules/search-time.d.ts.map +0 -1
- package/lib/translations/modules/search-time.js +0 -11
- package/lib/translations/modules/situation.d.ts +0 -8
- package/lib/translations/modules/situation.d.ts.map +0 -1
- package/lib/translations/modules/situation.js +0 -11
- package/lib/translations/pages/departures.d.ts +0 -64
- package/lib/translations/pages/departures.d.ts.map +0 -1
- package/lib/translations/pages/departures.js +0 -75
- package/lib/utils/env.d.ts +0 -10
- package/lib/utils/env.d.ts.map +0 -1
- package/lib/utils/env.js +0 -49
- package/lib/utils/presence.d.ts +0 -2
- package/lib/utils/presence.d.ts.map +0 -1
- package/lib/utils/presence.js +0 -5
- package/lib/utils/use-debounce.d.ts +0 -3
- package/lib/utils/use-debounce.d.ts.map +0 -1
- package/lib/utils/use-debounce.js +0 -14
- package/lib/utils/use-localstorage.d.ts +0 -2
- package/lib/utils/use-localstorage.d.ts.map +0 -1
- package/lib/utils/use-localstorage.js +0 -40
- package/lib/utils/user-media-query.d.ts +0 -2
- package/lib/utils/user-media-query.d.ts.map +0 -1
- package/lib/utils/user-media-query.js +0 -36
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Departures = void 0;
|
|
4
|
-
const commons_1 = require("../../translations/commons");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const DeparturesInternal = {
|
|
7
|
-
title: (0, commons_1.translation)('Se avganger', 'See departures', 'Sjå avgangar'),
|
|
8
|
-
titleAddress: (place) => (0, commons_1.translation)(`Stopp nært ${place}`, `Stops near ${place}`, `Stopp nær ${place}`),
|
|
9
|
-
titleStopp: (place) => (0, commons_1.translation)(`Avganger fra ${place}`, `Departures from ${place}`, `Avganger frå ${place}`),
|
|
10
|
-
homeLink: (name) => (0, commons_1.translation)(`Tilbake til ${name}`, `Back to ${name}`, `Tilbake til ${name}`),
|
|
11
|
-
shortTitle: (0, commons_1.translation)('Avganger', 'Departures', 'Avganger'),
|
|
12
|
-
search: {
|
|
13
|
-
input: {
|
|
14
|
-
label: (0, commons_1.translation)('Hvor vil du reise fra?', 'Where do you want to travel from?', 'Kor vil du reise frå?'),
|
|
15
|
-
from: (0, commons_1.translation)('Fra', 'From', 'Frå'),
|
|
16
|
-
placeholder: (0, commons_1.translation)('Sted eller adresse', 'Place or address', 'Stad eller adresse'),
|
|
17
|
-
},
|
|
18
|
-
date: {
|
|
19
|
-
label: (0, commons_1.translation)('Når vil du reise?', 'When do you want to travel?', 'Når vil du reise?'),
|
|
20
|
-
},
|
|
21
|
-
buttons: {
|
|
22
|
-
find: {
|
|
23
|
-
title: (0, commons_1.translation)('Finn avganger', 'Find departures', 'Finn avgangar'),
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
nearest: {
|
|
28
|
-
stopPlaceItem: {
|
|
29
|
-
stopPlace: (0, commons_1.translation)('Holdeplass', 'Stop', 'Haldeplass'),
|
|
30
|
-
uuTitle: (name, distance) => (0, commons_1.translation)(`Holdeplass ${name}. ${distance} meter gåavstand.`, `Stop place ${name}. ${distance} meters walking distance`, `Holdeplass ${name}. ${distance} meter gåavstand`),
|
|
31
|
-
},
|
|
32
|
-
resultsFound: (count) => (0, commons_1.translation)(`Fant ${count} holdeplasser i nærheten`, `Found ${count} stop places nearby`, `Fann ${count} holdeplassar i nærleiken`),
|
|
33
|
-
emptySearchResults: {
|
|
34
|
-
emptyNearbyLocationsTitle: (0, commons_1.translation)('Finner ingen holdeplasser i nærheten', 'No nearby stop places found', 'Finn ingen haldeplassar i nærleiken'),
|
|
35
|
-
emptyNearbyLocationsDetails: (0, commons_1.translation)('Prøv å søke på et annet navn eller bruk et annet stoppested for å finne avganger i nærheten.', 'Try to search for another name or use another stop place to find departures nearby.', 'Prøv å søkje på eit anna namn eller bruk ein annan stoppestad for å finne avgangar i nærleiken.'),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
stopPlace: {
|
|
39
|
-
noDepartures: (0, commons_1.translation)('Ingen avganger i dette tidsrommet.', 'No departures in the selected period of time.', 'Ingen avgangar i dette tidsrommet.'),
|
|
40
|
-
quaySection: {
|
|
41
|
-
resultsLoaded: (0, commons_1.translation)('Lastet avganger', 'Loaded departures', 'Lasta avgangar'),
|
|
42
|
-
refreshButton: (0, commons_1.translation)('Oppdater', 'Refresh', 'Oppdater'),
|
|
43
|
-
a11yExpand: (0, commons_1.translation)('Aktiver for å utvide', 'Activate to expand', 'Aktiver for å utvide'),
|
|
44
|
-
a11yMinimize: (0, commons_1.translation)('Aktiver for å minimere', 'Activate to minimize', 'Aktiver for å minimere'),
|
|
45
|
-
a11yToQuayHint: (0, commons_1.translation)('Aktiver for å vise flere avganger', 'Activate to show more departures', 'Aktiver for å vise fleire avgangar'),
|
|
46
|
-
moreDepartures: (0, commons_1.translation)('Se flere avganger', 'See more departures', 'Sjå fleire avgangar'),
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
details: {
|
|
50
|
-
backToDepartures: (0, commons_1.translation)('Tilbake til avganger', 'Back to departures', 'Tilbake til avgangar'),
|
|
51
|
-
backToAssistant: (0, commons_1.translation)('Tilbake til reiseforslag', 'Back to travel suggestion', 'Tilbake til reiseforslag'),
|
|
52
|
-
quayPublicCodePrefix: (0, commons_1.translation)('', '', ''),
|
|
53
|
-
lastPassedStop: (stopPlaceName, time) => (0, commons_1.translation)(`Passerte ${stopPlaceName} kl. ${time}`, `Passed ${stopPlaceName} at ${time}`, `Passerte ${stopPlaceName} kl. ${time}`),
|
|
54
|
-
noPassedStop: (stopPlaceName, time) => (0, commons_1.translation)(`Kjører fra ${stopPlaceName} kl. ${time}`, `Departs from ${stopPlaceName} at ${time}`, `Køyrer frå ${stopPlaceName} kl. ${time}`),
|
|
55
|
-
onTime: (0, commons_1.translation)(`I rute`, `On time`, `I rute`),
|
|
56
|
-
notOnTime: (0, commons_1.translation)(`Etter rutetid`, `Behind scheduled time`, `Etter rutetid`),
|
|
57
|
-
collapse: {
|
|
58
|
-
label: (numberStops) => (0, commons_1.translation)(`${numberStops} mellomstopp`, `${numberStops} intermediate stops`, `${numberStops} mellomstopp`),
|
|
59
|
-
a11yHint: (0, commons_1.translation)('Aktivér for å vise alle mellomstopp.', 'Activate to show intermediate stops', 'Aktiver for å vise alle mellomstopp'),
|
|
60
|
-
},
|
|
61
|
-
messages: {
|
|
62
|
-
loading: (0, commons_1.translation)('Laster detaljer', 'Loading details', 'Lastar detaljar'),
|
|
63
|
-
noAlighting: (0, commons_1.translation)('Ingen avstigning', 'No disembarking', 'Ingen avstiging'),
|
|
64
|
-
noBoarding: (0, commons_1.translation)('Ingen påstigning', 'No boarding', 'Ingen påstiging'),
|
|
65
|
-
noActiveItem: (0, commons_1.translation)('Ojda! Noe gikk galt med lasting av detaljer for denne reisen.', 'Oops! We had some issues loading the details for this journey.', 'Oi då! Noko gjekk gale med lasting av detaljar for denne reisa.'),
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
exports.Departures = (0, utils_1.orgSpecificTranslations)(DeparturesInternal, {
|
|
70
|
-
vkt: {
|
|
71
|
-
details: {
|
|
72
|
-
quayPublicCodePrefix: (0, commons_1.translation)(' - Spor ', ' - Track ', ' - Spor '),
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
});
|
package/lib/utils/env.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import 'dotenv/config';
|
|
2
|
-
export declare function getEnv(): "prod" | "dev";
|
|
3
|
-
/**
|
|
4
|
-
* Return a URL to the given service. `serviceKey` should be uppercased.
|
|
5
|
-
* These values are only available at runtime, not at build time
|
|
6
|
-
*/
|
|
7
|
-
export declare const getServiceUrl: (prefix: string, serviceKey: string, required?: boolean) => string;
|
|
8
|
-
export declare const BFFURL: string;
|
|
9
|
-
export declare const SALESURL: string;
|
|
10
|
-
//# sourceMappingURL=env.d.ts.map
|
package/lib/utils/env.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAQvB,wBAAgB,MAAM,mBAErB;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,MAAM,EACd,YAAY,MAAM,EAClB,WAAU,OAAe,KACxB,MAoBF,CAAC;AAkBF,eAAO,MAAM,MAAM,EAAE,MAAwD,CAAC;AAC9E,eAAO,MAAM,QAAQ,EAAE,MAC8B,CAAC"}
|
package/lib/utils/env.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SALESURL = exports.BFFURL = exports.getServiceUrl = void 0;
|
|
4
|
-
exports.getEnv = getEnv;
|
|
5
|
-
require("dotenv/config");
|
|
6
|
-
/**
|
|
7
|
-
* The base URL for the API, used in development mode. Use `getServiceUrl` to
|
|
8
|
-
* connect directly to service in production.
|
|
9
|
-
*/
|
|
10
|
-
const API_BASE_URL = process.env.API_BASE_URL;
|
|
11
|
-
function getEnv() {
|
|
12
|
-
return process.env['NODE_ENV'] === 'production' ? 'prod' : 'dev';
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Return a URL to the given service. `serviceKey` should be uppercased.
|
|
16
|
-
* These values are only available at runtime, not at build time
|
|
17
|
-
*/
|
|
18
|
-
const getServiceUrl = (prefix, serviceKey, required = false) => {
|
|
19
|
-
if (getEnv() === 'dev')
|
|
20
|
-
return API_BASE_URL ?? '';
|
|
21
|
-
// Don't use internal services in Vercel for preview branches
|
|
22
|
-
if (process.env.VERCEL === '1')
|
|
23
|
-
return API_BASE_URL ?? '';
|
|
24
|
-
const host = getServiceHost(serviceKey);
|
|
25
|
-
const port = getServicePort(serviceKey);
|
|
26
|
-
if (host === '' || port === '') {
|
|
27
|
-
if (required) {
|
|
28
|
-
console.error(`failed to read environment variables for required service: ${serviceKey}`);
|
|
29
|
-
process.exit(-1);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return '';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return `${prefix}${host}:${port}`;
|
|
36
|
-
};
|
|
37
|
-
exports.getServiceUrl = getServiceUrl;
|
|
38
|
-
const getServiceHost = (serviceKey) => {
|
|
39
|
-
return (process.env[`${serviceKey}_SERVICE_SERVICE_HOST`] ||
|
|
40
|
-
process.env[`${serviceKey}_SERVICE_HOST`] ||
|
|
41
|
-
'');
|
|
42
|
-
};
|
|
43
|
-
const getServicePort = (serviceKey) => {
|
|
44
|
-
return (process.env[`${serviceKey}_SERVICE_SERVICE_PORT`] ||
|
|
45
|
-
process.env[`${serviceKey}_SERVICE_PORT`] ||
|
|
46
|
-
'');
|
|
47
|
-
};
|
|
48
|
-
exports.BFFURL = (0, exports.getServiceUrl)('http://', 'BFF', false) + '/bff';
|
|
49
|
-
exports.SALESURL = (0, exports.getServiceUrl)('http://', 'SALES', false) + '/sales';
|
package/lib/utils/presence.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../../src/utils/presence.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CACvB,CAAC"}
|
package/lib/utils/presence.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-debounce.d.ts","sourceRoot":"","sources":["../../src/utils/use-debounce.ts"],"names":[],"mappings":"AAEA,iBAAS,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAYnD;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const react_1 = require("react");
|
|
4
|
-
function useDebounce(value, delay) {
|
|
5
|
-
const [debouncedValue, setDebouncedValue] = (0, react_1.useState)(value);
|
|
6
|
-
(0, react_1.useEffect)(() => {
|
|
7
|
-
const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
|
|
8
|
-
return () => {
|
|
9
|
-
clearTimeout(timer);
|
|
10
|
-
};
|
|
11
|
-
}, [value, delay]);
|
|
12
|
-
return debouncedValue;
|
|
13
|
-
}
|
|
14
|
-
exports.default = useDebounce;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-localstorage.d.ts","sourceRoot":"","sources":["../../src/utils/use-localstorage.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,CAAC,EACvC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,CAAC,GACd,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAqCzB"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = useLocalStorage;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useLocalStorage(key, initialValue) {
|
|
6
|
-
const [storedValue, setStoredValue] = (0, react_1.useState)(() => {
|
|
7
|
-
if (typeof window === 'undefined') {
|
|
8
|
-
return initialValue;
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
// Get from local storage by key
|
|
12
|
-
const item = window.localStorage.getItem(key);
|
|
13
|
-
// Parse stored json or if none return initialValue
|
|
14
|
-
return item ? JSON.parse(item) : initialValue;
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
// If error also return initialValue
|
|
18
|
-
console.log(error);
|
|
19
|
-
return initialValue;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
// Return a wrapped version of useState's setter function that ...
|
|
23
|
-
// ... persists the new value to localStorage.
|
|
24
|
-
const setValue = (0, react_1.useCallback)((value) => {
|
|
25
|
-
try {
|
|
26
|
-
// Allow value to be a function so we have same API as useState
|
|
27
|
-
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
28
|
-
// Save state
|
|
29
|
-
setStoredValue(valueToStore);
|
|
30
|
-
// Save to local storage
|
|
31
|
-
if (typeof window !== 'undefined') {
|
|
32
|
-
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.log(error);
|
|
37
|
-
}
|
|
38
|
-
}, [key, storedValue]);
|
|
39
|
-
return [storedValue, setValue];
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-media-query.d.ts","sourceRoot":"","sources":["../../src/utils/user-media-query.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,UAAU,EAAE,MAAM,WAkBvD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = useMediaQuery;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useMediaQuery(mediaQuery) {
|
|
6
|
-
const [isMatched, setMatched] = (0, react_1.useState)(() => {
|
|
7
|
-
if (!hasWindow())
|
|
8
|
-
return false;
|
|
9
|
-
return Boolean(window.matchMedia(mediaQuery).matches);
|
|
10
|
-
});
|
|
11
|
-
(0, react_1.useEffect)(() => {
|
|
12
|
-
if (!hasWindow())
|
|
13
|
-
return;
|
|
14
|
-
const mediaQueryList = window.matchMedia(mediaQuery);
|
|
15
|
-
const documentChangeHandler = () => setMatched(Boolean(mediaQueryList.matches));
|
|
16
|
-
listenTo(mediaQueryList, documentChangeHandler);
|
|
17
|
-
documentChangeHandler();
|
|
18
|
-
return () => removeListener(mediaQueryList, documentChangeHandler);
|
|
19
|
-
}, [mediaQuery]);
|
|
20
|
-
return isMatched;
|
|
21
|
-
}
|
|
22
|
-
function hasWindow() {
|
|
23
|
-
return typeof window !== 'undefined';
|
|
24
|
-
}
|
|
25
|
-
function listenTo(matcher, cb) {
|
|
26
|
-
if ('addEventListener' in matcher) {
|
|
27
|
-
return matcher.addEventListener('change', cb);
|
|
28
|
-
}
|
|
29
|
-
return matcher.addListener(cb);
|
|
30
|
-
}
|
|
31
|
-
function removeListener(matcher, cb) {
|
|
32
|
-
if ('removeEventListener' in matcher) {
|
|
33
|
-
return matcher.removeEventListener('change', cb);
|
|
34
|
-
}
|
|
35
|
-
return matcher.removeListener(cb);
|
|
36
|
-
}
|