Ringtone app
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

115 líneas
2.5 KiB

  1. import {LeftSidebarWithMenu} from '@theoryofnekomata/viewfinder';
  2. import Brand from '../../../molecules/brand/Brand';
  3. import Link from '../../../molecules/navigation/Link';
  4. import OmnisearchForm from '../../forms/Omnisearch';
  5. import {moreLinkMenuItem, sidebarMenuItems} from '../../../../data/layout';
  6. import {FC, FormEventHandler} from 'react';
  7. import {Session} from '@auth0/nextjs-auth0';
  8. import styled from 'styled-components';
  9. import Avatar from '../../../molecules/presentation/Avatar';
  10. const TopBarComponent = styled('div')({
  11. backgroundColor: 'var(--color-bg, white)',
  12. position: 'relative',
  13. '::before': {
  14. content: "''",
  15. position: 'absolute',
  16. bottom: 0,
  17. left: 0,
  18. width: '100%',
  19. height: '0.0625rem',
  20. pointerEvents: 'none',
  21. backgroundColor: 'currentcolor',
  22. opacity: 0.25,
  23. },
  24. })
  25. const SidebarMenuComponent = styled('div')({
  26. backgroundColor: 'var(--color-bg, white)',
  27. '::before': {
  28. content: "''",
  29. position: 'absolute',
  30. top: 0,
  31. right: 0,
  32. height: '100%',
  33. width: '0.0625rem',
  34. pointerEvents: 'none',
  35. backgroundColor: 'currentcolor',
  36. opacity: 0.25,
  37. },
  38. })
  39. type Props = {
  40. onSearch?: FormEventHandler,
  41. session?: Partial<Session>,
  42. }
  43. const BasicLayout: FC<Props> = ({
  44. onSearch,
  45. session,
  46. children,
  47. }) => {
  48. return (
  49. <LeftSidebarWithMenu.Layout
  50. brand={
  51. <Brand />
  52. }
  53. userLink={
  54. <Link
  55. href={{
  56. query: {
  57. popup: 'user',
  58. },
  59. }}
  60. >
  61. <Avatar
  62. src={session.user.picture}
  63. />
  64. </Link>
  65. }
  66. topBarComponent={TopBarComponent}
  67. sidebarMenuComponent={SidebarMenuComponent}
  68. topBarCenter={
  69. <OmnisearchForm
  70. labels={{
  71. form: 'Search',
  72. query: 'Query',
  73. }}
  74. onSubmit={onSearch}
  75. action="/api/a/search"
  76. />
  77. }
  78. linkComponent={({ url, icon, label, }) => (
  79. <Link
  80. href={url}
  81. >
  82. <LeftSidebarWithMenu.SidebarMenuContainer>
  83. <LeftSidebarWithMenu.SidebarMenuItemIcon>
  84. {icon}
  85. </LeftSidebarWithMenu.SidebarMenuItemIcon>
  86. {label}
  87. </LeftSidebarWithMenu.SidebarMenuContainer>
  88. </Link>
  89. )}
  90. moreLinkMenuItem={moreLinkMenuItem}
  91. moreLinkComponent={({ url, icon, label, }) => (
  92. <Link
  93. href={url}
  94. >
  95. <LeftSidebarWithMenu.MoreSidebarMenuContainer>
  96. <LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
  97. {icon}
  98. </LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
  99. {label}
  100. </LeftSidebarWithMenu.MoreSidebarMenuContainer>
  101. </Link>
  102. )}
  103. sidebarMenuItems={sidebarMenuItems}
  104. >
  105. {children}
  106. </LeftSidebarWithMenu.Layout>
  107. )
  108. }
  109. export default BasicLayout