layout-thirds.stories.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import {withInfo} from '@storybook/addon-info';
  4. import Button from 'app/components/button';
  5. import ButtonBar from 'app/components/buttonBar';
  6. import Breadcrumbs from 'app/components/breadcrumbs';
  7. import * as Layout from 'app/components/layouts/thirds';
  8. import space from 'app/styles/space';
  9. const crumbs = [
  10. {
  11. label: 'Issues',
  12. to: '',
  13. },
  14. {
  15. label: 'List',
  16. to: '',
  17. },
  18. {
  19. label: 'Detail',
  20. to: '',
  21. },
  22. ];
  23. export default {
  24. title: 'Layouts/Thirds',
  25. };
  26. export const _6633Layout = withInfo('Two column layout with header & sidebar')(() => (
  27. <Container>
  28. <Layout.Header>
  29. <Layout.HeaderContent>
  30. <Layout.Title>Some heading content</Layout.Title>
  31. </Layout.HeaderContent>
  32. </Layout.Header>
  33. <Layout.Body>
  34. <Layout.Main>
  35. <h1>Content Region</h1>
  36. <p>Some text here</p>
  37. </Layout.Main>
  38. <Layout.Side>
  39. <h3>Sidebar content</h3>
  40. </Layout.Side>
  41. </Layout.Body>
  42. </Container>
  43. ));
  44. _6633Layout.story = {
  45. name: '66/33 layout',
  46. };
  47. export const _6633WithHeaderControls = withInfo('Two column layout with header actions')(
  48. () => (
  49. <Container>
  50. <Layout.Header>
  51. <Layout.HeaderContent>
  52. <Breadcrumbs crumbs={crumbs} />
  53. <Layout.Title>Some heading content</Layout.Title>
  54. </Layout.HeaderContent>
  55. <Layout.HeaderActions>
  56. <ButtonBar gap={1}>
  57. <Button>Save</Button>
  58. <Button>Delete</Button>
  59. <Button>Update</Button>
  60. </ButtonBar>
  61. </Layout.HeaderActions>
  62. </Layout.Header>
  63. <Layout.Body>
  64. <Layout.Main>
  65. <h1>Content Region</h1>
  66. <p>Some text here</p>
  67. </Layout.Main>
  68. <Layout.Side>
  69. <h3>Sidebar content</h3>
  70. </Layout.Side>
  71. </Layout.Body>
  72. </Container>
  73. )
  74. );
  75. _6633WithHeaderControls.story = {
  76. name: '66/33 with header controls',
  77. };
  78. export const _6633WithManyHeaderControls = withInfo(
  79. 'Two column layout with header controls'
  80. )(() => (
  81. <Container>
  82. <Layout.Header>
  83. <Layout.HeaderContent>
  84. <Breadcrumbs crumbs={crumbs} />
  85. <Layout.Title>Heading text</Layout.Title>
  86. </Layout.HeaderContent>
  87. <Layout.HeaderActions>
  88. <MarginedButtonBar gap={1}>
  89. <Button size="small">Save</Button>
  90. <Button size="small">Update</Button>
  91. </MarginedButtonBar>
  92. <ButtonBar gap={1}>
  93. <Button size="small">rollup</Button>
  94. <Button size="small">modify</Button>
  95. <Button size="small">create</Button>
  96. <Button size="small">update</Button>
  97. <Button size="small">delete</Button>
  98. </ButtonBar>
  99. </Layout.HeaderActions>
  100. </Layout.Header>
  101. <Layout.Body>
  102. <Layout.Main>
  103. <h1>Content Region</h1>
  104. <p>Some text here</p>
  105. </Layout.Main>
  106. <Layout.Side>
  107. <h3>Sidebar content</h3>
  108. </Layout.Side>
  109. </Layout.Body>
  110. </Container>
  111. ));
  112. _6633WithManyHeaderControls.story = {
  113. name: '66/33 with many header controls',
  114. };
  115. export const SingleColumnMode = withInfo('Single column mode so we can hide the sidebar')(
  116. () => (
  117. <Container>
  118. <Layout.Header>
  119. <Layout.HeaderContent>
  120. <Breadcrumbs crumbs={crumbs} />
  121. <Layout.Title>Some heading content</Layout.Title>
  122. </Layout.HeaderContent>
  123. <Layout.HeaderActions>
  124. <ButtonBar gap={1}>
  125. <Button size="small">clicker</Button>
  126. <Button size="small">clicker</Button>
  127. </ButtonBar>
  128. </Layout.HeaderActions>
  129. </Layout.Header>
  130. <Layout.Body>
  131. <Layout.Main fullWidth>
  132. <h1>Content Region</h1>
  133. <p>
  134. Some text here, that goes on and on. It should strecth the full width of the
  135. container, and have no space on the right.
  136. </p>
  137. </Layout.Main>
  138. </Layout.Body>
  139. </Container>
  140. )
  141. );
  142. SingleColumnMode.story = {
  143. name: 'single column mode',
  144. };
  145. const Container = styled('div')`
  146. background: ${p => p.theme.gray200};
  147. margin: ${space(2)};
  148. border: 1px solid ${p => p.theme.borderDark};
  149. `;
  150. const MarginedButtonBar = styled(ButtonBar)`
  151. margin-bottom: ${space(1)};
  152. `;