hovercard.stories.js 935 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React from 'react';
  2. import {storiesOf} from '@storybook/react';
  3. import {withInfo} from '@storybook/addon-info';
  4. import {text, select} from '@storybook/addon-knobs';
  5. import Hovercard from 'app/components/hovercard';
  6. const positionOptions = {
  7. top: 'top',
  8. bottom: 'bottom',
  9. left: 'left',
  10. right: 'right',
  11. };
  12. storiesOf('UI|Hovercard', module).add(
  13. 'Hovercard',
  14. withInfo(
  15. 'Good luck if your container element is near the top and/or left side of the screen'
  16. )(() => (
  17. <div
  18. style={{
  19. height: 300,
  20. display: 'flex',
  21. justifyContent: 'center',
  22. alignItems: 'center',
  23. }}
  24. >
  25. <Hovercard
  26. header={text('Header', 'Hovercard Header')}
  27. body={text('Body', 'Hovercard body (can also be a React node)')}
  28. position={select('position', positionOptions, 'top', 'Hovercard positioning')}
  29. >
  30. Hover over me
  31. </Hovercard>
  32. </div>
  33. ))
  34. );