flowLayout.stories.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React from 'react';
  2. import {storiesOf} from '@storybook/react';
  3. import {withInfo} from '@storybook/addon-info';
  4. import FlowLayout from 'app/components/flowLayout';
  5. import SpreadLayout from 'app/components/spreadLayout';
  6. storiesOf('Deprecated|ComponentLayouts/FlowLayout', module)
  7. .add(
  8. 'row',
  9. withInfo('Horizontal row with vertical centering')(() => (
  10. <FlowLayout style={{backgroundColor: '#fff'}}>
  11. <div style={{padding: 6, backgroundColor: 'rgba(0, 0, 0, 0.2)'}}>Flow</div>
  12. <div style={{padding: 12, backgroundColor: 'rgba(0, 0, 0, 0.1)'}}>Layout</div>
  13. <div style={{padding: 24, backgroundColor: 'rgba(0, 0, 0, 0.05)'}}>Flow</div>
  14. <div style={{padding: 18, backgroundColor: 'rgba(0, 0, 0, 0.3)'}}>Layout</div>
  15. </FlowLayout>
  16. ))
  17. )
  18. .add(
  19. 'column',
  20. withInfo('Vertical column with horizontal centering')(() => (
  21. <FlowLayout vertical style={{backgroundColor: '#fff'}}>
  22. <div style={{padding: 6, backgroundColor: 'rgba(0, 0, 0, 0.2)'}}>Flow</div>
  23. <div style={{padding: 12, backgroundColor: 'rgba(0, 0, 0, 0.1)'}}>Layout</div>
  24. <div style={{padding: 24, backgroundColor: 'rgba(0, 0, 0, 0.05)'}}>Flow</div>
  25. <div style={{padding: 18, backgroundColor: 'rgba(0, 0, 0, 0.3)'}}>Layout</div>
  26. </FlowLayout>
  27. ))
  28. )
  29. .add(
  30. 'long content (truncate)',
  31. withInfo(
  32. 'When you use <FlowLayout> with content that does not get wrapped and overflows, by default hide overflow.'
  33. )(() => (
  34. <div>
  35. <h3 style={{marginBottom: 0, marginTop: 24}}>With "truncate"</h3>
  36. <SpreadLayout style={{backgroundColor: 'white', width: 250}}>
  37. <FlowLayout truncate={true}>
  38. <span className="truncate" style={{whiteSpace: 'nowrap'}}>
  39. Very very long content Very very long content Very very long content Very
  40. very long content
  41. </span>
  42. </FlowLayout>
  43. <div style={{backgroundColor: '#ccc'}}>Important</div>
  44. </SpreadLayout>
  45. <h3 style={{marginBottom: 0, marginTop: 24}}>Without "truncate"</h3>
  46. <SpreadLayout style={{backgroundColor: 'white', width: 250}}>
  47. <FlowLayout truncate={false}>
  48. <span className="truncate" style={{whiteSpace: 'nowrap'}}>
  49. Very very long content Very very long content Very very long content Very
  50. very long content
  51. </span>
  52. </FlowLayout>
  53. <div style={{backgroundColor: '#ccc'}}>Important</div>
  54. </SpreadLayout>
  55. </div>
  56. ))
  57. );