layout-thirds.stories.js 6.1 KB

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