mirror of
https://github.com/kremalicious/portfolio.git
synced 2025-01-03 10:25:00 +01:00
change typekit again
This commit is contained in:
parent
3d38f1d170
commit
6fec5a3c76
@ -1,20 +1,22 @@
|
|||||||
import React from 'react'
|
import React, { Fragment } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import Helmet from 'react-helmet'
|
import Helmet from 'react-helmet'
|
||||||
|
import Typekit from './Typekit'
|
||||||
|
|
||||||
const Head = ({ meta }) => {
|
const Head = ({ meta }) => {
|
||||||
const { title, tagline, description, typekit } = meta
|
const { title, tagline, description, typekit } = meta
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Fragment>
|
||||||
<Helmet
|
<Helmet
|
||||||
defaultTitle={`${title.toLowerCase()} { ${tagline.toLowerCase()} }`}
|
defaultTitle={`${title.toLowerCase()} { ${tagline.toLowerCase()} }`}
|
||||||
titleTemplate={`%s // ${title.toLowerCase()} { ${tagline.toLowerCase()} }`}
|
titleTemplate={`%s // ${title.toLowerCase()} { ${tagline.toLowerCase()} }`}
|
||||||
>
|
>
|
||||||
<meta name="description" content={description} />
|
<meta name="description" content={description} />
|
||||||
<link rel="stylesheet" href={`https://use.typekit.net/${typekit}.css`} />
|
|
||||||
|
|
||||||
<meta content="noindex,nofollow" name="robots" />
|
<meta content="noindex,nofollow" name="robots" />
|
||||||
</Helmet>
|
</Helmet>
|
||||||
|
<Typekit id={typekit} />
|
||||||
|
</Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
src/components/atoms/Typekit.js
Normal file
26
src/components/atoms/Typekit.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import Helmet from 'react-helmet'
|
||||||
|
|
||||||
|
const TypekitScript = ({ id }) => (
|
||||||
|
<script>
|
||||||
|
{`
|
||||||
|
(function(d) {
|
||||||
|
var config = {
|
||||||
|
kitId: '${id}',
|
||||||
|
scriptTimeout: 3000,
|
||||||
|
async: true
|
||||||
|
},
|
||||||
|
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
|
||||||
|
})(document);
|
||||||
|
`}
|
||||||
|
</script>
|
||||||
|
)
|
||||||
|
|
||||||
|
const Typekit = props => <Helmet>{TypekitScript(props)}</Helmet>
|
||||||
|
|
||||||
|
export default Typekit
|
||||||
|
|
||||||
|
TypekitScript.propTypes = {
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user