hovercard.stories.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. const showOptions = {
  13. true: true,
  14. false: false,
  15. null: null,
  16. };
  17. const tipColorOptions = {
  18. red: 'red',
  19. null: null,
  20. };
  21. storiesOf('UI|Hovercard', module).add(
  22. 'Hovercard',
  23. withInfo(
  24. 'Good luck if your container element is near the top and/or left side of the screen'
  25. )(() => (
  26. <div
  27. style={{
  28. height: 300,
  29. display: 'flex',
  30. justifyContent: 'center',
  31. alignItems: 'center',
  32. }}
  33. >
  34. <Hovercard
  35. header={text('Header', 'Hovercard Header')}
  36. body={text('Body', 'Hovercard body (can also be a React node)')}
  37. position={select('position', positionOptions, 'top', 'Hovercard positioning')}
  38. show={select('show', showOptions, null, 'Force show/unshow')}
  39. tipColor={select('tipColor', tipColorOptions, null, 'Tip color')}
  40. >
  41. Hover over me
  42. </Hovercard>
  43. </div>
  44. ))
  45. );