-
Notifications
You must be signed in to change notification settings - Fork 14
/
style.ts
63 lines (54 loc) · 1.46 KB
/
style.ts
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
import * as React from "react";
import { classes, cssRule, media, style, types } from "typestyle";
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type CSSProps = Omit<types.NestedCSSProperties, "$debugName">;
export function styles(s: CSSProps): CSSProps {
return s;
}
export function component<Tag extends keyof JSX.IntrinsicElements>(
$debugName: string,
tag: Tag,
...styles: CSSProps[]
): React.FunctionComponent<JSX.IntrinsicElements[Tag]> {
const styleClassName = style({ $debugName }, ...styles);
return ({ className, ...props }: any) => {
return React.createElement(tag, {
className: classes(className, styleClassName),
...props,
});
};
}
export function mobile(...styles: CSSProps[]): CSSProps {
return media({ maxWidth: 700 }, ...styles);
}
cssRule("body", {
fontFamily: `"Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif`,
fontSize: 16,
lineHeight: 1.5,
});
cssRule("body pre, body code", {
fontFamily: "'Ubuntu Mono', monospace",
});
cssRule("h1, h2, h3, h4, h5, h6", {
fontFamily: "'Open Sans', sans-serif",
});
cssRule(
"h2, h3",
{
marginLeft: -20,
marginTop: "2em",
marginBottom: "0.5em",
},
mobile({ marginLeft: 0 }),
);
cssRule(
"body h1",
{
color: "#6272a4",
margin: 0,
paddingBottom: 20,
paddingTop: 25,
marginLeft: -20,
},
mobile({ marginLeft: 0 }),
);