diff --git a/components/Meta.js b/components/Meta.js index da479e2..dfd889e 100644 --- a/components/Meta.js +++ b/components/Meta.js @@ -4,21 +4,39 @@ import Reset from './style/Reset' import Font from './style/Font' 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( - t => t.hasStylesheet !== false && LOCAL_STYLESHEETS.indexOf(t.id) < 0 -) +const CDN_STYLESHEETS = THEMES.filter(t => LOCAL_STYLESHEETS.indexOf(t.id) < 0) + +export const StylesheetLink = ({ theme }) => { + let href + if (LOCAL_STYLESHEETS.indexOf(theme) > -1) { + href = `/static/themes/${theme}.css` + } else if (theme.indexOf('solarized') > -1) { + href = '//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/theme/solarized.min.css' + } else { + href = `//cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/theme/${theme}.min.css` + } + + return ( +
+ + + ) +} export const CodeMirrorLink = () => ( - + + + ) export const MetaTags = () => ( - <> + @@ -42,7 +60,7 @@ export const MetaTags = () => (