Skip to content

Commit 9cf5d95

Browse files
committed
done
1 parent 1473612 commit 9cf5d95

22 files changed

+678
-151
lines changed

public/1.png

90.9 KB
Loading

public/2.png

93.5 KB
Loading

public/3.png

46.7 KB
Loading

public/drake-bad.jpg

25.2 KB
Loading

public/drake-good.jpg

132 KB
Loading

public/index.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
name="description"
99
content="Web site created using create-react-app"
1010
/>
11-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
12-
<!--
13-
manifest.json provides metadata used when your web app is installed on a
14-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
15-
-->
16-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1711
<!--
1812
Notice the use of %PUBLIC_URL% in the tags above.
1913
It will be replaced with the URL of the `public` folder during the build.

public/manifest.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/App.tsx

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,7 @@
1-
import React from "react";
2-
import {
3-
Deck,
4-
Slide,
5-
Heading,
6-
FlexBox,
7-
Box,
8-
FullScreen,
9-
Progress,
10-
Text,
11-
OrderedList,
12-
ListItem,
13-
Appear,
14-
UnorderedList,
15-
} from "spectacle";
16-
import { WhyUseReactSlide } from "./presentation/WhyUseReactSlide";
17-
18-
const theme = {
19-
colors: {
20-
primary: "#ffffff",
21-
secondary: "#ffffff",
22-
background: "#9e719a",
23-
},
24-
fonts: {
25-
header: "'Montserrat', sans-serif",
26-
text: "'Quicksand', sans-serif",
27-
},
28-
};
29-
30-
const template: React.FC = () => (
31-
<FlexBox
32-
justifyContent="space-between"
33-
position="absolute"
34-
bottom={0}
35-
width={1}
36-
>
37-
<Box padding="0 1em">
38-
<FullScreen color={"white"} size={30} />
39-
</Box>
40-
<Box padding="1em">
41-
<Progress color={"white"} size={10} />
42-
</Box>
43-
</FlexBox>
44-
);
1+
import { PerformanceDeck } from "./presentation/Deck";
452

463
function App() {
47-
return (
48-
<Deck
49-
theme={theme}
50-
template={template}
51-
transition={{
52-
from: {
53-
opacity: 0,
54-
},
55-
enter: {
56-
opacity: 1,
57-
},
58-
leave: {
59-
opacity: 0,
60-
},
61-
}}
62-
>
63-
<Slide>
64-
<Heading>React Is Killing Your Performance And It's Your Fault 🚀</Heading>
65-
</Slide>
66-
<Slide>
67-
<Heading>About me</Heading>
68-
<Appear>
69-
<OrderedList>
70-
<ListItem>Software Developer for the last 10 years</ListItem>
71-
<ListItem>Worked at Checkpoint, Microsoft and Soluto</ListItem>
72-
</OrderedList>
73-
</Appear>
74-
</Slide>
75-
<WhyUseReactSlide />
76-
<Slide>
77-
<Heading>But... it comes with a price 💴</Heading>
78-
<UnorderedList>
79-
<ListItem>
80-
To enjoy the declarative API,
81-
</ListItem>
82-
</UnorderedList>
83-
</Slide>
84-
</Deck>
85-
);
4+
return <PerformanceDeck />;
865
}
876

887
export default App;

src/components/Draggable.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React, { useState } from "react";
2+
import { SlowRendering } from "./Inner";
3+
4+
export const Draggable = React.forwardRef<HTMLDivElement>((_, ref) => {
5+
const [isDragging, setIsDragging] = useState(false);
6+
const [position, setPosition] = useState<{ top: number; left: number }>({
7+
top: 0,
8+
left: 0,
9+
});
10+
11+
return (
12+
<div
13+
ref={ref}
14+
style={{
15+
position: "absolute",
16+
width: "500px",
17+
height: "500px",
18+
top: `${position.top}px`,
19+
left: `${position.left}px`,
20+
borderRadius: "25px",
21+
cursor: "grab",
22+
background: "white",
23+
overflowY: "auto",
24+
}}
25+
onMouseMove={(e) => {
26+
if (isDragging)
27+
setPosition({ top: e.clientY - 250, left: e.clientX - 250 });
28+
}}
29+
onMouseDown={() => {
30+
setIsDragging(true);
31+
}}
32+
onMouseUp={() => setIsDragging(false)}
33+
>
34+
<SlowRendering text={"Drag me 🐉"} />
35+
</div>
36+
);
37+
});

src/components/Inner.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from "react";
2+
import { Text } from "spectacle";
3+
4+
export const SlowRendering: React.FC<{ text: string }> = ({ text }) => {
5+
let start = new Date().getTime();
6+
for (let i = 0; i < 1e7; i++) {
7+
if (new Date().getTime() - start > 200) {
8+
break;
9+
}
10+
}
11+
12+
return (
13+
<div style={{ userSelect: "none", padding: "30px" }}>
14+
<Text>{text}</Text>
15+
</div>
16+
);
17+
};

0 commit comments

Comments
 (0)