mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
test fixes
This commit is contained in:
parent
80cbfd2cd2
commit
15b5006df4
@ -4,7 +4,7 @@ import posed, { PoseGroup } from 'react-pose'
|
|||||||
import { fadeIn } from './atoms/Transitions'
|
import { fadeIn } from './atoms/Transitions'
|
||||||
import Typekit from './atoms/Typekit'
|
import Typekit from './atoms/Typekit'
|
||||||
import HostnameCheck from './atoms/HostnameCheck'
|
import HostnameCheck from './atoms/HostnameCheck'
|
||||||
import ThemeSwitch from './molecules/ThemeSwitch'
|
// import ThemeSwitch from './molecules/ThemeSwitch'
|
||||||
import Header from './organisms/Header'
|
import Header from './organisms/Header'
|
||||||
import Footer from './organisms/Footer'
|
import Footer from './organisms/Footer'
|
||||||
import { screen } from './Layout.module.css'
|
import { screen } from './Layout.module.css'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useCallback, useEffect, useState } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
import { hostnameInfo } from './HostnameCheck.module.css'
|
import { hostnameInfo } from './HostnameCheck.module.css'
|
||||||
@ -11,16 +11,12 @@ export default function HostnameCheck({ allowedHosts }) {
|
|||||||
// default to true so SSR builds never show the banner
|
// default to true so SSR builds never show the banner
|
||||||
const [isAllowedHost, setIsAllowedHost] = useState(true)
|
const [isAllowedHost, setIsAllowedHost] = useState(true)
|
||||||
|
|
||||||
const checkAllowedHost = () => {
|
|
||||||
if (typeof window !== 'undefined' && window.location) {
|
|
||||||
return allowedHosts.includes(window.location.hostname)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isAllowedHost = checkAllowedHost()
|
if (typeof window !== 'undefined' && window.location) {
|
||||||
setIsAllowedHost(isAllowedHost)
|
const isAllowedHost = allowedHosts.includes(window.location.hostname)
|
||||||
}, [])
|
setIsAllowedHost(isAllowedHost)
|
||||||
|
}
|
||||||
|
}, [allowedHosts])
|
||||||
|
|
||||||
return !isAllowedHost ? (
|
return !isAllowedHost ? (
|
||||||
<>
|
<>
|
||||||
|
@ -4,7 +4,8 @@ module.exports = {
|
|||||||
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
|
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
|
||||||
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||||
'<rootDir>/tests/__mocks__/file-mock.js',
|
'<rootDir>/tests/__mocks__/file-mock.js',
|
||||||
'\\.svg': '<rootDir>/tests/__mocks__/svgr-mock.js'
|
'\\.svg': '<rootDir>/tests/__mocks__/svgr-mock.js',
|
||||||
|
'^@reach/router(.*)': '<rootDir>/node_modules/@gatsbyjs/reach-router$1'
|
||||||
},
|
},
|
||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
'node_modules',
|
'node_modules',
|
||||||
|
Loading…
Reference in New Issue
Block a user