layout-thirds.stories.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import Breadcrumbs from 'app/components/breadcrumbs';
  4. import Button from 'app/components/button';
  5. import ButtonBar from 'app/components/buttonBar';
  6. import * as Layout from 'app/components/layouts/thirds';
  7. import Link from 'app/components/links/link';
  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 = () => (
  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.storyName = '66/33 layout';
  45. _6633Layout.parameters = {
  46. docs: {
  47. description: {
  48. story: 'Two column layout with header & sidebar',
  49. },
  50. },
  51. };
  52. export const _6633WithHeaderControls = () => (
  53. <Container>
  54. <Layout.Header>
  55. <Layout.HeaderContent>
  56. <Breadcrumbs crumbs={crumbs} />
  57. <Layout.Title>Some heading content</Layout.Title>
  58. </Layout.HeaderContent>
  59. <Layout.HeaderActions>
  60. <ButtonBar gap={1}>
  61. <Button>Save</Button>
  62. <Button>Delete</Button>
  63. <Button>Update</Button>
  64. </ButtonBar>
  65. </Layout.HeaderActions>
  66. </Layout.Header>
  67. <Layout.Body>
  68. <Layout.Main>
  69. <h1>Content Region</h1>
  70. <p>Some text here</p>
  71. </Layout.Main>
  72. <Layout.Side>
  73. <h3>Sidebar content</h3>
  74. </Layout.Side>
  75. </Layout.Body>
  76. </Container>
  77. );
  78. _6633WithHeaderControls.storyName = '66/33 with header controls';
  79. _6633WithHeaderControls.parameters = {
  80. docs: {
  81. description: {
  82. story: 'Two column layout with header actions',
  83. },
  84. },
  85. };
  86. export const _6633WithManyHeaderControls = () => (
  87. <Container>
  88. <Layout.Header>
  89. <Layout.HeaderContent>
  90. <Breadcrumbs crumbs={crumbs} />
  91. <Layout.Title>Heading text</Layout.Title>
  92. </Layout.HeaderContent>
  93. <Layout.HeaderActions>
  94. <MarginedButtonBar gap={1}>
  95. <Button size="small">Save</Button>
  96. <Button size="small">Update</Button>
  97. </MarginedButtonBar>
  98. <ButtonBar gap={1}>
  99. <Button size="small">rollup</Button>
  100. <Button size="small">modify</Button>
  101. <Button size="small">create</Button>
  102. <Button size="small">update</Button>
  103. <Button size="small">delete</Button>
  104. </ButtonBar>
  105. </Layout.HeaderActions>
  106. </Layout.Header>
  107. <Layout.Body>
  108. <Layout.Main>
  109. <h1>Content Region</h1>
  110. <p>Some text here</p>
  111. </Layout.Main>
  112. <Layout.Side>
  113. <h3>Sidebar content</h3>
  114. </Layout.Side>
  115. </Layout.Body>
  116. </Container>
  117. );
  118. _6633WithManyHeaderControls.storyName = '66/33 with many header controls';
  119. _6633WithManyHeaderControls.parameters = {
  120. docs: {
  121. description: {
  122. story: 'Two column layout with header controls',
  123. },
  124. },
  125. };
  126. export const SingleColumnMode = () => (
  127. <Container>
  128. <Layout.Header>
  129. <Layout.HeaderContent>
  130. <Breadcrumbs crumbs={crumbs} />
  131. <Layout.Title>Some heading content</Layout.Title>
  132. </Layout.HeaderContent>
  133. <Layout.HeaderActions>
  134. <ButtonBar gap={1}>
  135. <Button size="small">clicker</Button>
  136. <Button size="small">clicker</Button>
  137. </ButtonBar>
  138. </Layout.HeaderActions>
  139. </Layout.Header>
  140. <Layout.Body>
  141. <Layout.Main fullWidth>
  142. <h1>Content Region</h1>
  143. <p>
  144. Some text here, that goes on and on. It should strecth the full width of the
  145. container, and have no space on the right.
  146. </p>
  147. </Layout.Main>
  148. </Layout.Body>
  149. </Container>
  150. );
  151. SingleColumnMode.storyName = 'single column mode';
  152. SingleColumnMode.parameters = {
  153. docs: {
  154. description: {
  155. story: 'Single column mode so we can hide the sidebar',
  156. },
  157. },
  158. };
  159. export const _6633WithTabNavigation = () => (
  160. <Container>
  161. <BorderlessHeader>
  162. <Layout.HeaderContent>
  163. <StyledLayoutTitle>Alerts</StyledLayoutTitle>
  164. </Layout.HeaderContent>
  165. <Layout.HeaderActions>
  166. <ButtonBar gap={1}>
  167. <Button size="small">clicker</Button>
  168. <Button size="small">clicker</Button>
  169. </ButtonBar>
  170. </Layout.HeaderActions>
  171. </BorderlessHeader>
  172. <TabLayoutHeader>
  173. <Layout.HeaderNavTabs underlined>
  174. <li className="active">
  175. <Link to="#">Active</Link>
  176. </li>
  177. <li>
  178. <Link to="#">Inactive</Link>
  179. </li>
  180. </Layout.HeaderNavTabs>
  181. </TabLayoutHeader>
  182. <Layout.Body>
  183. <Layout.Main>
  184. <h1>Content Region</h1>
  185. <p>Some text here</p>
  186. </Layout.Main>
  187. <Layout.Side>
  188. <h3>Sidebar content</h3>
  189. </Layout.Side>
  190. </Layout.Body>
  191. </Container>
  192. );
  193. _6633WithTabNavigation.storyName = '66/33 with tab based nav';
  194. _6633WithTabNavigation.parameters = {
  195. docs: {
  196. description: {
  197. story: 'Two column layout with tab navigation',
  198. },
  199. },
  200. };
  201. const Container = styled('div')`
  202. background: ${p => p.theme.backgroundSecondary};
  203. margin: ${space(2)};
  204. border: 1px solid ${p => p.theme.border};
  205. `;
  206. const MarginedButtonBar = styled(ButtonBar)`
  207. margin-bottom: ${space(1)};
  208. `;
  209. const StyledLayoutTitle = styled(Layout.Title)`
  210. margin-top: ${space(0.5)};
  211. `;
  212. const BorderlessHeader = styled(Layout.Header)`
  213. border-bottom: 0;
  214. `;
  215. const TabLayoutHeader = styled(Layout.Header)`
  216. padding-top: 0;
  217. @media (max-width: ${p => p.theme.breakpoints[1]}) {
  218. padding-top: 0;
  219. }
  220. `;