|
|
@ -6,9 +6,17 @@ import Font from './style/Font'
|
|
|
|
import Typography from './style/Typography'
|
|
|
|
import Typography from './style/Typography'
|
|
|
|
|
|
|
|
|
|
|
|
const LOCAL_STYLESHEETS = ['one-light', 'one-dark', 'verminal', 'night-owl', 'nord']
|
|
|
|
const LOCAL_STYLESHEETS = ['one-light', 'one-dark', 'verminal', 'night-owl', 'nord']
|
|
|
|
|
|
|
|
|
|
|
|
const CDN_STYLESHEETS = THEMES.filter(t => LOCAL_STYLESHEETS.indexOf(t.id) < 0)
|
|
|
|
const CDN_STYLESHEETS = THEMES.filter(t => LOCAL_STYLESHEETS.indexOf(t.id) < 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function Link({ key, href }) {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<Head>
|
|
|
|
|
|
|
|
<link rel="preload" as="style" href={href} />
|
|
|
|
|
|
|
|
<link key={key} rel="stylesheet" href={href} />
|
|
|
|
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const StylesheetLink = ({ theme }) => {
|
|
|
|
export const StylesheetLink = ({ theme }) => {
|
|
|
|
let href
|
|
|
|
let href
|
|
|
|
if (LOCAL_STYLESHEETS.indexOf(theme) > -1) {
|
|
|
|
if (LOCAL_STYLESHEETS.indexOf(theme) > -1) {
|
|
|
@ -19,67 +27,49 @@ export const StylesheetLink = ({ theme }) => {
|
|
|
|
(themeDef.link || themeDef.id)}.min.css`
|
|
|
|
(themeDef.link || themeDef.id)}.min.css`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return <Link href={href} />
|
|
|
|
<Head>
|
|
|
|
|
|
|
|
<link key={href} rel="stylesheet" href={href} />
|
|
|
|
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const CodeMirrorLink = () => (
|
|
|
|
export const CodeMirrorLink = () => (
|
|
|
|
<Head>
|
|
|
|
<Link href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.2/codemirror.min.css" />
|
|
|
|
<link
|
|
|
|
|
|
|
|
key="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.2/codemirror.min.css"
|
|
|
|
|
|
|
|
rel="stylesheet"
|
|
|
|
|
|
|
|
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.2/codemirror.min.css"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const title = 'Carbon'
|
|
|
|
|
|
|
|
const description =
|
|
|
|
|
|
|
|
'Carbon is the easiest way to create and share beautiful images of your source code.'
|
|
|
|
export const MetaTags = () => (
|
|
|
|
export const MetaTags = () => (
|
|
|
|
<Head>
|
|
|
|
<Head>
|
|
|
|
<meta charSet="utf-8" />
|
|
|
|
<meta charSet="utf-8" />
|
|
|
|
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
|
|
|
|
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<meta
|
|
|
|
<meta name="description" content={description} />
|
|
|
|
name="description"
|
|
|
|
<meta name="application-name" content={title} />
|
|
|
|
content="Carbon is the easiest way to create and share beautiful images of your source code."
|
|
|
|
<meta name="twitter:title" content={title} />
|
|
|
|
/>
|
|
|
|
<meta name="twitter:description" content={description} />
|
|
|
|
<meta name="application-name" content="Carbon" />
|
|
|
|
<meta name="og:title" content={title} />
|
|
|
|
<meta name="twitter:title" content="Carbon" />
|
|
|
|
<meta name="og:description" content={description} />
|
|
|
|
<meta
|
|
|
|
|
|
|
|
name="twitter:description"
|
|
|
|
|
|
|
|
content="Carbon is the easiest way to create and share beautiful images of your source code."
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<meta name="og:title" content="Carbon" />
|
|
|
|
|
|
|
|
<meta
|
|
|
|
|
|
|
|
name="og:description"
|
|
|
|
|
|
|
|
content="Carbon is the easiest way to create and share beautiful images of your source code."
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<meta name="og:image" content="/static/banner.png" />
|
|
|
|
<meta name="og:image" content="/static/banner.png" />
|
|
|
|
<meta name="theme-color" content="#121212" />
|
|
|
|
<meta name="theme-color" content="#121212" />
|
|
|
|
<title>Carbon</title>
|
|
|
|
<title>{title}</title>
|
|
|
|
<link rel="shortcut icon" href="/static/favicon.ico" />
|
|
|
|
<link rel="shortcut icon" href="/static/favicon.ico" />
|
|
|
|
<link rel="manifest" href="/static/manifest.json" />
|
|
|
|
<link rel="manifest" href="/static/manifest.json" />
|
|
|
|
</Head>
|
|
|
|
</Head>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Before supporting <link rel="preload"> verify that it is widely supported in FireFox
|
|
|
|
|
|
|
|
* with out a flag here: https://caniuse.com/#feat=link-rel-preload
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
export const MetaLinks = () => {
|
|
|
|
export const MetaLinks = () => {
|
|
|
|
const onBrowser = typeof window !== 'undefined'
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<React.Fragment>
|
|
|
|
<React.Fragment>
|
|
|
|
<StylesheetLink theme="seti" />
|
|
|
|
<Link href="/static/themes/seti.css" />
|
|
|
|
<CodeMirrorLink />
|
|
|
|
<CodeMirrorLink />
|
|
|
|
{LOCAL_STYLESHEETS.map(id => (
|
|
|
|
{LOCAL_STYLESHEETS.map(id => (
|
|
|
|
<StylesheetLink key={id} theme={id} />
|
|
|
|
<Link key={id} href={`/static/themes/${id}.css`} />
|
|
|
|
))}
|
|
|
|
))}
|
|
|
|
{onBrowser
|
|
|
|
{CDN_STYLESHEETS.map(theme => {
|
|
|
|
? CDN_STYLESHEETS.map(theme => <StylesheetLink key={theme.id} theme={theme.id} />)
|
|
|
|
const themeDef = THEMES_HASH[theme]
|
|
|
|
: null}
|
|
|
|
const href = `//cdnjs.cloudflare.com/ajax/libs/codemirror/5.42.2/theme/${themeDef &&
|
|
|
|
|
|
|
|
(themeDef.link || themeDef.id)}.min.css`
|
|
|
|
|
|
|
|
return <Link key={href} href={href} />
|
|
|
|
|
|
|
|
})}
|
|
|
|
</React.Fragment>
|
|
|
|
</React.Fragment>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|