import React, { MouseEvent, ReactElement } from 'react'; import SButton from '@components/SButton'; import Box1 from './box1'; import Box2 from './box2'; import Box3 from './box3'; import Box4 from './box4'; import './style.less'; interface Props {} interface State { box1Visible: boolean; box2Visible: boolean; box3Visible: boolean; box4Visible: boolean; } /** * https://github.com/reactjs/react-transition-group * https://reactcommunity.org/react-transition-group/ * * https://reactcommunity.org/react-transition-group/css-transition */ class TestReactTransitionGroup extends React.Component { constructor(props: Props) { super(props); this.state = { box1Visible: false, box2Visible: false, box3Visible: false, box4Visible: false }; this.handleShowBox1 = this.handleShowBox1.bind(this); this.handleShowBox2 = this.handleShowBox2.bind(this); this.handleShowBox3 = this.handleShowBox3.bind(this); this.handleShowBox4 = this.handleShowBox4.bind(this); } render() { const { box1Visible, box2Visible, box3Visible, box4Visible } = this.state; return (
footer
); } private handleShowBox1(e: MouseEvent) { this.setState({ box1Visible: !this.state.box1Visible }); } private handleShowBox2(e: MouseEvent) { this.setState({ box2Visible: !this.state.box2Visible }); } private handleShowBox3(e: MouseEvent) { this.setState({ box3Visible: !this.state.box3Visible }); } private handleShowBox4(e: MouseEvent) { this.setState({ box4Visible: !this.state.box4Visible }); } } export default TestReactTransitionGroup;