layout-thirds.stories.js 5.7 KB

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