|
|
@ -1,24 +1,42 @@
|
|
|
|
import Head from 'next/head'
|
|
|
|
import Head from 'next/head'
|
|
|
|
import { THEMES } from '../lib/constants'
|
|
|
|
import { THEMES, THEMES_HASH } from '../lib/constants'
|
|
|
|
import Reset from './style/Reset'
|
|
|
|
import Reset from './style/Reset'
|
|
|
|
import Font from './style/Font'
|
|
|
|
import Font from './style/Font'
|
|
|
|
import Typography from './style/Typography'
|
|
|
|
import Typography from './style/Typography'
|
|
|
|
|
|
|
|
|
|
|
|
export const LOCAL_STYLESHEETS = ['one-dark', 'verminal', 'night-owl', 'nord']
|
|
|
|
const LOCAL_STYLESHEETS = ['one-dark', 'verminal', 'night-owl', 'nord']
|
|
|
|
|
|
|
|
|
|
|
|
const CDN_STYLESHEETS = THEMES.filter(
|
|
|
|
const CDN_STYLESHEETS = THEMES.filter(t => LOCAL_STYLESHEETS.indexOf(t.id) < 0)
|
|
|
|
t => t.hasStylesheet !== false && LOCAL_STYLESHEETS.indexOf(t.id) < 0
|
|
|
|
|
|
|
|
)
|
|
|
|
export const StylesheetLink = ({ theme }) => {
|
|
|
|
|
|
|
|
let href
|
|
|
|
|
|
|
|
if (LOCAL_STYLESHEETS.indexOf(theme) > -1) {
|
|
|
|
|
|
|
|
href = `/static/themes/${theme}.css`
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
const themeDef = THEMES_HASH[theme]
|
|
|
|
|
|
|
|
href = `//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/theme/${themeDef &&
|
|
|
|
|
|
|
|
(themeDef.link || themeDef.id)}.min.css`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<Head>
|
|
|
|
|
|
|
|
<link key={href} rel="stylesheet" href={href} />
|
|
|
|
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const CodeMirrorLink = () => (
|
|
|
|
export const CodeMirrorLink = () => (
|
|
|
|
|
|
|
|
<Head>
|
|
|
|
<link
|
|
|
|
<link
|
|
|
|
|
|
|
|
key="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.css"
|
|
|
|
rel="stylesheet"
|
|
|
|
rel="stylesheet"
|
|
|
|
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.css"
|
|
|
|
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.css"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
</Head>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
export const MetaTags = () => (
|
|
|
|
export const MetaTags = () => (
|
|
|
|
<>
|
|
|
|
<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" />
|
|
|
@ -42,7 +60,7 @@ export const MetaTags = () => (
|
|
|
|
<title>Carbon</title>
|
|
|
|
<title>Carbon</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>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -55,33 +73,17 @@ export default function Meta() {
|
|
|
|
<div className="meta">
|
|
|
|
<div className="meta">
|
|
|
|
<Head>
|
|
|
|
<Head>
|
|
|
|
<title>Carbon</title>
|
|
|
|
<title>Carbon</title>
|
|
|
|
<MetaTags />
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="/static/react-crop.css" />
|
|
|
|
<link rel="stylesheet" href="/static/react-crop.css" />
|
|
|
|
<link
|
|
|
|
</Head>
|
|
|
|
rel="stylesheet"
|
|
|
|
<MetaTags />
|
|
|
|
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/theme/seti.min.css"
|
|
|
|
<StylesheetLink theme="seti" />
|
|
|
|
/>
|
|
|
|
|
|
|
|
<CodeMirrorLink />
|
|
|
|
<CodeMirrorLink />
|
|
|
|
<link
|
|
|
|
|
|
|
|
rel="stylesheet"
|
|
|
|
|
|
|
|
href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/theme/solarized.min.css"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
{LOCAL_STYLESHEETS.map(id => (
|
|
|
|
{LOCAL_STYLESHEETS.map(id => (
|
|
|
|
<link key={id} rel="stylesheet" href={`/static/themes/${id}.css`} />
|
|
|
|
<StylesheetLink key={id} theme={id} />
|
|
|
|
))}
|
|
|
|
))}
|
|
|
|
{onBrowser
|
|
|
|
{onBrowser
|
|
|
|
? CDN_STYLESHEETS.map(theme => (
|
|
|
|
? CDN_STYLESHEETS.map(theme => <StylesheetLink key={theme.id} theme={theme.id} />)
|
|
|
|
<link
|
|
|
|
|
|
|
|
key={theme.id}
|
|
|
|
|
|
|
|
rel="stylesheet"
|
|
|
|
|
|
|
|
href={
|
|
|
|
|
|
|
|
theme.link ||
|
|
|
|
|
|
|
|
`//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/theme/${theme.id}.min.css`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
: null}
|
|
|
|
: null}
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
<Reset />
|
|
|
|
<Reset />
|
|
|
|
<Font />
|
|
|
|
<Font />
|
|
|
|
<Typography />
|
|
|
|
<Typography />
|
|
|
|