-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paththeme.js
79 lines (71 loc) · 1.76 KB
/
theme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Based on @mdx-deck/themes/future, and prism
import merge from 'lodash.merge'
import React from 'react'
import { Prism } from 'react-syntax-highlighter'
import highlighter from 'react-syntax-highlighter/dist/esm/styles/prism/vs-dark';
import { getLanguage } from '@mdx-deck/themes/syntax-highlighter'
import { useDeck } from 'mdx-deck'
export const createCode = (opts = {}) => props => {
const language = getLanguage(props.className)
return <Prism {...opts} language={language} {...props} />
}
const blue = '#0af'
let slideNo = (props) => {
const { index, length } = useDeck()
return <div>
{ props.children }
<div
css={{
position: 'fixed',
right: 0,
bottom: 0,
margin: 16,
color: '#ccc',
fontFamily: 'monospace',
fontSize: '25px'
}}
hidden={index===0}
>
{ index + '/' + (length - 1) }
</div>
</div>
}
let theme = {
fonts: {
body: '"Avenir Next", system-ui, sans-serif',
monospace: 'Monaco, monospace'
},
colors: {
text: '#fff',
background: '#111',
primary: blue,
black: '#000',
},
fontWeights: {
heading: 600,
bold: 600,
},
text: {
heading: {
textTransform: 'uppercase',
letterSpacing: '0.1em',
},
},
styles: {
pre: {
color: 'primary',
bg: 'black',
},
code: {
color: 'primary',
},
},
style: highlighter,
Provider: props => slideNo(props)
}
export default merge(theme, {
components: {
pre: props => props.children,
code: createCode(theme),
}
})