layout.tsx 1.6 KB

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