index.jsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import React, { useState } from 'react';
  2. import { Select } from '@douyinfe/semi-ui';
  3. import { types as styledTypes, loops, speeds, delays } from '../../index';
  4. const types = Object.values(styledTypes).reduce((arr, cur) => [...arr, ...cur], []);
  5. function All({ ...rest }) {
  6. const [type, setType] = useState('bounce');
  7. const [speed, setSpeed] = useState('slow');
  8. const [delay, setDelay] = useState('0s');
  9. const [loop, setLoop] = useState('1');
  10. const animStyle = {
  11. backgroundColor: 'rgb(241, 101, 101)',
  12. padding: '20px',
  13. // width: '200px',
  14. // height: '100px',
  15. margin: '20px',
  16. marginLeft: '50px',
  17. borderRadius: '4px',
  18. fontSize: '20px',
  19. color: 'white',
  20. display: 'inline-flex',
  21. alignItems: 'center',
  22. justifyContent: 'center',
  23. };
  24. const cls = `semi-animated semi-${type} semi-speed-${speed} semi-delay-${delay} semi-loop-${loop}`;
  25. return (
  26. <div style={{}}>
  27. <div>
  28. <div className={cls} style={animStyle}>
  29. {type}
  30. </div>
  31. </div>
  32. <div>
  33. <Select value={type} onChange={setType}>
  34. {types.map(itType => (
  35. <Select.Option key={itType} value={itType}>
  36. {itType}
  37. </Select.Option>
  38. ))}
  39. </Select>
  40. </div>
  41. </div>
  42. );
  43. }
  44. export default All;