-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
48 lines (43 loc) · 1.09 KB
/
index.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
import styled from "@emotion/styled";
import React, { HTMLProps } from "react";
import ReactDOM from "react-dom";
import posed from "react-pose";
import { PoseElementProps } from "react-pose/lib/components/PoseElement/types";
import { Toggle } from "react-powerplug";
import AnimatedList from "./AnimatedList";
const items = [
{
color: "black",
},
{
color: "red",
},
{
color: "rebeccapurple",
},
{
color: "cornflowerblue",
},
];
const Box: React.ComponentType<HTMLProps<HTMLDivElement> & PoseElementProps> = posed.div({
hidden: { opacity: 0 },
visible: { opacity: 1 },
});
const StyledBox = styled(Box)`
&:hover {
cursor: pointer;
}
`;
const App = () => (
<>
<Toggle>
{({ on, toggle }) => (
<StyledBox pose={on ? "hidden" : "visible"} onClick={toggle}>
<h1>click me to toggle my visible state</h1>
</StyledBox>
)}
</Toggle>
<AnimatedList items={items} />
</>
);
ReactDOM.render(<App />, document.getElementById("app"));