layout.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import {useEffect} from 'react';
  2. import styled from '@emotion/styled';
  3. import Link from 'sentry/components/links/link';
  4. import Panel from 'sentry/components/panels/panel';
  5. import {IconSentry} from 'sentry/icons';
  6. import {space} from 'sentry/styles/space';
  7. import {AppBodyContent} from 'sentry/views/app/appBodyContent';
  8. const BODY_CLASSES = ['narrow'];
  9. function Layout({children}: any) {
  10. useEffect(() => {
  11. document.body.classList.add(...BODY_CLASSES);
  12. return () => document.body.classList.remove(...BODY_CLASSES);
  13. }, []);
  14. return (
  15. <div className="app">
  16. <AppBodyContent>
  17. <AuthContainer>
  18. <div className="pattern-bg" />
  19. <AuthPanel>
  20. <AuthSidebar>
  21. <SentryButton />
  22. </AuthSidebar>
  23. <div>{children}</div>
  24. </AuthPanel>
  25. </AuthContainer>
  26. </AppBodyContent>
  27. </div>
  28. );
  29. }
  30. const AuthContainer = styled('div')`
  31. display: flex;
  32. align-items: flex-start;
  33. justify-content: center;
  34. padding-top: 5vh;
  35. `;
  36. const AuthPanel = styled(Panel)`
  37. min-width: 550px;
  38. display: inline-grid;
  39. grid-template-columns: 60px 1fr;
  40. `;
  41. const AuthSidebar = styled('div')`
  42. display: flex;
  43. justify-content: center;
  44. align-items: flex-start;
  45. padding: ${space(3)};
  46. border-radius: ${p => p.theme.borderRadius} 0 0 ${p => p.theme.borderRadius};
  47. margin: -1px;
  48. margin-right: 0;
  49. background: #564f64;
  50. background-image: linear-gradient(
  51. -180deg,
  52. rgba(52, 44, 62, 0) 0%,
  53. rgba(52, 44, 62, 0.5) 100%
  54. );
  55. `;
  56. const SentryButton = styled(
  57. (p: Omit<React.ComponentPropsWithoutRef<typeof Link>, 'to'>) => (
  58. <Link to="/" {...p}>
  59. <IconSentry size="lg" />
  60. </Link>
  61. )
  62. )`
  63. color: #fff;
  64. &:hover,
  65. &:focus {
  66. color: #fff;
  67. }
  68. `;
  69. export default Layout;