index.jsx 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { Collapse } from '@douyinfe/semi-ui';
  2. import { StyledAnimation } from '@douyinfe/semi-animation-react';
  3. import React from 'react';
  4. export default class SemiCollapseAnimation extends React.PureComponent {
  5. state = {
  6. itemKey: '',
  7. };
  8. constructor(props = {}) {
  9. super(props);
  10. }
  11. render() {
  12. const { itemKey } = this.state;
  13. return (
  14. <Collapse
  15. accordion
  16. onChange={(itemKey, event) => {
  17. this.setState({ itemKey });
  18. }}
  19. >
  20. {['1', '2', '3'].map(key => (
  21. <StyledAnimation key={key} type={itemKey === key ? 'slideInDown' : 'slideOutDown'}>
  22. <Collapse.Panel header={`This is panel header ${key}`} itemKey={key}>
  23. <p>Hi, bytedance dance dance. This is the docsite of Semi UI. </p>
  24. </Collapse.Panel>
  25. </StyledAnimation>
  26. ))}
  27. </Collapse>
  28. );
  29. }
  30. }