-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.js
130 lines (120 loc) · 3.05 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import React from "react";
import styled, { withTheme } from "styled-components";
import syntaxStyle from "react-syntax-highlighter/styles/prism/funky";
import prismBash from "react-syntax-highlighter/languages/prism/bash";
// Good themes: future, yellow
// https://github.com/jxnblk/mdx-deck/blob/master/docs/theming.md#reference
import { yellow as theme } from "mdx-deck/themes";
/**
* Components
*/
const UL = styled.ul`
text-align: left;
${({ unstyled }) => (unstyled && `list-style-type: none`) || ""}
`;
const OL = styled.ol`
text-align: left;
${({ unstyled }) => (unstyled && `list-style-type: none`) || ""}
`;
export const List = ({ ordered, ...props }) => {
const Element = ordered ? OL : UL;
return <Element {...props} />;
};
const insetChildren = `
@media screen and (min-width: 40em) {
margin-left: 64px;
margin-right: 64px;
}
@media screen and (min-width: 52em) {
margin-left: 128px;
margin-right: 128px;
}
`;
export const Flex = styled.div`
display: flex;
${({ m }) => m && `margin: ${m};`}
${({ p }) => p && `padding: ${p};`}
${({ flexDirection }) => flexDirection && `flex-direction: ${flexDirection};`}
${({ flex }) => flex && `flex: ${flex};`}
${({ justifyContent }) =>
justifyContent && `justify-content: ${justifyContent};`}
`;
export const Block = Flex;
export const Grid = styled(Flex)`
margin: ${({ gutter }) => `-${gutter}`};
> * {
margin: ${({ gutter }) => gutter};
}
`;
export const Card = styled(Flex)`
background-color: ${({ theme }) => theme.colors.background};
`;
export const RelativeLayout = styled.div`
position: relative;
> * {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
flex: 1;
> * {
${insetChildren}
}
}
`;
export const Text = styled.p`
text-align: left;
`;
export const Link = styled.a`
color: ${({ invert, theme }) =>
invert ? theme.colors.white : theme.colors.text};
`;
export const Img = styled.img`
max-width: 100%;
max-height: 100%;
`;
export const Image = styled.div`
width: 100vw;
height: 100vh;
background: no-repeat center/cover url(${props => props.src});
display: flex;
flex-direction: column;
justify-content: center;
position: relative;
> * {
text-shadow: 0.03em 0.03em 0.01em ${({ theme }) => theme.colors.background};
${insetChildren}
}
`;
// Works best with the Image component above
export const Caption = styled.span`
font-size: ${({ small }) => (small ? "0.5em" : "0.75em")};
position: absolute;
bottom: 24px;
right: 24px;
margin: 0;
`;
export const Breadcrumb = styled.span`
font-size: ${({ small }) => (small ? "0.5em" : "0.75em")};
position: absolute;
bottom: 24px;
left: 24px;
margin: 0;
`;
export default {
...theme,
colors: {
...theme.colors,
white: "#fff"
},
prism: {
languages: {
shell: prismBash
},
style: syntaxStyle
}
// Read the docs for more info:
// https://github.com/jxnblk/mdx-deck/blob/master/docs/theming.md
// https://github.com/jxnblk/mdx-deck/blob/master/docs/themes.md
};