PanelOpen.jsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import { DatePicker, Space } from '@douyinfe/semi-ui';
  3. /**
  4. * Test with Chromatic
  5. */
  6. export default function App() {
  7. // 使用过去的时间,避免当前日变动引入 UI 测试失败
  8. const defaultValue = new Date('2021-01-01 00:00:00');
  9. const props = {
  10. defaultOpen: true,
  11. position: 'bottomLeft',
  12. autoAdjustOverflow: false,
  13. defaultPickerValue: defaultValue,
  14. needConfirm: true,
  15. motion: false,
  16. };
  17. const spacing = [48, 400];
  18. // 使用过去的时间,避免当前日变动引入 UI 测试失败
  19. const defaultRangeValue = [defaultValue, new Date('2021-03-31 00:00:00')];
  20. return (
  21. <div style={{ height: '100vh' }}>
  22. <Space wrap spacing={spacing}>
  23. <DatePicker {...props} type="month" defaultValue={defaultValue} />
  24. <DatePicker {...props} type="dateTimeRange" defaultValue={defaultRangeValue} density="compact" />
  25. <DatePicker {...props} type="dateTimeRange" defaultValue={defaultRangeValue} />
  26. </Space>
  27. </div>
  28. );
  29. }
  30. App.parameters = {
  31. chromatic: {
  32. disableSnapshot: false,
  33. delay: 3000,
  34. viewports: [1800]
  35. },
  36. };
  37. App.storyName = 'defaultOpen';