This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
56 lines (50 loc) · 1.7 KB
/
index.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
import React from "react";
import PropTypes from "prop-types";
import ReactDOM from "react-dom";
import { AppContainer } from "react-hot-loader";
import Redbox from "redbox-react";
import { Deck, Slide } from 'spectacle';
import components from './presentation/components';
import slides, { transitions } from "./presentation/index.mdx";
import theme from './presentation/theme';
require("normalize.css");
const CustomErrorReporter = ({ error }) => <Redbox error={error} />;
CustomErrorReporter.propTypes = {
error: PropTypes.instanceOf(Error).isRequired
};
const creeperTransition = (transitioning, forward) => {
const offset = forward ? 100 : -100;
return {
transform: `
translate3d(0,${transitioning ? offset : 0}%, 0)
`,
};
};
ReactDOM.render(
<AppContainer errorReporter={CustomErrorReporter}>
<Deck transition={[creeperTransition]} transitionDuration={500} theme={theme}>
{slides.map((S, i) => {
let transition = transitions[i] || null;
return <S transition={transition} key={`slide-${i}`} />;
})}
</Deck>
</AppContainer>,
document.getElementById("root"),
);
if (module.hot) {
module.hot.accept(() => {
const newTheme = require("./presentation/theme").default;
const newSlides = require("./presentation/index.mdx").default;
ReactDOM.render(
<AppContainer errorReporter={CustomErrorReporter}>
<Deck transition={[creeperTransition]} transitionDuration={500} theme={newTheme}>
{newSlides.map((S, i) => {
let transition = transitions[i] || null;
return <S transition={transition} key={`slide-${i}`} />;
})}
</Deck>
</AppContainer>,
document.getElementById("root"),
);
});
}