PanelOpen.jsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. <Space wrap spacing={spacing}>
  22. <DatePicker {...props} type="month" defaultValue={defaultValue} />
  23. <DatePicker {...props} type="dateTimeRange" defaultValue={defaultRangeValue} density="compact" />
  24. <DatePicker {...props} type="dateTimeRange" defaultValue={defaultRangeValue} />
  25. </Space>
  26. );
  27. }
  28. App.parameters = {
  29. chromatic: {
  30. disableSnapshot: false,
  31. delay: 300,
  32. },
  33. };
  34. App.storyName = 'defaultOpen';