-
Notifications
You must be signed in to change notification settings - Fork 4
/
LanePage.tsx
58 lines (51 loc) · 1.37 KB
/
LanePage.tsx
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
import * as React from "react";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import Header from "./Header";
import Footer from "./Footer";
import Lanes from "./Lanes";
import { RootState } from "../store";
export interface LanePageProps extends React.Props<LanePageProps> {
params: {
library?: string;
editOrCreate?: string;
identifier?: string;
};
}
export interface LanePageContext {
editorStore: Store<RootState>;
csrfToken: string;
}
export default class LanePage extends React.Component<
LanePageProps,
LanePageContext
> {
context: LanePageContext;
static contextTypes: React.ValidationMap<LanePageContext> = {
editorStore: PropTypes.object.isRequired as React.Validator<Store>,
csrfToken: PropTypes.string.isRequired,
};
static childContextTypes: React.ValidationMap<any> = {
library: PropTypes.func,
};
getChildContext() {
return {
library: () => this.props.params.library,
};
}
render(): JSX.Element {
return (
<div className="lane-page">
<Header />
<Lanes
library={this.props.params.library}
editOrCreate={this.props.params.editOrCreate}
identifier={this.props.params.identifier}
store={this.context.editorStore}
csrfToken={this.context.csrfToken}
/>
<Footer />
</div>
);
}
}