lazyLoad.stories.js 576 B

1234567891011121314151617181920212223242526
  1. import LazyLoad from 'sentry/components/lazyLoad';
  2. export default {
  3. title: 'Utilities/Lazy Load',
  4. component: LazyLoad,
  5. };
  6. export const _LazyLoad = () => {
  7. const MyComponent = () => (
  8. <div>View that is loaded after 1000ms to simulate dynamic import</div>
  9. );
  10. const getComponent = () =>
  11. new Promise(resolve => setTimeout(() => resolve(MyComponent), 1000));
  12. return <LazyLoad component={getComponent} />;
  13. };
  14. _LazyLoad.storyName = 'Lazy Load';
  15. _LazyLoad.parameters = {
  16. docs: {
  17. description: {
  18. story: 'Lazy loads a view/component',
  19. },
  20. },
  21. };